| From: | Khem Raj <raj(dot)khem(at)gmail(dot)com> |
|---|---|
| To: | pgpool-hackers(at)lists(dot)postgresql(dot)org |
| Cc: | Khem Raj <khem(dot)raj(at)oss(dot)qualcomm(dot)com> |
| Subject: | [PATCH] configure: Check the size of long and long long |
| Date: | 2026-10-21 15:31:04 |
| Message-ID: | 20261021153104.43840-1-khem.raj@oss.qualcomm.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgpool-hackers |
The replacement snprintf() in src/parser/snprintf.c handles the %z
length modifier by comparing SIZEOF_SIZE_T with SIZEOF_LONG and
SIZEOF_LONG_LONG, but configure only defines SIZEOF_UNSIGNED_LONG,
SIZEOF_VOID_P and SIZEOF_SIZE_T. The undefined macros evaluate to 0 in
the #if, so whenever the replacement snprintf() is built it fails with
snprintf.c:651:2: error: "cannot find integer type of the same size as size_t"
This happens e.g. when cross compiling for a 32-bit target such as
riscv32, where configure cannot run its long long snprintf format test
and falls back to the replacement implementation.
Check the size of long and long long so these are defined on every
target.
Signed-off-by: Khem Raj <khem(dot)raj(at)oss(dot)qualcomm(dot)com>
---
configure.ac | 5 +++++
1 file changed, 5 insertions(+)
--- a/configure.ac
+++ b/configure.ac
@@ -211,6 +211,11 @@
AC_CHECK_SIZEOF([void *])
AC_CHECK_SIZEOF([size_t])
+# The replacement snprintf() compares SIZEOF_SIZE_T against these to handle
+# the %z length modifier
+AC_CHECK_SIZEOF([long])
+AC_CHECK_SIZEOF([long long])
+
# Decide whether float4 is passed by value: user-selectable, enabled by default
AC_MSG_CHECKING([whether to build with float4 passed by value])
PGAC_ARG_BOOL(enable, float4-byval, yes, [disable float4 passed by value],
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Bo Peng | 2026-10-22 09:22:53 | Re: Segfault when a watchdog sync changes the primary under running children |
| Previous Message | Emond Papegaaij | 2026-10-19 10:46:29 | Segfault when a watchdog sync changes the primary under running children |