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

Message ID 20251114232625.1788701-3-simon.barth@gmx.de
State New
Headers
Series Improve POSIX.1-2024 conformity and docs |

Commit Message

Simon Barth Nov. 14, 2025, 11:26 p.m. UTC
  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(-)
  

Comments

Corinna Vinschen Nov. 19, 2025, 11:15 a.m. UTC | #1
On Nov 15 00:26, Simon Barth wrote:
> 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

That was the intention anyway, so this is fine. Pushed.

Thanks,
Corinna
  

Patch

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