pgsql: Arrange to supply declarations for strtoll/strtoull if needed.

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Arrange to supply declarations for strtoll/strtoull if needed.
Date: 2018-05-19 02:42:35
Message-ID: E1fJrpL-00007L-AI@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Arrange to supply declarations for strtoll/strtoull if needed.

Buildfarm member dromedary is still unhappy about the recently-added
ecpg "long long" tests. The reason turns out to be that it includes
"-ansi" in its CFLAGS, and in their infinite wisdom Apple have decided
to hide the declarations of strtoll/strtoull in C89-compliant builds.
(I find it pretty curious that they hide those function declarations
when you can nonetheless declare a "long long" variable, but anyway
that is their behavior, both on dromedary's obsolete macOS version and
the newest and shiniest.) As a result, gcc assumes these functions
return "int", leading naturally to wrong results.

(Looking at dromedary's past build results, it's evident that this
problem also breaks pg_strtouint64() on 32-bit platforms; but we
evidently have no regression tests that exercise that function with
values above 32 bits.)

To fix, supply declarations for these functions when the platform
provides the functions but not the declarations, using the same type
of mechanism as we use for some other similar cases.

Discussion: https://postgr.es/m/151935568942.1461.14623890240535309745@wrigleys.postgresql.org

Branch
------
REL9_6_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/4ffd7909c63a54960c90dc3332b591d075c48e46

Modified Files
--------------
configure | 22 ++++++++++++++++++++++
configure.in | 2 ++
src/include/c.h | 8 ++++++++
src/include/pg_config.h.in | 8 ++++++++
src/include/pg_config.h.win32 | 8 ++++++++
5 files changed, 48 insertions(+)

Browse pgsql-committers by date

  From Date Subject
Next Message Tom Lane 2018-05-19 18:22:39 pgsql: Support platforms where strtoll/strtoull are spelled __strtoll/_
Previous Message Stephen Frost 2018-05-19 01:20:47 pgsql: Fix for globals.c- c.h must come first