1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-30 11:03:19 +03:00

Assume that we have signed integral types and flexible array members.

These compiler features are required by C99, so remove the configure
probes for them.

This is part of a series of commits to get rid of no-longer-relevant
configure checks and dead src/port/ code.  I'm committing them separately
to make it easier to back out individual changes if they prove less
portable than I expect.

Discussion: https://postgr.es/m/15379.1582221614@sss.pgh.pa.us
This commit is contained in:
Tom Lane
2020-02-21 14:30:21 -05:00
parent 97cf1fa4ed
commit f4d59369d2
6 changed files with 10 additions and 103 deletions

View File

@ -265,6 +265,16 @@
#define dummyret char
#endif
/*
* We require C99, hence the compiler should understand flexible array
* members. However, for documentation purposes we still consider it to be
* project style to write "field[FLEXIBLE_ARRAY_MEMBER]" not just "field[]".
* When computing the size of such an object, use "offsetof(struct s, f)"
* for portability. Don't use "offsetof(struct s, f[0])", as this doesn't
* work with MSVC and with C++ compilers.
*/
#define FLEXIBLE_ARRAY_MEMBER /* empty */
/* Which __func__ symbol do we have, if any? */
#ifdef HAVE_FUNCNAME__FUNC
#define PG_FUNCNAME_MACRO __func__

View File

@ -64,15 +64,6 @@
(--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
/* Define to 1 if gettimeofday() takes only 1 argument. */
#undef GETTIMEOFDAY_1ARG
@ -976,8 +967,5 @@
# define __restrict__
#endif
/* Define to empty if the C compiler does not understand signed types. */
#undef signed
/* Define to how the compiler spells `typeof'. */
#undef typeof

View File

@ -201,7 +201,6 @@ sub GenerateFiles
ENABLE_GSS => $self->{options}->{gss} ? 1 : undef,
ENABLE_NLS => $self->{options}->{nls} ? 1 : undef,
ENABLE_THREAD_SAFETY => 1,
FLEXIBLE_ARRAY_MEMBER => '/**/',
GETTIMEOFDAY_1ARG => undef,
HAVE_APPEND_HISTORY => undef,
HAVE_ASN1_STRING_GET0_DATA => undef,
@ -483,7 +482,6 @@ sub GenerateFiles
pg_restrict => '__restrict',
# not defined, because it'd conflict with __declspec(restrict)
restrict => undef,
signed => undef,
typeof => undef,);
if ($self->{options}->{uuid})