aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Eisentraut <peter@eisentraut.org>2020-02-21 09:14:03 +0100
committerPeter Eisentraut <peter@eisentraut.org>2020-02-21 09:20:32 +0100
commit957338418b69e9774ccc1bab59f765a62f0aa6f9 (patch)
treec4e018e687ecb115bb235f87f8d3c60bcd12331f
parentdca3911a81f0ba823b56c3d4462419c83f385e55 (diff)
downloadpostgresql-957338418b69e9774ccc1bab59f765a62f0aa6f9.tar.gz
postgresql-957338418b69e9774ccc1bab59f765a62f0aa6f9.zip
Require stdint.h
stdint.h belongs to the compiler (as opposed to inttypes.h), so by requiring a C99 compiler we can also require stdint.h unconditionally. Remove configure checks and other workarounds for it. This also removes a few steps in the required portability adjustments to the imported time zone code, which can be applied on the next import. When using GCC on a platform that is otherwise pre-C99, this will now require at least GCC 4.5, which is the first release that supplied a standard-conforming stdint.h if the native platform didn't have it. Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us> Discussion: https://www.postgresql.org/message-id/flat/5d398bbb-262a-5fed-d839-d0e5cff3c0d7%402ndquadrant.com
-rwxr-xr-xconfigure73
-rw-r--r--configure.in2
-rw-r--r--src/include/c.h15
-rw-r--r--src/include/pg_config.h.in14
-rw-r--r--src/timezone/README14
-rw-r--r--src/tools/msvc/Solution.pm6
6 files changed, 5 insertions, 119 deletions
diff --git a/configure b/configure
index 37aa82dcd4e..569cd2fa916 100755
--- a/configure
+++ b/configure
@@ -14154,79 +14154,6 @@ _ACEOF
fi
- ac_fn_c_check_type "$LINENO" "intptr_t" "ac_cv_type_intptr_t" "$ac_includes_default"
-if test "x$ac_cv_type_intptr_t" = xyes; then :
-
-$as_echo "#define HAVE_INTPTR_T 1" >>confdefs.h
-
-else
- for ac_type in 'int' 'long int' 'long long int'; do
- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h. */
-$ac_includes_default
-int
-main ()
-{
-static int test_array [1 - 2 * !(sizeof (void *) <= sizeof ($ac_type))];
-test_array [0] = 0;
-return test_array [0];
-
- ;
- return 0;
-}
-_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
-
-cat >>confdefs.h <<_ACEOF
-#define intptr_t $ac_type
-_ACEOF
-
- ac_type=
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
- test -z "$ac_type" && break
- done
-fi
-
-
-
- ac_fn_c_check_type "$LINENO" "uintptr_t" "ac_cv_type_uintptr_t" "$ac_includes_default"
-if test "x$ac_cv_type_uintptr_t" = xyes; then :
-
-$as_echo "#define HAVE_UINTPTR_T 1" >>confdefs.h
-
-else
- for ac_type in 'unsigned int' 'unsigned long int' \
- 'unsigned long long int'; do
- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h. */
-$ac_includes_default
-int
-main ()
-{
-static int test_array [1 - 2 * !(sizeof (void *) <= sizeof ($ac_type))];
-test_array [0] = 0;
-return test_array [0];
-
- ;
- return 0;
-}
-_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
-
-cat >>confdefs.h <<_ACEOF
-#define uintptr_t $ac_type
-_ACEOF
-
- ac_type=
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
- test -z "$ac_type" && break
- done
-fi
-
-
-
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for locale_t" >&5
$as_echo_n "checking for locale_t... " >&6; }
if ${pgac_cv_type_locale_t+:} false; then :
diff --git a/configure.in b/configure.in
index 8adb409558f..140909091a1 100644
--- a/configure.in
+++ b/configure.in
@@ -1477,8 +1477,6 @@ PGAC_STRUCT_SOCKADDR_UN
PGAC_STRUCT_SOCKADDR_STORAGE
PGAC_STRUCT_SOCKADDR_STORAGE_MEMBERS
PGAC_STRUCT_ADDRINFO
-AC_TYPE_INTPTR_T
-AC_TYPE_UINTPTR_T
PGAC_TYPE_LOCALE_T
diff --git a/src/include/c.h b/src/include/c.h
index d10b9812fbe..2e8b2d4e3fe 100644
--- a/src/include/c.h
+++ b/src/include/c.h
@@ -64,9 +64,7 @@
#ifdef HAVE_STRINGS_H
#include <strings.h>
#endif
-#ifdef HAVE_STDINT_H
#include <stdint.h>
-#endif
#include <sys/types.h>
#include <errno.h>
#if defined(WIN32) || defined(__CYGWIN__)
@@ -429,8 +427,8 @@ typedef unsigned PG_INT128_TYPE uint128
#endif
/*
- * stdint.h limits aren't guaranteed to be present and aren't guaranteed to
- * have compatible types with our fixed width types. So just define our own.
+ * stdint.h limits aren't guaranteed to have compatible types with our fixed
+ * width types. So just define our own.
*/
#define PG_INT8_MIN (-0x7F-1)
#define PG_INT8_MAX (0x7F)
@@ -445,15 +443,6 @@ typedef unsigned PG_INT128_TYPE uint128
#define PG_INT64_MAX INT64CONST(0x7FFFFFFFFFFFFFFF)
#define PG_UINT64_MAX UINT64CONST(0xFFFFFFFFFFFFFFFF)
-/* Max value of size_t might also be missing if we don't have stdint.h */
-#ifndef SIZE_MAX
-#if SIZEOF_SIZE_T == 8
-#define SIZE_MAX PG_UINT64_MAX
-#else
-#define SIZE_MAX PG_UINT32_MAX
-#endif
-#endif
-
/*
* We now always use int64 timestamps, but keep this symbol defined for the
* benefit of external code that might test it.
diff --git a/src/include/pg_config.h.in b/src/include/pg_config.h.in
index 60dcf42974f..e7de8f3b2b4 100644
--- a/src/include/pg_config.h.in
+++ b/src/include/pg_config.h.in
@@ -310,9 +310,6 @@
/* Define to 1 if the system has the type `int8'. */
#undef HAVE_INT8
-/* Define to 1 if the system has the type `intptr_t'. */
-#undef HAVE_INTPTR_T
-
/* Define to 1 if you have the <inttypes.h> header file. */
#undef HAVE_INTTYPES_H
@@ -680,9 +677,6 @@
/* Define to 1 if the system has the type `uint8'. */
#undef HAVE_UINT8
-/* Define to 1 if the system has the type `uintptr_t'. */
-#undef HAVE_UINTPTR_T
-
/* Define to 1 if the system has the type `union semun'. */
#undef HAVE_UNION_SEMUN
@@ -1006,10 +1000,6 @@
#undef inline
#endif
-/* Define to the type of a signed integer type wide enough to hold a pointer,
- if such a type exists, and if the system does not define it. */
-#undef intptr_t
-
/* Define to keyword to use for C99 restrict support, or to nothing if not
supported */
#undef pg_restrict
@@ -1033,7 +1023,3 @@
/* Define to how the compiler spells `typeof'. */
#undef typeof
-
-/* Define to the type of an unsigned integer type wide enough to hold a
- pointer, if such a type exists, and if the system does not define it. */
-#undef uintptr_t
diff --git a/src/timezone/README b/src/timezone/README
index d3dd7b7fa6d..3c593933c1c 100644
--- a/src/timezone/README
+++ b/src/timezone/README
@@ -70,11 +70,8 @@ old-style function declarations to C89 style, but thank goodness they
fixed that.)
* We need the code to follow Postgres' portability conventions; this
-includes relying on configure's results rather than hand-hacked #defines,
-and not relying on <stdint.h> features that may not exist on old systems.
-(In particular this means using Postgres' definitions of the int32 and
-int64 typedefs, not int_fast32_t/int_fast64_t. Likewise we use
-PG_INT32_MIN/MAX not INT32_MIN/MAX.)
+includes relying on configure's results rather than hand-hacked
+#defines (see private.h).
* Since Postgres is typically built on a system that has its own copy
of the <time.h> functions, we must avoid conflicting with those. This
@@ -112,13 +109,6 @@ to first run the tzcode source files through a sed filter like this:
-e 's|^\*/| */|' \
-e 's/\bregister[ \t]//g' \
-e 's/\bATTRIBUTE_PURE[ \t]//g' \
- -e 's/int_fast32_t/int32/g' \
- -e 's/int_fast64_t/int64/g' \
- -e 's/intmax_t/int64/g' \
- -e 's/INT32_MIN/PG_INT32_MIN/g' \
- -e 's/INT32_MAX/PG_INT32_MAX/g' \
- -e 's/INTMAX_MIN/PG_INT64_MIN/g' \
- -e 's/INTMAX_MAX/PG_INT64_MAX/g' \
-e 's/struct[ \t]+tm\b/struct pg_tm/g' \
-e 's/\btime_t\b/pg_time_t/g' \
-e 's/lineno/lineno_t/g' \
diff --git a/src/tools/msvc/Solution.pm b/src/tools/msvc/Solution.pm
index 8412ef298ea..d1a4f183f3e 100644
--- a/src/tools/msvc/Solution.pm
+++ b/src/tools/msvc/Solution.pm
@@ -275,7 +275,6 @@ sub GenerateFiles
HAVE_INT_TIMEZONE => 1,
HAVE_INT64 => undef,
HAVE_INT8 => undef,
- HAVE_INTPTR_T => undef,
HAVE_INTTYPES_H => undef,
HAVE_INT_OPTERR => undef,
HAVE_INT_OPTRESET => undef,
@@ -396,7 +395,6 @@ sub GenerateFiles
HAVE_UCRED_H => undef,
HAVE_UINT64 => undef,
HAVE_UINT8 => undef,
- HAVE_UINTPTR_T => undef,
HAVE_UNION_SEMUN => undef,
HAVE_UNISTD_H => 1,
HAVE_UNIX_SOCKETS => undef,
@@ -496,13 +494,11 @@ sub GenerateFiles
_LARGEFILE_SOURCE => undef,
_LARGE_FILES => undef,
inline => '__inline',
- intptr_t => undef,
pg_restrict => '__restrict',
# not defined, because it'd conflict with __declspec(restrict)
restrict => undef,
signed => undef,
- typeof => undef,
- uintptr_t => undef,);
+ typeof => undef,);
if ($self->{options}->{uuid})
{