Skip to content

Commit effa402

Browse files
committed
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 with ecpg-using user code. Discussion: https://www.postgresql.org/message-id/flat/5cdd6a2b-b2c7-c6f6-344c-a406d5c1a254%402ndquadrant.com
1 parent 581a558 commit effa402

File tree

14 files changed

+296
-483
lines changed

14 files changed

+296
-483
lines changed

configure

Lines changed: 0 additions & 117 deletions
Original file line numberDiff line numberDiff line change
@@ -14170,123 +14170,6 @@ fi
1417014170

1417114171

1417214172

14173-
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for unsigned long long int" >&5
14174-
$as_echo_n "checking for unsigned long long int... " >&6; }
14175-
if ${ac_cv_type_unsigned_long_long_int+:} false; then :
14176-
$as_echo_n "(cached) " >&6
14177-
else
14178-
ac_cv_type_unsigned_long_long_int=yes
14179-
if test "x${ac_cv_prog_cc_c99-no}" = xno; then
14180-
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
14181-
/* end confdefs.h. */
14182-
14183-
/* For now, do not test the preprocessor; as of 2007 there are too many
14184-
implementations with broken preprocessors. Perhaps this can
14185-
be revisited in 2012. In the meantime, code should not expect
14186-
#if to work with literals wider than 32 bits. */
14187-
/* Test literals. */
14188-
long long int ll = 9223372036854775807ll;
14189-
long long int nll = -9223372036854775807LL;
14190-
unsigned long long int ull = 18446744073709551615ULL;
14191-
/* Test constant expressions. */
14192-
typedef int a[((-9223372036854775807LL < 0 && 0 < 9223372036854775807ll)
14193-
? 1 : -1)];
14194-
typedef int b[(18446744073709551615ULL <= (unsigned long long int) -1
14195-
? 1 : -1)];
14196-
int i = 63;
14197-
int
14198-
main ()
14199-
{
14200-
/* Test availability of runtime routines for shift and division. */
14201-
long long int llmax = 9223372036854775807ll;
14202-
unsigned long long int ullmax = 18446744073709551615ull;
14203-
return ((ll << 63) | (ll >> 63) | (ll < i) | (ll > i)
14204-
| (llmax / ll) | (llmax % ll)
14205-
| (ull << 63) | (ull >> 63) | (ull << i) | (ull >> i)
14206-
| (ullmax / ull) | (ullmax % ull));
14207-
;
14208-
return 0;
14209-
}
14210-
14211-
_ACEOF
14212-
if ac_fn_c_try_link "$LINENO"; then :
14213-
14214-
else
14215-
ac_cv_type_unsigned_long_long_int=no
14216-
fi
14217-
rm -f core conftest.err conftest.$ac_objext \
14218-
conftest$ac_exeext conftest.$ac_ext
14219-
fi
14220-
fi
14221-
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_type_unsigned_long_long_int" >&5
14222-
$as_echo "$ac_cv_type_unsigned_long_long_int" >&6; }
14223-
if test $ac_cv_type_unsigned_long_long_int = yes; then
14224-
14225-
$as_echo "#define HAVE_UNSIGNED_LONG_LONG_INT 1" >>confdefs.h
14226-
14227-
fi
14228-
14229-
14230-
14231-
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for long long int" >&5
14232-
$as_echo_n "checking for long long int... " >&6; }
14233-
if ${ac_cv_type_long_long_int+:} false; then :
14234-
$as_echo_n "(cached) " >&6
14235-
else
14236-
ac_cv_type_long_long_int=yes
14237-
if test "x${ac_cv_prog_cc_c99-no}" = xno; then
14238-
ac_cv_type_long_long_int=$ac_cv_type_unsigned_long_long_int
14239-
if test $ac_cv_type_long_long_int = yes; then
14240-
if test "$cross_compiling" = yes; then :
14241-
:
14242-
else
14243-
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
14244-
/* end confdefs.h. */
14245-
#include <limits.h>
14246-
#ifndef LLONG_MAX
14247-
# define HALF \
14248-
(1LL << (sizeof (long long int) * CHAR_BIT - 2))
14249-
# define LLONG_MAX (HALF - 1 + HALF)
14250-
#endif
14251-
int
14252-
main ()
14253-
{
14254-
long long int n = 1;
14255-
int i;
14256-
for (i = 0; ; i++)
14257-
{
14258-
long long int m = n << i;
14259-
if (m >> i != n)
14260-
return 1;
14261-
if (LLONG_MAX / 2 < m)
14262-
break;
14263-
}
14264-
return 0;
14265-
;
14266-
return 0;
14267-
}
14268-
_ACEOF
14269-
if ac_fn_c_try_run "$LINENO"; then :
14270-
14271-
else
14272-
ac_cv_type_long_long_int=no
14273-
fi
14274-
rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
14275-
conftest.$ac_objext conftest.beam conftest.$ac_ext
14276-
fi
14277-
14278-
fi
14279-
fi
14280-
fi
14281-
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_type_long_long_int" >&5
14282-
$as_echo "$ac_cv_type_long_long_int" >&6; }
14283-
if test $ac_cv_type_long_long_int = yes; then
14284-
14285-
$as_echo "#define HAVE_LONG_LONG_INT 1" >>confdefs.h
14286-
14287-
fi
14288-
14289-
1429014173
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for locale_t" >&5
1429114174
$as_echo_n "checking for locale_t... " >&6; }
1429214175
if ${pgac_cv_type_locale_t+:} false; then :

