This is the mail archive of the
mailing list for the glibc project.
_DEFAULT_SOURCE expected semantic
- From: Adhemerval Zanella <adhemerval dot zanella at linaro dot org>
- To: GNU C Library <libc-alpha at sourceware dot org>
- Date: Wed, 10 Apr 2019 08:20:28 -0300
- Subject: _DEFAULT_SOURCE expected semantic
Recently on libc-help   it was raised some questions about
_DEFAULT_SOURCE semantic in regard which standard it defines.
After some discussion the issues seems to be which would be the expected
_POSIX_C_SOURCE and _XOPEN_SOURCE the _DEFAULT_SOURCE is expected to
define, if new standards values would change its definition, and
if user would require to add configuration checks to check which
POSIX1 and XSI extension it provides.
The _DEFAULT_SOURCE was added on glibc 2.19 (commit c688b4196014e016) and
explicit stated that it implies -D_BSD_SOURCE -D_SVID_SOURCE
-D_POSIX_C_SOURCE=200809L. Also, glibc 2.20 changed change _BSD_SOURCE and
_SVID_SOURCE to define _DEFAULT_SOURCE and later on 2.28 take in
consideration _ISOC11_SOURCE as well.
So _DEFAULT_SOURCE always defines -D_POSIX_C_SOURCE=200809L without
implicit _XOPEN_SOURCE from glibc 2.19 to 2.30. Afaik there is no need to
currently to add POSIX1.2017 support, so the question is whether
glibc will continue to eforce -D_POSIX_C_SOURCE=200809L for
_DEFAULT_SOURCE in future versions or if the flag will eventually be update
whether/once a new POSIX1 version is required.