diff options
author | Junio C Hamano <gitster@pobox.com> | 2015-06-25 11:07:42 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2015-06-25 11:07:42 -0700 |
commit | 5416f8af0f632d05371868bc4340327e1672c83c (patch) | |
tree | ba1aff5fb3960a282a51c1abca0eaaa31da0ee71 | |
parent | a6a1ad9b257a6ce4b236644993894772b57fd12a (diff) | |
parent | e2c6f7cd5a66ed0009662d2651e0cf3c655e83a9 (diff) | |
download | git-5416f8af0f632d05371868bc4340327e1672c83c.tar.gz |
Merge branch 'cb/array-size'
* cb/array-size:
Fix definition of ARRAY_SIZE for non-gcc builds
-rw-r--r-- | git-compat-util.h | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/git-compat-util.h b/git-compat-util.h index 0cc7ae84ba..c6d391f864 100644 --- a/git-compat-util.h +++ b/git-compat-util.h @@ -58,15 +58,13 @@ #define BUILD_ASSERT_OR_ZERO(cond) \ (sizeof(char [1 - 2*!(cond)]) - 1) -#if defined(__GNUC__) && (__GNUC__ >= 3) -# if GIT_GNUC_PREREQ(3, 1) +#if GIT_GNUC_PREREQ(3, 1) /* &arr[0] degrades to a pointer: a different type from an array */ # define BARF_UNLESS_AN_ARRAY(arr) \ BUILD_ASSERT_OR_ZERO(!__builtin_types_compatible_p(__typeof__(arr), \ __typeof__(&(arr)[0]))) -# else -# define BARF_UNLESS_AN_ARRAY(arr) 0 -# endif +#else +# define BARF_UNLESS_AN_ARRAY(arr) 0 #endif /* * ARRAY_SIZE - get the number of elements in a visible array |