configure.in

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1473,7 +1473,6 @@ PGAC_STRUCT_SOCKADDR_STORAGE_MEMBERS
14731473
PGAC_STRUCT_ADDRINFO
14741474
AC_TYPE_INTPTR_T
14751475
AC_TYPE_UINTPTR_T
1476-
AC_TYPE_LONG_LONG_INT
14771476

14781477
PGAC_TYPE_LOCALE_T
14791478

src/include/c.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1203,7 +1203,6 @@ typedef union PGAlignedXLogBlock
12031203
extern int fdatasync(int fildes);
12041204
#endif
12051205

1206-
#ifdef HAVE_LONG_LONG_INT
12071206
/* Older platforms may provide strto[u]ll functionality under other names */
12081207
#if !defined(HAVE_STRTOLL) && defined(HAVE___STRTOLL)
12091208
#define strtoll __strtoll
@@ -1232,7 +1231,6 @@ extern long long strtoll(const char *str, char **endptr, int base);
12321231
#if defined(HAVE_STRTOULL) && !HAVE_DECL_STRTOULL
12331232
extern unsigned long long strtoull(const char *str, char **endptr, int base);
12341233
#endif
1235-
#endif /* HAVE_LONG_LONG_INT */
12361234

12371235
#if !defined(HAVE_MEMMOVE) && !defined(memmove)
12381236
#define memmove(d, s, c) bcopy(s, d, c)

src/include/pg_config.h.in

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -383,9 +383,6 @@
383383
/* Define to 1 if `long int' works and is 64 bits. */
384384
#undef HAVE_LONG_INT_64
385385

386-
/* Define to 1 if the system has the type `long long int'. */
387-
#undef HAVE_LONG_LONG_INT
388-
389386
/* Define to 1 if `long long int' works and is 64 bits. */
390387
#undef HAVE_LONG_LONG_INT_64
391388

@@ -684,9 +681,6 @@
684681
/* Define to 1 if you have the `unsetenv' function. */
685682
#undef HAVE_UNSETENV
686683

687-
/* Define to 1 if the system has the type `unsigned long long int'. */
688-
#undef HAVE_UNSIGNED_LONG_LONG_INT
689-
690684
/* Define to 1 if you have the `uselocale' function. */
691685
#undef HAVE_USELOCALE
692686

src/include/pg_config.h.win32

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -267,9 +267,6 @@
267267
/* Define to 1 if `long int' works and is 64 bits. */
268268
/* #undef HAVE_LONG_INT_64 */
269269

270-
/* Define to 1 if the system has the type `long long int'. */
271-
#define HAVE_LONG_LONG_INT 1
272-
273270
/* Define to 1 if `long long int' works and is 64 bits. */
274271
#define HAVE_LONG_LONG_INT_64 1
275272

