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

Faraz Vahedi <[email protected]>
Newsgroups gmane.os.freebsd.devel.cvs.src
Message-ID <6a7f6d6a.372ae.3079abac__13039.5827045263$1786736003$gmane$org@gitrepo.freebsd.org>
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
---
 include/rpc/xdr.h                    | 2 +-
 include/stdio.h                      | 6 +++---
 include/xlocale.h                    | 2 +-
 lib/libc/xdr/xdr.3                   | 2 +-
 lib/libgeom/libgeom.h                | 2 +-
 lib/libutil/libutil.h                | 2 +-
 stand/libsa/geli/geliboot_internal.h | 8 +++++++-
 7 files changed, 15 insertions(+), 9 deletions(-)

diff --git a/include/rpc/xdr.h b/include/rpc/xdr.h
index 4c75bcc5bbf7..1b480ca0dd34 100644
--- a/include/rpc/xdr.h
+++ b/include/rpc/xdr.h
@@ -332,7 +332,7 @@ __BEGIN_DECLS
 extern void   xdrmem_create(XDR *, char *, u_int, enum xdr_op);
 
 /* XDR using stdio library */
-#ifdef _STDIO_H_
+#ifdef __STDC_VERSION_STDIO_H__
 extern void   xdrstdio_create(XDR *, FILE *, enum xdr_op);
 #endif
 
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>
@@ -540,4 +540,4 @@ extern int __isthreaded;
 __END_DECLS
 __NULLABILITY_PRAGMA_POP
 
-#endif /* !_STDIO_H_ */
+#endif /* !__STDC_VERSION_STDIO_H__ */
diff --git a/include/xlocale.h b/include/xlocale.h
index cc2fc0839593..b1c83592a619 100644
--- a/include/xlocale.h
+++ b/include/xlocale.h
@@ -68,7 +68,7 @@ __BEGIN_DECLS
 #include <xlocale/_ctype.h>
 #endif
 
-#ifdef _STDIO_H_
+#ifdef __STDC_VERSION_STDIO_H__
 #include <xlocale/_stdio.h>
 #endif
 
diff --git a/lib/libc/xdr/xdr.3 b/lib/libc/xdr/xdr.3
index 65adb050fa44..5d81a867ad66 100644
--- a/lib/libc/xdr/xdr.3
+++ b/lib/libc/xdr/xdr.3
@@ -572,7 +572,7 @@ This routine returns the amount of memory required to encode
 using filter
 .Fa func .
 .Pp
-.It Li "#ifdef _STDIO_H_"
+.It Li "#ifdef __STDC_VERSION_STDIO_H__"
 .It Li "/* XDR using stdio library */"
 .It Xo
 .Ft void
diff --git a/lib/libgeom/libgeom.h b/lib/libgeom/libgeom.h
index 2116645bd496..713c49f0380c 100644
--- a/lib/libgeom/libgeom.h
+++ b/lib/libgeom/libgeom.h
@@ -143,7 +143,7 @@ void geom_deletetree(struct gmesh *);
 
 struct gctl_req;
 
-#ifdef _STDIO_H_			/* limit #include pollution */
+#ifdef __STDC_VERSION_STDIO_H__		/* limit #include pollution */
 void gctl_dump(struct gctl_req *, FILE *);
 #endif
 void gctl_free(struct gctl_req *);
diff --git a/lib/libutil/libutil.h b/lib/libutil/libutil.h
index 17e4f1fba247..679a213e64bf 100644
--- a/lib/libutil/libutil.h
+++ b/lib/libutil/libutil.h
@@ -151,7 +151,7 @@ int	uu_lock_txfr(const char *_ttyname, pid_t _pid);
  * Conditionally prototype the following functions if the include
  * files upon which they depend have been included.
  */
-#ifdef _STDIO_H_
+#ifdef __STDC_VERSION_STDIO_H__
 char	*fparseln(FILE *_fp, size_t *_len, size_t *_lineno,
 	    const char _delim[3], int _flags);
 #endif
diff --git a/stand/libsa/geli/geliboot_internal.h b/stand/libsa/geli/geliboot_internal.h
index 50157f24c7f5..6b7b5742408e 100644
--- a/stand/libsa/geli/geliboot_internal.h
+++ b/stand/libsa/geli/geliboot_internal.h
@@ -28,9 +28,15 @@
 #ifndef _GELIBOOT_INTERNAL_H_
 #define _GELIBOOT_INTERNAL_H_
 
+/*
+ * XXX:
+ * The following deliberate defines are to keep g_eli.h from including
+ * unnecessary headers.  It would be preferable to conditionally include
+ * them in a _STANDALONE branch there instead.
+ */
 #define _STRING_H_
 #define _STRINGS_H_
-#define _STDIO_H_
+#define __STDC_VERSION_STDIO_H__	202311L
 
 #include <sys/endian.h>
 #include <sys/queue.h>
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.