1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-30 11:03:19 +03:00

Remove configure's check for nonstandard "long long" printf modifiers.

We used to claim to support platforms using 'q' or 'I64' as the printf
length modifier for long long int, by dint of replacing snprintf with
our own code which uses the C99 standard 'll' modifier.  But that is
only adequate if we use INT64_MODIFIER only in snprintf-based calls,
not directly with the platform's native printf or fprintf.  Which
hasn't been the case for years.  We had not noticed, partially because
of inadequate test coverage, and partially because the buildfarm is
almost completely bare of machines that won't take 'll'.  The last
one seems to have been frogmouth, which was adjusted recently so that
it will take 'll'.  We might as well just give up on the pretense
that anything else works, and save ourselves some configure cycles.

Discussion: https://postgr.es/m/13103.1526749980@sss.pgh.pa.us
Discussion: https://postgr.es/m/24769.1526772680@sss.pgh.pa.us
This commit is contained in:
Tom Lane
2018-05-23 14:19:04 -04:00
parent 1d96c1b91a
commit b929614f5e
5 changed files with 24 additions and 178 deletions

View File

@ -171,61 +171,6 @@ AC_DEFUN([PGAC_STRUCT_ADDRINFO],
])])# PGAC_STRUCT_ADDRINFO
# PGAC_FUNC_SNPRINTF_LONG_LONG_INT_MODIFIER
# ---------------------------------------
# Determine which length modifier snprintf uses for long long int. We
# handle ll, q, and I64. The result is in shell variable
# LONG_LONG_INT_MODIFIER.
#
# MinGW uses '%I64d', though gcc throws a warning with -Wall,
# while '%lld' doesn't generate a warning, but doesn't work.
#
AC_DEFUN([PGAC_FUNC_SNPRINTF_LONG_LONG_INT_MODIFIER],
[AC_MSG_CHECKING([snprintf length modifier for long long int])
AC_CACHE_VAL(pgac_cv_snprintf_long_long_int_modifier,
[for pgac_modifier in 'll' 'q' 'I64'; do
AC_RUN_IFELSE([AC_LANG_SOURCE([[#include <stdio.h>
#include <string.h>
typedef long long int ac_int64;
#define INT64_FORMAT "%${pgac_modifier}d"
ac_int64 a = 20000001;
ac_int64 b = 40000005;
int does_int64_snprintf_work()
{
ac_int64 c;
char buf[100];
if (sizeof(ac_int64) != 8)
return 0; /* doesn't look like the right size */
c = a * b;
snprintf(buf, 100, INT64_FORMAT, c);
if (strcmp(buf, "800000140000005") != 0)
return 0; /* either multiply or snprintf is busted */
return 1;
}
int
main() {
return (! does_int64_snprintf_work());
}]])],
[pgac_cv_snprintf_long_long_int_modifier=$pgac_modifier; break],
[],
[pgac_cv_snprintf_long_long_int_modifier=cross; break])
done])dnl AC_CACHE_VAL
LONG_LONG_INT_MODIFIER=''
case $pgac_cv_snprintf_long_long_int_modifier in
cross) AC_MSG_RESULT([cannot test (not on host machine)]);;
?*) AC_MSG_RESULT([$pgac_cv_snprintf_long_long_int_modifier])
LONG_LONG_INT_MODIFIER=$pgac_cv_snprintf_long_long_int_modifier;;
*) AC_MSG_RESULT(none);;
esac])# PGAC_FUNC_SNPRINTF_LONG_LONG_INT_MODIFIER
# PGAC_FUNC_SNPRINTF_ARG_CONTROL
# ---------------------------------------
# Determine if snprintf supports %1$ argument selection, e.g. %5$ selects