src/interfaces/ecpg/ecpglib/data.c

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -267,12 +267,10 @@ ecpg_get_data(const PGresult *results, int act_tuple, int act_field, int lineno,
267267
case ECPGt_unsigned_long:
268268
*((long *) (ind + ind_offset * act_tuple)) = value_for_indicator;
269269
break;
270-
#ifdef HAVE_LONG_LONG_INT
271270
case ECPGt_long_long:
272271
case ECPGt_unsigned_long_long:
273272
*((long long int *) (ind + ind_offset * act_tuple)) = value_for_indicator;
274273
break;
275-
#endif /* HAVE_LONG_LONG_INT */
276274
case ECPGt_NO_INDICATOR:
277275
if (value_for_indicator == -1)
278276
{
@@ -355,12 +353,10 @@ ecpg_get_data(const PGresult *results, int act_tuple, int act_field, int lineno,
355353
case ECPGt_unsigned_long:
356354
*((long *) (ind + ind_offset * act_tuple)) = size;
357355
break;
358-
#ifdef HAVE_LONG_LONG_INT
359356
case ECPGt_long_long:
360357
case ECPGt_unsigned_long_long:
361358
*((long long int *) (ind + ind_offset * act_tuple)) = size;
362359
break;
363-
#endif /* HAVE_LONG_LONG_INT */
364360
default:
365361
break;
366362
}
@@ -442,7 +438,6 @@ ecpg_get_data(const PGresult *results, int act_tuple, int act_field, int lineno,
442438
}
443439
break;
444440

445-
#ifdef HAVE_LONG_LONG_INT
446441
#ifdef HAVE_STRTOLL
447442
case ECPGt_long_long:
448443
*((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,
467462

468463
break;
469464
#endif /* HAVE_STRTOULL */
470-
#endif /* HAVE_LONG_LONG_INT */
471465

472466
case ECPGt_float:
473467
case ECPGt_double:
@@ -559,12 +553,10 @@ ecpg_get_data(const PGresult *results, int act_tuple, int act_field, int lineno,
559553
case ECPGt_unsigned_long:
560554
*((long *) (ind + ind_offset * act_tuple)) = rcv_size;
561555
break;
562-
#ifdef HAVE_LONG_LONG_INT
563556
case ECPGt_long_long:
564557
case ECPGt_unsigned_long_long:
565558
*((long long int *) (ind + ind_offset * act_tuple)) = rcv_size;
566559
break;
567-
#endif /* HAVE_LONG_LONG_INT */
568560
default:
569561
break;
570562
}
@@ -623,12 +615,10 @@ ecpg_get_data(const PGresult *results, int act_tuple, int act_field, int lineno,
623615
case ECPGt_unsigned_long:
624616
*((long *) (ind + ind_offset * act_tuple)) = -1;
625617
break;
626-
#ifdef HAVE_LONG_LONG_INT
627618
case ECPGt_long_long:
628619
case ECPGt_unsigned_long_long:
629620
*((long long int *) (ind + ind_offset * act_tuple)) = -1;
630621
break;
631-
#endif /* HAVE_LONG_LONG_INT */
632622
default:
633623
break;
634624
}
@@ -678,12 +668,10 @@ ecpg_get_data(const PGresult *results, int act_tuple, int act_field, int lineno,
678668
case ECPGt_unsigned_long:
679669
*((long *) (ind + ind_offset * act_tuple)) = size;
680670
break;
681-
#ifdef HAVE_LONG_LONG_INT
682671
case ECPGt_long_long:
683672
case ECPGt_unsigned_long_long:
684673
*((long long int *) (ind + ind_offset * act_tuple)) = size;
685674
break;
686-
#endif /* HAVE_LONG_LONG_INT */
687675
default:
688676
break;
689677
}
@@ -723,12 +711,10 @@ ecpg_get_data(const PGresult *results, int act_tuple, int act_field, int lineno,
723711
case ECPGt_unsigned_long:
724712
*((long *) (ind + ind_offset * act_tuple)) = variable->len;
725713
break;
726-
#ifdef HAVE_LONG_LONG_INT
727714
case ECPGt_long_long:
728715
case ECPGt_unsigned_long_long:
729716
*((long long int *) (ind + ind_offset * act_tuple)) = variable->len;
730717
break;
731-
#endif /* HAVE_LONG_LONG_INT */
732718
default:
733719
break;
734720
}

src/interfaces/ecpg/ecpglib/descriptor.c

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -134,14 +134,12 @@ get_int_item(int lineno, void *var, enum ECPGttype vartype, int value)
134134
case ECPGt_unsigned_long:
135135
*(unsigned long *) var = (unsigned long) value;
136136
break;
137-
#ifdef HAVE_LONG_LONG_INT
138137
case ECPGt_long_long:
139138
*(long long int *) var = (long long int) value;
140139
break;
141140
case ECPGt_unsigned_long_long:
142141
*(unsigned long long int *) var = (unsigned long long int) value;
143142
break;
144-
#endif /* HAVE_LONG_LONG_INT */
145143
case ECPGt_float:
146144
*(float *) var = (float) value;
147145
break;
@@ -179,14 +177,12 @@ set_int_item(int lineno, int *target, const void *var, enum ECPGttype vartype)
179177
case ECPGt_unsigned_long:
180178
*target = *(const unsigned long *) var;
181179
break;
182-
#ifdef HAVE_LONG_LONG_INT
183180
case ECPGt_long_long:
184181
*target = *(const long long int *) var;
185182
break;
186183
case ECPGt_unsigned_long_long:
187184
*target = *(const unsigned long long int *) var;
188185
break;
189-
#endif /* HAVE_LONG_LONG_INT */
190186
case ECPGt_float:
191187
*target = *(const float *) var;
192188
break;

src/interfaces/ecpg/ecpglib/execute.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -543,13 +543,11 @@ ecpg_store_input(const int lineno, const bool force_indicator, const struct vari
543543
if (*(long *) var->ind_value < 0L)
544544
*tobeinserted_p = NULL;
545545
break;
546-
#ifdef HAVE_LONG_LONG_INT
547546
case ECPGt_long_long:
548547
case ECPGt_unsigned_long_long:
549548
if (*(long long int *) var->ind_value < (long long) 0)
550549
*tobeinserted_p = NULL;
551550
break;
552-
#endif /* HAVE_LONG_LONG_INT */
553551
case ECPGt_NO_INDICATOR:
554552
if (force_indicator == false)
555553
{
@@ -681,7 +679,7 @@ ecpg_store_input(const int lineno, const bool force_indicator, const struct vari
681679

682680
*tobeinserted_p = mallocedval;
683681
break;
684-
#ifdef HAVE_LONG_LONG_INT
682+
685683
case ECPGt_long_long:
686684
if (!(mallocedval = ecpg_alloc(asize * 30, lineno)))
687685
return false;
@@ -719,7 +717,7 @@ ecpg_store_input(const int lineno, const bool force_indicator, const struct vari
719717

720718
*tobeinserted_p = mallocedval;
721719
break;
722-
#endif /* HAVE_LONG_LONG_INT */
720+
723721
case ECPGt_float:
724722
if (!(mallocedval = ecpg_alloc(asize * 25, lineno)))
725723
return false;

src/interfaces/ecpg/ecpglib/misc.c

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,15 +18,13 @@
1818
#include "pg_config_paths.h"
1919
#include "sqlca.h"
2020

21-
#ifdef HAVE_LONG_LONG_INT
2221
#ifndef LONG_LONG_MIN
2322
#ifdef LLONG_MIN
2423
#define LONG_LONG_MIN LLONG_MIN
2524
#else
2625
#define LONG_LONG_MIN LONGLONG_MIN
2726
#endif /* LLONG_MIN */
2827
#endif /* LONG_LONG_MIN */
29-
#endif /* HAVE_LONG_LONG_INT */
3028

3129
bool ecpg_internal_regression_mode = false;
3230

@@ -340,12 +338,10 @@ ECPGset_noind_null(enum ECPGttype type, void *ptr)
340338
case ECPGt_date:
341339
*((long *) ptr) = LONG_MIN;
342340
break;
343-
#ifdef HAVE_LONG_LONG_INT
344341
case ECPGt_long_long:
345342
case ECPGt_unsigned_long_long:
346343
*((long long *) ptr) = LONG_LONG_MIN;
347344
break;
348-
#endif /* HAVE_LONG_LONG_INT */
349345
case ECPGt_float:
350346
memset((char *) ptr, 0xff, sizeof(float));
351347
break;
@@ -415,13 +411,11 @@ ECPGis_noind_null(enum ECPGttype type, const void *ptr)
415411
if (*((const long *) ptr) == LONG_MIN)
416412
return true;
417413
break;
418-
#ifdef HAVE_LONG_LONG_INT
419414
case ECPGt_long_long:
420415
case ECPGt_unsigned_long_long:
421416
if (*((const long long *) ptr) == LONG_LONG_MIN)
422417
return true;
423418
break;
424-
#endif /* HAVE_LONG_LONG_INT */
425419
case ECPGt_float:
426420
return _check(ptr, sizeof(float));
427421
break;

src/interfaces/ecpg/include/ecpg_config.h.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
#undef HAVE_LONG_INT_64
66

77
/* Define to 1 if the system has the type `long long int'. */
8-
#undef HAVE_LONG_LONG_INT
8+
#define HAVE_LONG_LONG_INT 1
99

1010
/* Define to 1 if `long long int' works and is 64 bits. */
1111
#undef HAVE_LONG_LONG_INT_64

0 commit comments

Comments
 (0)