public inbox for [email protected]
help / color / mirror / Atom feedFrom: Tatsuo Ishii <[email protected]>
To: [email protected]
Cc: [email protected]
Subject: Compiling issues for 32-bit targets
Date: Wed, 17 Sep 2025 19:47:36 +0900 (JST)
Message-ID: <[email protected]> (raw)
Gyorgy Sarvari <[email protected]> pointed out that snprintf.c has
issues when compiled on 32-bit targets:
https://github.com/pgpool/pgpool2/pull/128
> the compiler was complaining about undefined isnan and ininf functions in
> snprintf.c file
(Moreover he pointed out another issue. will discuss later on)
> When building for 32-bit arm arch, compilation fails with the following error:
> | snprintf.c: In function 'fmtfloat':
> | snprintf.c:1232:13: error: implicit declaration of function 'isnan' [-Wimplicit-function-declaration]
> | 1232 | if (isnan(value))
> | | ^~~~~
> | snprintf.c:50:1: note: include '<math.h>' or provide a declaration of 'isnan'
> | 49 | #include "postgresql/server/port.h"
> | +++ |+#include <math.h>
> | 50 |
> | snprintf.c:1254:21: error: implicit declaration of function 'isinf' [-Wimplicit-function-declaration]
> | 1254 | if (isinf(value))
> | | ^~~~~
> | snprintf.c:1254:21: note: include '<math.h>' or provide a declaration of 'isinf'
>
> To avoid the error, add math.h to snprintf.c.
I think his idea is good. snprintf.c was imported from PostgreSQL long
time ago. If we look into the original file (src/port/snprintf.c) it
actually has "#include <math.h>" already.
If there's no objection, I will push attached patch to all supported
branches. It not only adds math.h, but remove ancient ruin "#if 0" and
sort out the order of including files.
Best regards,
--
Tatsuo Ishii
SRA OSS K.K.
English: http://www.sraoss.co.jp/index_en/
Japanese:http://www.sraoss.co.jp
Attachments:
[text/x-patch] snprintf.patch (826B, 2-snprintf.patch)
download | inline diff:
diff --git a/src/parser/snprintf.c b/src/parser/snprintf.c
index c3564935e..ec0355205 100644
--- a/src/parser/snprintf.c
+++ b/src/parser/snprintf.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003-2024, PgPool Global Development Group
+ * Copyright (c) 2003-2025, PgPool Global Development Group
* Copyright (c) 1983, 1995, 1996 Eric P. Allman
* Copyright (c) 1988, 1993
* The Regents of the University of California. All rights reserved.
@@ -32,17 +32,14 @@
* src/port/snprintf.c
*/
-#if 0
-#include "c.h"
-#endif
-
+#include <ctype.h>
+#include <errno.h>
+#include <math.h>
#include <stdarg.h>
-#include <stdio.h>
#include <stdint.h>
+#include <stdio.h>
#include <stdlib.h>
#include <string.h>
-#include <ctype.h>
-#include <errno.h>
#include "pool_parser.h"
#include "stringinfo.h"
#include "utils/palloc.h"
reply
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: [email protected]
Cc: [email protected], [email protected], [email protected]
Subject: Re: Compiling issues for 32-bit targets
In-Reply-To: <[email protected]>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox