HAVE_LONG_LONG_INT is now implied by the requirement for C99, so the
separate Autoconf check can be removed. The uses are almost all in ecpg
code, and AFAICT the check was originally added specifically for ecpg.
--
Peter Eisentraut http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services
From 913823e1985f14908d7e1abe6215f63982b722a1 Mon Sep 17 00:00:00 2001
From: Peter Eisentraut <pe...@eisentraut.org>
Date: Wed, 30 Oct 2019 14:39:15 +0100
Subject: [PATCH] Remove HAVE_LONG_LONG_INT
The presence of long long int is now implied in the requirement for
C99 and the configure check for the same.
We keep the define hard-coded in ecpg_config.h for backward
compatibility.
---
configure | 117 ------------------
configure.in | 1 -
src/include/c.h | 2 -
src/include/pg_config.h.in | 6 -
src/include/pg_config.h.win32 | 3 -
src/interfaces/ecpg/ecpglib/data.c | 14 ---
src/interfaces/ecpg/ecpglib/descriptor.c | 4 -
src/interfaces/ecpg/ecpglib/execute.c | 6 +-
src/interfaces/ecpg/ecpglib/misc.c | 6 -
src/interfaces/ecpg/include/ecpg_config.h.in | 2 +-
src/interfaces/ecpg/preproc/ecpg.trailer | 36 +-----
src/interfaces/ecpg/test/expected/sql-sqlda.c | 2 -
src/interfaces/ecpg/test/sql/sqlda.pgc | 2 -
13 files changed, 7 insertions(+), 194 deletions(-)
diff --git a/configure b/configure
index 6b1c779ee3..7312bd7a7a 100755
--- a/configure
+++ b/configure
@@ -14170,123 +14170,6 @@ fi
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking for unsigned long long
int" >&5
-$as_echo_n "checking for unsigned long long int... " >&6; }
-if ${ac_cv_type_unsigned_long_long_int+:} false; then :
- $as_echo_n "(cached) " >&6
-else
- ac_cv_type_unsigned_long_long_int=yes
- if test "x${ac_cv_prog_cc_c99-no}" = xno; then
- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h. */
-
- /* For now, do not test the preprocessor; as of 2007 there are too many
- implementations with broken preprocessors. Perhaps this can
- be revisited in 2012. In the meantime, code should not expect
- #if to work with literals wider than 32 bits. */
- /* Test literals. */
- long long int ll = 9223372036854775807ll;
- long long int nll = -9223372036854775807LL;
- unsigned long long int ull = 18446744073709551615ULL;
- /* Test constant expressions. */
- typedef int a[((-9223372036854775807LL < 0 && 0 < 9223372036854775807ll)
- ? 1 : -1)];
- typedef int b[(18446744073709551615ULL <= (unsigned long long int) -1
- ? 1 : -1)];
- int i = 63;
-int
-main ()
-{
-/* Test availability of runtime routines for shift and division. */
- long long int llmax = 9223372036854775807ll;
- unsigned long long int ullmax = 18446744073709551615ull;
- return ((ll << 63) | (ll >> 63) | (ll < i) | (ll > i)
- | (llmax / ll) | (llmax % ll)
- | (ull << 63) | (ull >> 63) | (ull << i) | (ull >> i)
- | (ullmax / ull) | (ullmax % ull));
- ;
- return 0;
-}
-
-_ACEOF
-if ac_fn_c_try_link "$LINENO"; then :
-
-else
- ac_cv_type_unsigned_long_long_int=no
-fi
-rm -f core conftest.err conftest.$ac_objext \
- conftest$ac_exeext conftest.$ac_ext
- fi
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result:
$ac_cv_type_unsigned_long_long_int" >&5
-$as_echo "$ac_cv_type_unsigned_long_long_int" >&6; }
- if test $ac_cv_type_unsigned_long_long_int = yes; then
-
-$as_echo "#define HAVE_UNSIGNED_LONG_LONG_INT 1" >>confdefs.h
-
- fi
-
-
-
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking for long long int" >&5
-$as_echo_n "checking for long long int... " >&6; }
-if ${ac_cv_type_long_long_int+:} false; then :
- $as_echo_n "(cached) " >&6
-else
- ac_cv_type_long_long_int=yes
- if test "x${ac_cv_prog_cc_c99-no}" = xno; then
- ac_cv_type_long_long_int=$ac_cv_type_unsigned_long_long_int
- if test $ac_cv_type_long_long_int = yes; then
- if test "$cross_compiling" = yes; then :
- :
-else
- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h. */
-#include <limits.h>
- #ifndef LLONG_MAX
- # define HALF \
- (1LL << (sizeof (long long int) * CHAR_BIT - 2))
- # define LLONG_MAX (HALF - 1 + HALF)
- #endif
-int
-main ()
-{
-long long int n = 1;
- int i;
- for (i = 0; ; i++)
- {
- long long int m = n << i;
- if (m >> i != n)
- return 1;
- if (LLONG_MAX / 2 < m)
- break;
- }
- return 0;
- ;
- return 0;
-}
-_ACEOF
-if ac_fn_c_try_run "$LINENO"; then :
-
-else
- ac_cv_type_long_long_int=no
-fi
-rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
- conftest.$ac_objext conftest.beam conftest.$ac_ext
-fi
-
- fi
- fi
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_type_long_long_int" >&5
-$as_echo "$ac_cv_type_long_long_int" >&6; }
- if test $ac_cv_type_long_long_int = yes; then
-
-$as_echo "#define HAVE_LONG_LONG_INT 1" >>confdefs.h
-
- 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 2b9025cac3..ea83d921cb 100644
--- a/configure.in
+++ b/configure.in
@@ -1473,7 +1473,6 @@ PGAC_STRUCT_SOCKADDR_STORAGE_MEMBERS
PGAC_STRUCT_ADDRINFO
AC_TYPE_INTPTR_T
AC_TYPE_UINTPTR_T
-AC_TYPE_LONG_LONG_INT
PGAC_TYPE_LOCALE_T
diff --git a/src/include/c.h b/src/include/c.h
index d752cc07dc..16b428daa1 100644
--- a/src/include/c.h
+++ b/src/include/c.h
@@ -1203,7 +1203,6 @@ typedef union PGAlignedXLogBlock
extern int fdatasync(int fildes);
#endif
-#ifdef HAVE_LONG_LONG_INT
/* Older platforms may provide strto[u]ll functionality under other names */
#if !defined(HAVE_STRTOLL) && defined(HAVE___STRTOLL)
#define strtoll __strtoll
@@ -1232,7 +1231,6 @@ extern long long strtoll(const char *str, char **endptr,
int base);
#if defined(HAVE_STRTOULL) && !HAVE_DECL_STRTOULL
extern unsigned long long strtoull(const char *str, char **endptr, int base);
#endif
-#endif /* HAVE_LONG_LONG_INT */
#if !defined(HAVE_MEMMOVE) && !defined(memmove)
#define memmove(d, s, c) bcopy(s, d, c)
diff --git a/src/include/pg_config.h.in b/src/include/pg_config.h.in
index 939245db39..2bf506033d 100644
--- a/src/include/pg_config.h.in
+++ b/src/include/pg_config.h.in
@@ -383,9 +383,6 @@
/* Define to 1 if `long int' works and is 64 bits. */
#undef HAVE_LONG_INT_64
-/* Define to 1 if the system has the type `long long int'. */
-#undef HAVE_LONG_LONG_INT
-
/* Define to 1 if `long long int' works and is 64 bits. */
#undef HAVE_LONG_LONG_INT_64
@@ -684,9 +681,6 @@
/* Define to 1 if you have the `unsetenv' function. */
#undef HAVE_UNSETENV
-/* Define to 1 if the system has the type `unsigned long long int'. */
-#undef HAVE_UNSIGNED_LONG_LONG_INT
-
/* Define to 1 if you have the `uselocale' function. */
#undef HAVE_USELOCALE
diff --git a/src/include/pg_config.h.win32 b/src/include/pg_config.h.win32
index 36e6bdc303..6b67fb0630 100644
--- a/src/include/pg_config.h.win32
+++ b/src/include/pg_config.h.win32
@@ -267,9 +267,6 @@
/* Define to 1 if `long int' works and is 64 bits. */
/* #undef HAVE_LONG_INT_64 */
-/* Define to 1 if the system has the type `long long int'. */
-#define HAVE_LONG_LONG_INT 1
-
/* Define to 1 if `long long int' works and is 64 bits. */
#define HAVE_LONG_LONG_INT_64 1
diff --git a/src/interfaces/ecpg/ecpglib/data.c
b/src/interfaces/ecpg/ecpglib/data.c
index 7d2a78a60d..d3db5094cf 100644
--- a/src/interfaces/ecpg/ecpglib/data.c
+++ b/src/interfaces/ecpg/ecpglib/data.c
@@ -267,12 +267,10 @@ ecpg_get_data(const PGresult *results, int act_tuple, int
act_field, int lineno,
case ECPGt_unsigned_long:
*((long *) (ind + ind_offset * act_tuple)) =
value_for_indicator;
break;
-#ifdef HAVE_LONG_LONG_INT
case ECPGt_long_long:
case ECPGt_unsigned_long_long:
*((long long int *) (ind + ind_offset * act_tuple)) =
value_for_indicator;
break;
-#endif /* HAVE_LONG_LONG_INT */
case ECPGt_NO_INDICATOR:
if (value_for_indicator == -1)
{
@@ -355,12 +353,10 @@ ecpg_get_data(const PGresult *results, int act_tuple, int
act_field, int lineno,
case ECPGt_unsigned_long:
*((long *) (ind +
ind_offset * act_tuple)) = size;
break;
-#ifdef HAVE_LONG_LONG_INT
case ECPGt_long_long:
case ECPGt_unsigned_long_long:
*((long long int *)
(ind + ind_offset * act_tuple)) = size;
break;
-#endif /* HAVE_LONG_LONG_INT */
default:
break;
}
@@ -442,7 +438,6 @@ ecpg_get_data(const PGresult *results, int act_tuple, int
act_field, int lineno,
}
break;
-#ifdef HAVE_LONG_LONG_INT
#ifdef HAVE_STRTOLL
case ECPGt_long_long:
*((long long int *) (var + offset *
act_tuple)) = strtoll(pval, &scan_length, 10);
@@ -467,7 +462,6 @@ ecpg_get_data(const PGresult *results, int act_tuple, int
act_field, int lineno,
break;
#endif /* HAVE_STRTOULL */
-#endif /* HAVE_LONG_LONG_INT */
case ECPGt_float:
case ECPGt_double:
@@ -559,12 +553,10 @@ ecpg_get_data(const PGresult *results, int act_tuple, int
act_field, int lineno,
case
ECPGt_unsigned_long:
*((long
*) (ind + ind_offset * act_tuple)) = rcv_size;
break;
-#ifdef HAVE_LONG_LONG_INT
case
ECPGt_long_long:
case
ECPGt_unsigned_long_long:
*((long
long int *) (ind + ind_offset * act_tuple)) = rcv_size;
break;
-#endif /* HAVE_LONG_LONG_INT */
default:
break;
}
@@ -623,12 +615,10 @@ ecpg_get_data(const PGresult *results, int act_tuple, int
act_field, int lineno,
case ECPGt_unsigned_long:
*((long *) (ind + ind_offset * act_tuple)) = -1;
break;
-#ifdef HAVE_LONG_LONG_INT
case ECPGt_long_long:
case ECPGt_unsigned_long_long:
*((long long int *) (ind + ind_offset * act_tuple)) = -1;
break;
-#endif /* HAVE_LONG_LONG_INT */
default:
break;
}
@@ -678,12 +668,10 @@ ecpg_get_data(const PGresult *results, int act_tuple, int
act_field, int lineno,
case
ECPGt_unsigned_long:
*((long *) (ind + ind_offset * act_tuple)) = size;
break;
-#ifdef HAVE_LONG_LONG_INT
case
ECPGt_long_long:
case
ECPGt_unsigned_long_long:
*((long long int *) (ind + ind_offset * act_tuple)) = size;
break;
-#endif /* HAVE_LONG_LONG_INT */
default:
break;
}
@@ -723,12 +711,10 @@ ecpg_get_data(const PGresult *results, int act_tuple, int
act_field, int lineno,
case
ECPGt_unsigned_long:
*((long *) (ind + ind_offset * act_tuple)) = variable->len;
break;
-#ifdef HAVE_LONG_LONG_INT
case
ECPGt_long_long:
case
ECPGt_unsigned_long_long:
*((long long int *) (ind + ind_offset * act_tuple)) = variable->len;
break;
-#endif /* HAVE_LONG_LONG_INT */
default:
break;
}
diff --git a/src/interfaces/ecpg/ecpglib/descriptor.c
b/src/interfaces/ecpg/ecpglib/descriptor.c
index ead8778ca8..7bd0534ef7 100644
--- a/src/interfaces/ecpg/ecpglib/descriptor.c
+++ b/src/interfaces/ecpg/ecpglib/descriptor.c
@@ -134,14 +134,12 @@ get_int_item(int lineno, void *var, enum ECPGttype
vartype, int value)
case ECPGt_unsigned_long:
*(unsigned long *) var = (unsigned long) value;
break;
-#ifdef HAVE_LONG_LONG_INT
case ECPGt_long_long:
*(long long int *) var = (long long int) value;
break;
case ECPGt_unsigned_long_long:
*(unsigned long long int *) var = (unsigned long long
int) value;
break;
-#endif /* HAVE_LONG_LONG_INT */
case ECPGt_float:
*(float *) var = (float) value;
break;
@@ -179,14 +177,12 @@ set_int_item(int lineno, int *target, const void *var,
enum ECPGttype vartype)
case ECPGt_unsigned_long:
*target = *(const unsigned long *) var;
break;
-#ifdef HAVE_LONG_LONG_INT
case ECPGt_long_long:
*target = *(const long long int *) var;
break;
case ECPGt_unsigned_long_long:
*target = *(const unsigned long long int *) var;
break;
-#endif /* HAVE_LONG_LONG_INT */
case ECPGt_float:
*target = *(const float *) var;
break;
diff --git a/src/interfaces/ecpg/ecpglib/execute.c
b/src/interfaces/ecpg/ecpglib/execute.c
index 23cc86941c..e261cf9167 100644
--- a/src/interfaces/ecpg/ecpglib/execute.c
+++ b/src/interfaces/ecpg/ecpglib/execute.c
@@ -543,13 +543,11 @@ ecpg_store_input(const int lineno, const bool
force_indicator, const struct vari
if (*(long *) var->ind_value < 0L)
*tobeinserted_p = NULL;
break;
-#ifdef HAVE_LONG_LONG_INT
case ECPGt_long_long:
case ECPGt_unsigned_long_long:
if (*(long long int *) var->ind_value < (long long) 0)
*tobeinserted_p = NULL;
break;
-#endif /* HAVE_LONG_LONG_INT */
case ECPGt_NO_INDICATOR:
if (force_indicator == false)
{
@@ -681,7 +679,7 @@ ecpg_store_input(const int lineno, const bool
force_indicator, const struct vari
*tobeinserted_p = mallocedval;
break;
-#ifdef HAVE_LONG_LONG_INT
+
case ECPGt_long_long:
if (!(mallocedval = ecpg_alloc(asize * 30,
lineno)))
return false;
@@ -719,7 +717,7 @@ ecpg_store_input(const int lineno, const bool
force_indicator, const struct vari
*tobeinserted_p = mallocedval;
break;
-#endif /* HAVE_LONG_LONG_INT */
+
case ECPGt_float:
if (!(mallocedval = ecpg_alloc(asize * 25,
lineno)))
return false;
diff --git a/src/interfaces/ecpg/ecpglib/misc.c
b/src/interfaces/ecpg/ecpglib/misc.c
index 647da14fce..c4b2183b5d 100644
--- a/src/interfaces/ecpg/ecpglib/misc.c
+++ b/src/interfaces/ecpg/ecpglib/misc.c
@@ -18,7 +18,6 @@
#include "pg_config_paths.h"
#include "sqlca.h"
-#ifdef HAVE_LONG_LONG_INT
#ifndef LONG_LONG_MIN
#ifdef LLONG_MIN
#define LONG_LONG_MIN LLONG_MIN
@@ -26,7 +25,6 @@
#define LONG_LONG_MIN LONGLONG_MIN
#endif /* LLONG_MIN */
#endif /* LONG_LONG_MIN */
-#endif /* HAVE_LONG_LONG_INT */
bool ecpg_internal_regression_mode = false;
@@ -340,12 +338,10 @@ ECPGset_noind_null(enum ECPGttype type, void *ptr)
case ECPGt_date:
*((long *) ptr) = LONG_MIN;
break;
-#ifdef HAVE_LONG_LONG_INT
case ECPGt_long_long:
case ECPGt_unsigned_long_long:
*((long long *) ptr) = LONG_LONG_MIN;
break;
-#endif /* HAVE_LONG_LONG_INT */
case ECPGt_float:
memset((char *) ptr, 0xff, sizeof(float));
break;
@@ -415,13 +411,11 @@ ECPGis_noind_null(enum ECPGttype type, const void *ptr)
if (*((const long *) ptr) == LONG_MIN)
return true;
break;
-#ifdef HAVE_LONG_LONG_INT
case ECPGt_long_long:
case ECPGt_unsigned_long_long:
if (*((const long long *) ptr) == LONG_LONG_MIN)
return true;
break;
-#endif /* HAVE_LONG_LONG_INT */
case ECPGt_float:
return _check(ptr, sizeof(float));
break;
diff --git a/src/interfaces/ecpg/include/ecpg_config.h.in
b/src/interfaces/ecpg/include/ecpg_config.h.in
index 736fb08dba..c18556130e 100644
--- a/src/interfaces/ecpg/include/ecpg_config.h.in
+++ b/src/interfaces/ecpg/include/ecpg_config.h.in
@@ -5,7 +5,7 @@
#undef HAVE_LONG_INT_64
/* Define to 1 if the system has the type `long long int'. */
-#undef HAVE_LONG_LONG_INT
+#define HAVE_LONG_LONG_INT 1
/* Define to 1 if `long long int' works and is 64 bits. */
#undef HAVE_LONG_LONG_INT_64
diff --git a/src/interfaces/ecpg/preproc/ecpg.trailer
b/src/interfaces/ecpg/preproc/ecpg.trailer
index 1122f56a14..f58b41e675 100644
--- a/src/interfaces/ecpg/preproc/ecpg.trailer
+++ b/src/interfaces/ecpg/preproc/ecpg.trailer
@@ -796,22 +796,8 @@ unsigned_type: SQL_UNSIGNED SQL_SHORT { $$ =
ECPGt_unsigned_short; }
| SQL_UNSIGNED INT_P { $$ =
ECPGt_unsigned_int; }
| SQL_UNSIGNED SQL_LONG { $$ =
ECPGt_unsigned_long; }
| SQL_UNSIGNED SQL_LONG INT_P { $$ =
ECPGt_unsigned_long; }
- | SQL_UNSIGNED SQL_LONG SQL_LONG
- {
-#ifdef HAVE_LONG_LONG_INT
- $$ = ECPGt_unsigned_long_long;
-#else
- $$ = ECPGt_unsigned_long;
-#endif
- }
- | SQL_UNSIGNED SQL_LONG SQL_LONG INT_P
- {
-#ifdef HAVE_LONG_LONG_INT
- $$ = ECPGt_unsigned_long_long;
-#else
- $$ = ECPGt_unsigned_long;
-#endif
- }
+ | SQL_UNSIGNED SQL_LONG SQL_LONG { $$ =
ECPGt_unsigned_long_long; }
+ | SQL_UNSIGNED SQL_LONG SQL_LONG INT_P { $$ =
ECPGt_unsigned_long_long; }
| SQL_UNSIGNED CHAR_P { $$ =
ECPGt_unsigned_char; }
;
@@ -820,22 +806,8 @@ signed_type: SQL_SHORT { $$ =
ECPGt_short; }
| INT_P { $$ =
ECPGt_int; }
| SQL_LONG { $$ =
ECPGt_long; }
| SQL_LONG INT_P { $$ = ECPGt_long; }
- | SQL_LONG SQL_LONG
- {
-#ifdef HAVE_LONG_LONG_INT
- $$ = ECPGt_long_long;
-#else
- $$ = ECPGt_long;
-#endif
- }
- | SQL_LONG SQL_LONG INT_P
- {
-#ifdef HAVE_LONG_LONG_INT
- $$ = ECPGt_long_long;
-#else
- $$ = ECPGt_long;
-#endif
- }
+ | SQL_LONG SQL_LONG { $$ = ECPGt_long_long;
}
+ | SQL_LONG SQL_LONG INT_P { $$ = ECPGt_long_long; }
| SQL_BOOL { $$ =
ECPGt_bool; }
| CHAR_P { $$ =
ECPGt_char; }
| DOUBLE_P { $$ =
ECPGt_double; }
diff --git a/src/interfaces/ecpg/test/expected/sql-sqlda.c
b/src/interfaces/ecpg/test/expected/sql-sqlda.c
index dae047d007..d0d6d7c359 100644
--- a/src/interfaces/ecpg/test/expected/sql-sqlda.c
+++ b/src/interfaces/ecpg/test/expected/sql-sqlda.c
@@ -154,7 +154,6 @@ dump_sqlda(sqlda_t *sqlda)
case ECPGt_long:
printf("name sqlda descriptor: '%s' value %ld\n",
sqlda->sqlvar[i].sqlname.data, *(long int *)sqlda->sqlvar[i].sqldata);
break;
-#ifdef HAVE_LONG_LONG_INT
case ECPGt_long_long:
printf(
#ifdef _WIN32
@@ -164,7 +163,6 @@ dump_sqlda(sqlda_t *sqlda)
#endif
sqlda->sqlvar[i].sqlname.data, *(long long int
*)sqlda->sqlvar[i].sqldata);
break;
-#endif
case ECPGt_double:
printf("name sqlda descriptor: '%s' value %f\n",
sqlda->sqlvar[i].sqlname.data, *(double *)sqlda->sqlvar[i].sqldata);
break;
diff --git a/src/interfaces/ecpg/test/sql/sqlda.pgc
b/src/interfaces/ecpg/test/sql/sqlda.pgc
index 9a665511d0..e551385eaa 100644
--- a/src/interfaces/ecpg/test/sql/sqlda.pgc
+++ b/src/interfaces/ecpg/test/sql/sqlda.pgc
@@ -39,7 +39,6 @@ dump_sqlda(sqlda_t *sqlda)
case ECPGt_long:
printf("name sqlda descriptor: '%s' value %ld\n",
sqlda->sqlvar[i].sqlname.data, *(long int *)sqlda->sqlvar[i].sqldata);
break;
-#ifdef HAVE_LONG_LONG_INT
case ECPGt_long_long:
printf(
#ifdef _WIN32
@@ -49,7 +48,6 @@ dump_sqlda(sqlda_t *sqlda)
#endif
sqlda->sqlvar[i].sqlname.data, *(long long int
*)sqlda->sqlvar[i].sqldata);
break;
-#endif
case ECPGt_double:
printf("name sqlda descriptor: '%s' value %f\n",
sqlda->sqlvar[i].sqlname.data, *(double *)sqlda->sqlvar[i].sqldata);
break;
--
2.23.0