diff --git a/configure b/configure index 67740109252..eec527c8479 100755 --- a/configure +++ b/configure @@ -13412,31 +13412,6 @@ cat >>confdefs.h <<_ACEOF _ACEOF - -if test x"$HAVE_LONG_LONG_INT_64" = xyes ; then - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -#define INT64CONST(x) x##LL -long long int foo = INT64CONST(0x1234567890123456); - -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - -$as_echo "#define HAVE_LL_CONSTANTS 1" >>confdefs.h - -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi - - # If we found "long int" is 64 bits, assume snprintf handles it. If # we found we need to use "long long int", better check. We cope with # snprintfs that use %lld, %qd, or %I64d as the format. If none of these diff --git a/configure.in b/configure.in index f06f890c85d..f87fc3639bd 100644 --- a/configure.in +++ b/configure.in @@ -1708,19 +1708,6 @@ fi AC_DEFINE_UNQUOTED(PG_INT64_TYPE, $pg_int64_type, [Define to the name of a signed 64-bit integer type.]) -dnl If we need to use "long long int", figure out whether nnnLL notation works. - -if test x"$HAVE_LONG_LONG_INT_64" = xyes ; then - AC_TRY_COMPILE([ -#define INT64CONST(x) x##LL -long long int foo = INT64CONST(0x1234567890123456); -], - [], - [AC_DEFINE(HAVE_LL_CONSTANTS, 1, [Define to 1 if constants of type 'long long int' should have the suffix LL.])], - []) -fi - - # If we found "long int" is 64 bits, assume snprintf handles it. If # we found we need to use "long long int", better check. We cope with # snprintfs that use %lld, %qd, or %I64d as the format. If none of these diff --git a/src/include/c.h b/src/include/c.h index 576f93f1ebd..6745e2d4e1d 100644 --- a/src/include/c.h +++ b/src/include/c.h @@ -261,6 +261,8 @@ typedef long int int64; #ifndef HAVE_UINT64 typedef unsigned long int uint64; #endif +#define INT64CONST(x) (x##L) +#define UINT64CONST(x) (x##UL) #elif defined(HAVE_LONG_LONG_INT_64) /* We have working support for "long long int", use that */ @@ -270,20 +272,13 @@ typedef long long int int64; #ifndef HAVE_UINT64 typedef unsigned long long int uint64; #endif +#define INT64CONST(x) (x##LL) +#define UINT64CONST(x) (x##ULL) #else /* neither HAVE_LONG_INT_64 nor HAVE_LONG_LONG_INT_64 */ #error must have a working 64-bit integer datatype #endif -/* Decide if we need to decorate 64-bit constants */ -#ifdef HAVE_LL_CONSTANTS -#define INT64CONST(x) ((int64) x##LL) -#define UINT64CONST(x) ((uint64) x##ULL) -#else -#define INT64CONST(x) ((int64) x) -#define UINT64CONST(x) ((uint64) x) -#endif - /* snprintf format strings to use for 64-bit integers */ #define INT64_FORMAT "%" INT64_MODIFIER "d" #define UINT64_FORMAT "%" INT64_MODIFIER "u" @@ -311,14 +306,18 @@ typedef unsigned PG_INT128_TYPE uint128; #define PG_UINT16_MAX (0xFFFF) #define PG_INT32_MIN (-0x7FFFFFFF-1) #define PG_INT32_MAX (0x7FFFFFFF) -#define PG_UINT32_MAX (0xFFFFFFFF) +#define PG_UINT32_MAX (0xFFFFFFFFU) #define PG_INT64_MIN (-INT64CONST(0x7FFFFFFFFFFFFFFF) - 1) #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 -#define SIZE_MAX ((size_t) -1) +#if SIZEOF_SIZE_T == 8 +#define SIZE_MAX PG_UINT64_MAX +#else +#define SIZE_MAX PG_UINT32_MAX +#endif #endif /* Select timestamp representation (float8 or int64) */ diff --git a/src/include/pg_config.h.in b/src/include/pg_config.h.in index 81199d057d7..c7be116e127 100644 --- a/src/include/pg_config.h.in +++ b/src/include/pg_config.h.in @@ -333,10 +333,6 @@ /* Define to 1 if you have the `z' library (-lz). */ #undef HAVE_LIBZ -/* Define to 1 if constants of type 'long long int' should have the suffix LL. - */ -#undef HAVE_LL_CONSTANTS - /* Define to 1 if the system has the type `locale_t'. */ #undef HAVE_LOCALE_T diff --git a/src/include/pg_config.h.win32 b/src/include/pg_config.h.win32 index bdb436b7d7f..688192dd036 100644 --- a/src/include/pg_config.h.win32 +++ b/src/include/pg_config.h.win32 @@ -217,12 +217,6 @@ /* Define to 1 if you have the `z' library (-lz). */ /* #undef HAVE_LIBZ */ -/* Define to 1 if constants of type 'long long int' should have the suffix LL. - */ -#if (_MSC_VER > 1200) -#define HAVE_LL_CONSTANTS 1 -#endif - /* Define to 1 if the system has the type `locale_t'. */ #define HAVE_LOCALE_T 1 @@ -231,7 +225,7 @@ /* Define to 1 if `long long int' works and is 64 bits. */ #if (_MSC_VER > 1200) -#define HAVE_LONG_LONG_INT_64 +#define HAVE_LONG_LONG_INT_64 1 #endif /* Define to 1 if you have the `mbstowcs_l' function. */