block-sha1: guard gcc extensions with __GNUC__
With this, the code should now be portable to any C compiler. Signed-off-by: Nicolas Pitre <nico@cam.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Nicolas Pitre committed
Aug 18, 2009 at 15:37 UTC
e9c5dcd1313dd4e2f606419ce3d228c99fae2c40
1 file changed
+2
-2
block-sha1/sha1.c
+2
-2
@@ -9,7 +9,7 @@
9
10
#include "sha1.h"
11
12
-#if defined(__i386__) || defined(__x86_64__)
12
+#if defined(__GNUC__) && (defined(__i386__) || defined(__x86_64__))
13
14
/*
15
* Force usage of rol or ror by selecting the one with the smaller constant.
@@ -54,7 +54,7 @@
54
55
#if defined(__i386__) || defined(__x86_64__)
56
#define setW(x, val) (*(volatile unsigned int *)&W(x) = (val))
57
-#elif defined(__arm__)
57
+#elif defined(__GNUC__) && defined(__arm__)
58
#define setW(x, val) do { W(x) = (val); __asm__("":::"memory"); } while (0)
59
#else
60
#define setW(x, val) (W(x) = (val))