pgsql: Use <stdint.h> and <inttypes.h> for c.h integers.

From: Thomas Munro <tmunro(at)postgresql(dot)org>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Use <stdint.h> and <inttypes.h> for c.h integers.
Date: 2024-12-04 02:21:25
Message-ID: E1tIf12-000zux-Pw@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Use <stdint.h> and <inttypes.h> for c.h integers.

Redefine our exact width types with standard C99 types and macros,
including int64_t, INT64_MAX, INT64_C(), PRId64 etc. We were already
using <stdint.h> types in a few places.

One complication is that Windows' <inttypes.h> uses format strings like
"%I64d", "%I32", "%I" for PRI*64, PRI*32, PTR*PTR, instead of mapping to
other standardized format strings like "%lld" etc as seen on other known
systems. Teach our snprintf.c to understand them.

This removes a lot of configure clutter, and should also allow 64-bit
numbers and other standard types to be used in localized messages
without casting.

Reviewed-by: Peter Eisentraut <peter(at)eisentraut(dot)org>
Discussion: https://postgr.es/m/ME3P282MB3166F9D1F71F787929C0C7E7B6312%40ME3P282MB3166.AUSP282.PROD.OUTLOOK.COM

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/962da900ac8f0927f1af2fd811ca67fa163c873a

Modified Files
--------------
config/c-compiler.m4 | 78 +----
configure | 354 ++++++---------------
configure.ac | 52 +--
meson.build | 41 +--
src/Makefile.global.in | 6 -
src/bin/pg_waldump/pg_waldump.c | 16 +-
src/bin/pgbench/pgbench.c | 4 +-
src/include/.gitignore | 2 -
src/include/Makefile | 8 +-
src/include/c.h | 101 +++---
src/include/meson.build | 12 +-
src/include/pg_config.h.in | 25 +-
src/include/pg_config_ext.h.in | 7 -
src/include/pg_config_ext.h.meson | 7 -
src/include/port/pg_bitutils.h | 16 +-
src/include/postgres_ext.h | 4 +-
src/include/utils/dsa.h | 2 +-
src/interfaces/ecpg/ecpglib/typename.c | 9 +-
src/interfaces/ecpg/include/ecpg_config.h.in | 8 +-
src/interfaces/ecpg/include/meson.build | 4 +-
src/interfaces/ecpg/include/pgtypes_interval.h | 12 +-
src/interfaces/ecpg/include/sqltypes.h | 8 +-
.../ecpg/test/expected/compat_informix-sqlda.c | 8 +-
src/port/pg_bitutils.c | 6 +-
src/port/snprintf.c | 64 +++-
25 files changed, 272 insertions(+), 582 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Bruce Momjian 2024-12-04 03:31:35 pgsql: Properly use $(AWK) in Makefile, not 'awk'
Previous Message Tom Lane 2024-12-04 01:21:41 pgsql: Define __EXTENSIONS__ on Solaris, too.