NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

standards/60389: sys/featuretest.h: _XOPEN_SOURCE=520 fails to imply _POSIX_C_SOURCE=199506L



>Number:         60389
>Category:       standards
>Synopsis:       sys/featuretest.h: _XOPEN_SOURCE=520 fails to imply _POSIX_C_SOURCE=199506L
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    standards-manager
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Tue Jun 30 15:00:00 +0000 2026
>Originator:     Taylor R Campbell
>Release:        current, 11, 10, 9, ...
>Organization:
The X/Open BSD Foundation, Inc.
>Environment:
>Description:

	According to Networking Services (XNS), Issue 5.2,
	_XOPEN_SOURCE>=500, not just _XOPEN_SOURCE=500, should imply
	_POSIX_C_SOURCE=199506L:

	> [I]f _XOPEN_SOURCE is set greater than or equal to 500 and
	> _POSIX_SOURCE is defined, or _POSIX_C_SOURCE is set greater
	> than zero and less than or equal to 199506L, the behavior is
	> the same as if only _XOPEN_SOURCE is defined and set greater
	> than or equal to 500.

	https://pubs.opengroup.org/onlinepubs/009619199/chap1.htm#tagcjh_02_03

	But we only define _POSIX_C_SOURCE if _XOPEN_SOURCE=500
	exactly, not >=500.

    148 #elif (_XOPEN_SOURCE - 0) == 500
    149 #define	_POSIX_C_SOURCE	199506L
    150 #endif

	https://nxr.netbsd.org/xref/src/sys/sys/featuretest.h?r=1.13#139

>How-To-Repeat:
#define	_XOPEN_SOURCE	520

#include <sys/featuretest.h>

#ifndef _POSIX_C_SOURCE
#error "fail"
#endif

>Fix:

	Change == to >=.




Home | Main Index | Thread Index | Old Index