aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--config/c-compiler.m415
-rwxr-xr-xconfigure72
-rw-r--r--configure.in2
-rw-r--r--src/include/c.h10
-rw-r--r--src/include/pg_config.h.in12
-rw-r--r--src/tools/msvc/Solution.pm2
6 files changed, 10 insertions, 103 deletions
diff --git a/config/c-compiler.m4 b/config/c-compiler.m4
index 71b645839db..501b74b3a19 100644
--- a/config/c-compiler.m4
+++ b/config/c-compiler.m4
@@ -2,21 +2,6 @@
# config/c-compiler.m4
-# PGAC_C_SIGNED
-# -------------
-# Check if the C compiler understands signed types.
-AC_DEFUN([PGAC_C_SIGNED],
-[AC_CACHE_CHECK(for signed types, pgac_cv_c_signed,
-[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],
-[signed char c; signed short s; signed int i;])],
-[pgac_cv_c_signed=yes],
-[pgac_cv_c_signed=no])])
-if test x"$pgac_cv_c_signed" = xno ; then
- AC_DEFINE(signed,, [Define to empty if the C compiler does not understand signed types.])
-fi])# PGAC_C_SIGNED
-
-
-
# PGAC_C_PRINTF_ARCHETYPE
# -----------------------
# Select the format archetype to be used by gcc to check printf-type functions.
diff --git a/configure b/configure
index 610812d1039..d2c74e530c6 100755
--- a/configure
+++ b/configure
@@ -13694,78 +13694,6 @@ cat >>confdefs.h <<_ACEOF
_ACEOF
-
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking for flexible array members" >&5
-$as_echo_n "checking for flexible array members... " >&6; }
-if ${ac_cv_c_flexmember+:} false; then :
- $as_echo_n "(cached) " >&6
-else
- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h. */
-#include <stdlib.h>
- #include <stdio.h>
- #include <stddef.h>
- struct s { int n; double d[]; };
-int
-main ()
-{
-int m = getchar ();
- struct s *p = malloc (offsetof (struct s, d)
- + m * sizeof (double));
- p->d[0] = 0.0;
- return p->d != (double *) NULL;
- ;
- return 0;
-}
-_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
- ac_cv_c_flexmember=yes
-else
- ac_cv_c_flexmember=no
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_flexmember" >&5
-$as_echo "$ac_cv_c_flexmember" >&6; }
- if test $ac_cv_c_flexmember = yes; then
-
-$as_echo "#define FLEXIBLE_ARRAY_MEMBER /**/" >>confdefs.h
-
- else
- $as_echo "#define FLEXIBLE_ARRAY_MEMBER 1" >>confdefs.h
-
- fi
-
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for signed types" >&5
-$as_echo_n "checking for signed types... " >&6; }
-if ${pgac_cv_c_signed+:} false; then :
- $as_echo_n "(cached) " >&6
-else
- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h. */
-
-int
-main ()
-{
-signed char c; signed short s; signed int i;
- ;
- return 0;
-}
-_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
- pgac_cv_c_signed=yes
-else
- pgac_cv_c_signed=no
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $pgac_cv_c_signed" >&5
-$as_echo "$pgac_cv_c_signed" >&6; }
-if test x"$pgac_cv_c_signed" = xno ; then
-
-$as_echo "#define signed /**/" >>confdefs.h
-
-fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for __func__" >&5
$as_echo_n "checking for __func__... " >&6; }
if ${pgac_cv_funcname_func_support+:} false; then :
diff --git a/configure.in b/configure.in
index 8d7871a59a5..0b0a871298e 100644
--- a/configure.in
+++ b/configure.in
@@ -1458,8 +1458,6 @@ m4_defun([AC_PROG_CC_STDC], []) dnl We don't want that.
AC_C_BIGENDIAN
AC_C_INLINE
PGAC_PRINTF_ARCHETYPE
-AC_C_FLEXIBLE_ARRAY_MEMBER
-PGAC_C_SIGNED
PGAC_C_FUNCNAME_SUPPORT
PGAC_C_STATIC_ASSERT
PGAC_C_TYPEOF
diff --git a/src/include/c.h b/src/include/c.h
index f2cc0338de6..831c89f473d 100644
--- a/src/include/c.h
+++ b/src/include/c.h
@@ -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__
diff --git a/src/include/pg_config.h.in b/src/include/pg_config.h.in
index ddc4a3f816a..4fa0f770aaa 100644
--- a/src/include/pg_config.h.in
+++ b/src/include/pg_config.h.in
@@ -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
diff --git a/src/tools/msvc/Solution.pm b/src/tools/msvc/Solution.pm
index b15dae16a9e..a6b8b92c182 100644
--- a/src/tools/msvc/Solution.pm
+++ b/src/tools/msvc/Solution.pm
@@ -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})