[PATCH v2 2/2] libc/features.h: Make code match documentation

Simon Barth simon.barth@gmx.de
Fri Nov 14 23:26:25 GMT 2025


The documentation states that _GNU_SOURCE enables "all of the above
plus GNU extensions.". Furthermore the documentation states that
_DEFAULT_SOURCE would enable POSIX-1.2008 with BSD and SVr4 extensions.

The code did different things though:

* For _GNU_SOURCE it only enabled POSIX.1-2008 but it should have been the
  highest available one, POSIX.1-2024.
* For _DEFAULT_SOURCE it enabled POSIX.1-2024.

Let's use the highest available POSIX standard possible and fix
documentation where necessary.
---
 newlib/libc/include/sys/features.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/newlib/libc/include/sys/features.h b/newlib/libc/include/sys/features.h
index 2a5da45ab..f0f5286ac 100644
--- a/newlib/libc/include/sys/features.h
+++ b/newlib/libc/include/sys/features.h
@@ -105,7 +105,7 @@ extern "C" {
  * _BSD_SOURCE (deprecated by _DEFAULT_SOURCE)
  * _SVID_SOURCE (deprecated by _DEFAULT_SOURCE)
  * _DEFAULT_SOURCE (or none of the above)
- *	POSIX-1.2008 with BSD and SVr4 extensions
+ *	POSIX.1-2024 with BSD and SVr4 extensions
  *
  * _FORTIFY_SOURCE = 1, 2 or 3
  *	Object Size Checking function wrappers
@@ -132,7 +132,7 @@ extern "C" {
 #undef _POSIX_SOURCE
 #define	_POSIX_SOURCE		1
 #undef _POSIX_C_SOURCE
-#define	_POSIX_C_SOURCE		200809L
+#define	_POSIX_C_SOURCE		202405L
 #undef _XOPEN_SOURCE
 #define	_XOPEN_SOURCE		700
 #undef _XOPEN_SOURCE_EXTENDED
-- 
2.51.2



More information about the Newlib mailing list