X-Git-Url: https://asedeno.scripts.mit.edu/gitweb/?a=blobdiff_plain;f=git-compat-util.h;h=79eb10eacba955e0c58a0a540c4ac577f84953e9;hb=4eb39e9bcccc54eb23af8a7e2676c63e5bf32866;hp=276a43724d91781a6c6d79b283ef526e09917c87;hpb=5d1d1c14790cf74eb0d630c4404114206061232d;p=git.git diff --git a/git-compat-util.h b/git-compat-util.h index 276a43724..79eb10eac 100644 --- a/git-compat-util.h +++ b/git-compat-util.h @@ -4,10 +4,24 @@ #define _FILE_OFFSET_BITS 64 #ifndef FLEX_ARRAY -#if defined(__GNUC__) && (__GNUC__ < 3) -#define FLEX_ARRAY 0 -#else -#define FLEX_ARRAY /* empty */ +/* + * See if our compiler is known to support flexible array members. + */ +#if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L) +# define FLEX_ARRAY /* empty */ +#elif defined(__GNUC__) +# if (__GNUC__ >= 3) +# define FLEX_ARRAY /* empty */ +# else +# define FLEX_ARRAY 0 /* older GNU extension */ +# endif +#endif + +/* + * Otherwise, default to safer but a bit wasteful traditional style + */ +#ifndef FLEX_ARRAY +# define FLEX_ARRAY 1 #endif #endif @@ -53,6 +67,8 @@ #include #include #include +#include +#include #include #include #include