HomeFreeBSD

cdefs.h: Document the _XOPEN_SOURCE - 0 construct

Description

cdefs.h: Document the _XOPEN_SOURCE - 0 construct

Various System V Interface Definition editions, as well as the X/Open
group portability guide issue 4, recommend defining _XOPEN_SOURCE and
broadly intimating it means the same thing as _POSIX_SOURCE == 2.

Starting in X/Open issue 5 (1995), _XOPEN_SOURCE needs to be defined to
be 500 to bring in the newer interfaces. However, it is still common hat
sources define _XOPEN_SOURCE to be blank. To deal with that, we subtract
0 from _XOPEN_SOURCE to make the other expressions well formed.

While here, document that we should define _POSIX_C_SOURCE to be 199209
based on the SVID, the first version of the Single Unix Specification,
and X/Open CAE issue 4, version 2. Also document that historically this
has been a NOP. Any value of _XOPEN_SOURCE < 500 (including it being
blank) was not viewed as a request for a restricted namespace.

Reviewed by: brooks (earlier version)
Differential Revision: https://reviews.freebsd.org/D47584
Sponsored by: Netflix

Details

Provenance
impAuthored on Nov 14 2024, 11:53 PM
Reviewer
brooks
Differential Revision
D47584: cdefs.h: Document the _XOPEN_SOURCE - 0 construct
Parents
rG75b635c77443: cdefs: update for C23 and POSIX24
Branches
Unknown
Tags
Unknown