Re: git: cd0727ec709b - main - libc: Add <stdio.h> C23 feature test macro

Dimitry Andric <[email protected]>
Newsgroups gmane.os.freebsd.devel.cvs.src,gmane.os.freebsd.current.scm
Message-ID <[email protected]>
On 14 Aug 2026, at 21:32, Faraz Vahedi <[email protected]> wrote:
> 
> The branch main has been updated by kfv:
> 
> URL: https://cgit.FreeBSD.org/src/commit/?id=cd0727ec709bb54f8f82104f6113284a15dd3464
> 
> commit cd0727ec709bb54f8f82104f6113284a15dd3464
> Author:     Faraz Vahedi <[email protected]>
> AuthorDate: 2026-08-14 12:22:00 +0000
> Commit:     Faraz Vahedi <[email protected]>
> 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?

-Dimitry
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.