Re: git: cd0727ec709b - main - libc: Add <stdio.h> C23 feature test macro
- In reply to: Dimitry Andric : "Re: git: cd0727ec709b - main - libc: Add <stdio.h> C23 feature test macro"
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Sat, 15 Aug 2026 17:30:29 UTC
> On 15 Aug 2026, at 19:23, Dimitry Andric <dim@FreeBSD.org> wrote: > > On 14 Aug 2026, at 21:32, Faraz Vahedi <kfv@FreeBSD.org> wrote: >> >> The branch main has been updated by kfv: >> >> URL: https://cgit.FreeBSD.org/src/commit/?id=cd0727ec709bb54f8f82104f6113284a15dd3464 >> >> commit cd0727ec709bb54f8f82104f6113284a15dd3464 >> Author: Faraz Vahedi <kfv@FreeBSD.org> >> AuthorDate: 2026-08-14 12:22:00 +0000 >> Commit: Faraz Vahedi <kfv@FreeBSD.org> >> CommitDate: 2026-08-14 19:31:54 +0000 >> >> libc: Add <stdio.h> C23 feature test macro >> >> Define the __STDC_VERSION_STDIO_H__ feature test macro now that >> the header fully conforms to C23. >> >> Reviewed by: fuz >> Approved by: fuz (mentor) >> MFC after: 1 month >> Differential Revision: https://reviews.freebsd.org/D58842 > ... >> diff --git a/include/stdio.h b/include/stdio.h >> index ea016d65095d..50e3ff2d1c34 100644 >> --- a/include/stdio.h >> +++ b/include/stdio.h >> @@ -32,8 +32,8 @@ >> * SUCH DAMAGE. >> */ >> >> -#ifndef _STDIO_H_ >> -#define _STDIO_H_ >> +#ifndef __STDC_VERSION_STDIO_H__ >> +#define __STDC_VERSION_STDIO_H__ 202311L >> >> #include <sys/cdefs.h> >> #include <sys/_null.h> > > This particular change appears to have broken the math/gmp port, which > hasn't functionally changed since 2023. > > It has this construct to detect the existence of FILE: > > /* For reference, "defined(EOF)" cannot be used here. In g++ 2.95.4, > <iostream> defines EOF but not FILE. */ > #if defined (FILE) \ > || defined (H_STDIO) \ > || defined (_H_STDIO) /* AIX */ \ > || defined (_STDIO_H) /* glibc, Sun, SCO */ \ > || defined (_STDIO_H_) /* BSD, OSF */ \ > || defined (__STDIO_H) /* Borland */ \ > || defined (__STDIO_H__) /* IRIX */ \ > || defined (_STDIO_INCLUDED) /* HPUX */ \ > || defined (__dj_include_stdio_h_) /* DJGPP */ \ > || defined (_FILE_DEFINED) /* Microsoft */ \ > || defined (__STDIO__) /* Apple MPW MrC */ \ > || defined (_MSL_STDIO_H) /* Metrowerks */ \ > || defined (_STDIO_H_INCLUDED) /* QNX4 */ \ > || defined (_ISO_STDIO_ISO_H) /* Sun C++ */ \ > || defined (__STDIO_LOADED) /* VMS */ \ > || defined (_STDIO) /* HPE NonStop */ \ > || defined (__DEFINED_FILE) /* musl */ > #define _GMP_H_HAVE_FILE 1 > #endif > > Now that _STDIO_H_ has been removed, the detection fails and another > part of the port falls over due to an incorrect prototype. > > I guess we could patch the math/gmp port with another > __STDC_VERSION_STDIO_H__ macro, but it might be good to do an exp-run to > see if there are more GNU projects which rely on the existence of the > _STDIO_H_ macro? FWIW, I would prefer something like this: diff --git a/include/stdio.h b/include/stdio.h index 50e3ff2d1c34..07ed71035e84 100644 --- a/include/stdio.h +++ b/include/stdio.h @@ -32,8 +32,12 @@ * SUCH DAMAGE. */ +#ifndef _STDIO_H_ +#define _STDIO_H_ + #ifndef __STDC_VERSION_STDIO_H__ #define __STDC_VERSION_STDIO_H__ 202311L +#endif #include <sys/cdefs.h> #include <sys/_null.h> @@ -540,4 +544,4 @@ extern int __isthreaded; __END_DECLS __NULLABILITY_PRAGMA_POP -#endif /* !__STDC_VERSION_STDIO_H__ */ +#endif /* !_STDIO_H_ */ -Dimitry