Skip to content

Commit d0c99fc

Browse files
committed
Merge branch 'jc/flex-array-definition'
The conditions to choose different definitions of the FLEX_ARRAY macro for vendor compilers has been simplified to make it easier to maintain. * jc/flex-array-definition: flex-array: simplify compiler-specific workaround
2 parents b58e7bf + deefc2d commit d0c99fc

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

git-compat-util.h

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,14 +46,23 @@
4646
/*
4747
* See if our compiler is known to support flexible array members.
4848
*/
49-
#if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L) && (!defined(__SUNPRO_C) || (__SUNPRO_C > 0x580))
50-
# define FLEX_ARRAY /* empty */
49+
50+
/*
51+
* Check vendor specific quirks first, before checking the
52+
* __STDC_VERSION__, as vendor compilers can lie and we need to be
53+
* able to work them around. Note that by not defining FLEX_ARRAY
54+
* here, we can fall back to use the "safer but a bit wasteful" one
55+
* later.
56+
*/
57+
#if defined(__SUNPRO_C) && (__SUNPRO_C <= 0x580)
5158
#elif defined(__GNUC__)
5259
# if (__GNUC__ >= 3)
5360
# define FLEX_ARRAY /* empty */
5461
# else
5562
# define FLEX_ARRAY 0 /* older GNU extension */
5663
# endif
64+
#elif defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L)
65+
# define FLEX_ARRAY /* empty */
5766
#endif
5867

5968
/*

0 commit comments

Comments
 (0)