diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/include/access/gist.h | 2 | ||||
-rw-r--r-- | src/include/pg_config.h.in | 9 |
2 files changed, 10 insertions, 1 deletions
diff --git a/src/include/access/gist.h b/src/include/access/gist.h index df9f39c7b89..5ce7325ff9b 100644 --- a/src/include/access/gist.h +++ b/src/include/access/gist.h @@ -144,7 +144,7 @@ typedef struct GISTENTRY typedef struct { int32 n; /* number of elements */ - GISTENTRY vector[1]; /* variable-length array */ + GISTENTRY vector[FLEXIBLE_ARRAY_MEMBER]; } GistEntryVector; #define GEVHDRSZ (offsetof(GistEntryVector, vector)) diff --git a/src/include/pg_config.h.in b/src/include/pg_config.h.in index 5d38f25d263..19f38cc0fd0 100644 --- a/src/include/pg_config.h.in +++ b/src/include/pg_config.h.in @@ -61,6 +61,15 @@ (--enable-thread-safety) */ #undef ENABLE_THREAD_SAFETY +/* Define to nothing if C supports flexible array members, and to 1 if it does + not. That way, with a declaration like `struct s { int n; double + d[FLEXIBLE_ARRAY_MEMBER]; };', the struct hack can be used with pre-C99 + compilers. When computing the size of such an object, don't use 'sizeof + (struct s)' as it overestimates the size. Use 'offsetof (struct s, d)' + instead. Don't use 'offsetof (struct s, d[0])', as this doesn't work with + MSVC and with C++ compilers. */ +#undef FLEXIBLE_ARRAY_MEMBER + /* float4 values are passed by value if 'true', by reference if 'false' */ #undef FLOAT4PASSBYVAL |