From 52659310edbcd0f52c676ae80dd12d682c0ca2cd Mon Sep 17 00:00:00 2001 From: Peter Eisentraut Date: Mon, 17 Feb 2020 09:05:30 +0100 Subject: [PATCH] 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. --- configure | 73 -------------------------------------- configure.in | 2 -- src/include/c.h | 15 ++------ src/include/pg_config.h.in | 14 -------- src/timezone/README | 6 +--- src/tools/msvc/Solution.pm | 6 +--- 6 files changed, 4 insertions(+), 112 deletions(-) diff --git a/configure b/configure index 37aa82dcd4..569cd2fa91 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 8adb409558..140909091a 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 d10b9812fb..2e8b2d4e3f 100644 --- a/src/include/c.h +++ b/src/include/c.h @@ -64,9 +64,7 @@ #ifdef HAVE_STRINGS_H #include #endif -#ifdef HAVE_STDINT_H #include -#endif #include #include #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 60dcf42974..e7de8f3b2b 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 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 d3dd7b7fa6..db12af75e6 100644 --- a/src/timezone/README +++ b/src/timezone/README @@ -70,11 +70,7 @@ 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 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. * Since Postgres is typically built on a system that has its own copy of the functions, we must avoid conflicting with those. This diff --git a/src/tools/msvc/Solution.pm b/src/tools/msvc/Solution.pm index 8412ef298e..d1a4f183f3 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}) { -- 2.25.0