diff options
| author | Dimitry Andric <dim@FreeBSD.org> | 2026-08-15 17:53:23 +0000 |
|---|---|---|
| committer | Dimitry Andric <dim@FreeBSD.org> | 2026-08-17 19:40:28 +0000 |
| commit | 011dee72e13fdbd949787c88505fcb62cd52e4d3 (patch) | |
| tree | aa73a8f2e0a1be61c8239fe40aaf2b7cc1570f83 | |
| parent | c120cf821806fe366c3e9dc5a45637918359150e (diff) | |
math/gmp: fix build after base cd0727ec709b
After base cd0727ec709bb54f8f82104f6113284a15dd3464 ("libc: Add
<stdio.h> C23 feature test macro"), math/gmp fails to build with errors
similar to:
inp_str.c:63:10: warning: call to undeclared function '__gmpz_inp_str_nowhite'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
63 | return mpz_inp_str_nowhite (x, stream, base, c, nread);
| ^
../gmp-impl.h:1782:29: note: expanded from macro 'mpz_inp_str_nowhite'
1782 | #define mpz_inp_str_nowhite __gmpz_inp_str_nowhite
| ^
inp_str.c:68:1: error: conflicting types for '__gmpz_inp_str_nowhite'
68 | mpz_inp_str_nowhite (mpz_ptr x, FILE *stream, int base, int c, size_t nread)
| ^
../gmp-impl.h:1782:29: note: expanded from macro 'mpz_inp_str_nowhite'
1782 | #define mpz_inp_str_nowhite __gmpz_inp_str_nowhite
| ^
inp_str.c:63:10: note: previous implicit declaration is here
63 | return mpz_inp_str_nowhite (x, stream, base, c, nread);
| ^
../gmp-impl.h:1782:29: note: expanded from macro 'mpz_inp_str_nowhite'
1782 | #define mpz_inp_str_nowhite __gmpz_inp_str_nowhite
| ^
1 warning and 1 error generated.
This is because mpz_inp_str_nowhite() is only declared with the right
prototype, if _GMP_H_HAVE_FILE is defined. In turn, _GMP_H_HAVE_FILE is
defined only if _STDIO_H_ is defined, as it used to be in our stdio.h.
Since base cd0727ec709bb54f8f82104f6113284a15dd3464 removed the
_STDIO_H_ macro, and replaced it with __STDC_VERSION_STDIO_H__ for C23
support, add it to the list of checks in gmp-h.in, and mini-gmp.h.
Approved by: portmgr (build fix blanket)
PR: 297562
MFH: 2026Q3
(cherry picked from commit 03ce372d3e188c27fe745c974c23dfe42695782d)
| -rw-r--r-- | math/gmp/files/patch-gmp-h.in | 12 | ||||
| -rw-r--r-- | math/gmp/files/patch-mini-gmp_mini-gmp.h | 12 |
2 files changed, 24 insertions, 0 deletions
diff --git a/math/gmp/files/patch-gmp-h.in b/math/gmp/files/patch-gmp-h.in new file mode 100644 index 000000000000..a6f34de00548 --- /dev/null +++ b/math/gmp/files/patch-gmp-h.in @@ -0,0 +1,12 @@ +--- gmp-h.in.orig 2023-07-29 13:42:16 UTC ++++ gmp-h.in +@@ -268,7 +268,8 @@ typedef const __gmp_randstate_struct *gmp_randstate_sr + || defined (_ISO_STDIO_ISO_H) /* Sun C++ */ \ + || defined (__STDIO_LOADED) /* VMS */ \ + || defined (_STDIO) /* HPE NonStop */ \ +- || defined (__DEFINED_FILE) /* musl */ ++ || defined (__DEFINED_FILE) /* musl */ \ ++ || defined (__STDC_VERSION_STDIO_H__) /* C23 */ + #define _GMP_H_HAVE_FILE 1 + #endif + diff --git a/math/gmp/files/patch-mini-gmp_mini-gmp.h b/math/gmp/files/patch-mini-gmp_mini-gmp.h new file mode 100644 index 000000000000..cfd417f4ba4c --- /dev/null +++ b/math/gmp/files/patch-mini-gmp_mini-gmp.h @@ -0,0 +1,12 @@ +--- mini-gmp/mini-gmp.h.orig 2023-07-29 13:42:16 UTC ++++ mini-gmp/mini-gmp.h +@@ -297,7 +297,8 @@ int mpz_init_set_str (mpz_t, const char *, int); + || defined (_ISO_STDIO_ISO_H) /* Sun C++ */ \ + || defined (__STDIO_LOADED) /* VMS */ \ + || defined (_STDIO) /* HPE NonStop */ \ +- || defined (__DEFINED_FILE) /* musl */ ++ || defined (__DEFINED_FILE) /* musl */ \ ++ || defined (__STDC_VERSION_STDIO_H__) /* C23 */ + size_t mpz_out_str (FILE *, int, const mpz_t); + #endif + |
