mirror of
git://git.musl-libc.org/musl
synced 2024-12-15 11:15:07 +00:00
5edbc6fe13
as a result of commit ab8f6a6e42
, this
definition is now equivalent to the actual "default profile" which
appears immediately below in features.h, and which defines both
_BSD_SOURCE and _XOPEN_SOURCE.
the intent of providing a _DEFAULT_SOURCE, which glibc also now
provides, is to give applications a way to "get back" the default
feature profile when it was lost either by compiler flags that inhibit
it (such as -std=c99) or by library-provided predefined macros (such
as -D_POSIX_C_SOURCE=200809L) which may inhibit exposure of features
that were otherwise visible by default and which the application may
need. without _DEFAULT_SOURCE, the application had encode knowledge of
a particular libc's defaults, and such knowledge was fragile and
subject to bitrot.
eventually the names _GNU_SOURCE and _BSD_SOURCE should be phased out
in favor of the more-descriptive and more-accurate _ALL_SOURCE and
_DEFAULT_SOURCE, leaving the old names as aliases but using the new
ones internally. however this is a more invasive change that would
require extensive regression testing, so it is deferred.
37 lines
773 B
C
37 lines
773 B
C
#ifndef _FEATURES_H
|
|
#define _FEATURES_H
|
|
|
|
#if defined(_ALL_SOURCE) && !defined(_GNU_SOURCE)
|
|
#define _GNU_SOURCE 1
|
|
#endif
|
|
|
|
#if defined(_DEFAULT_SOURCE) && !defined(_BSD_SOURCE)
|
|
#define _BSD_SOURCE 1
|
|
#endif
|
|
|
|
#if !defined(_POSIX_SOURCE) && !defined(_POSIX_C_SOURCE) \
|
|
&& !defined(_XOPEN_SOURCE) && !defined(_GNU_SOURCE) \
|
|
&& !defined(_BSD_SOURCE) && !defined(__STRICT_ANSI__)
|
|
#define _BSD_SOURCE 1
|
|
#define _XOPEN_SOURCE 700
|
|
#endif
|
|
|
|
#if __STDC_VERSION__ >= 199901L
|
|
#define __restrict restrict
|
|
#elif !defined(__GNUC__)
|
|
#define __restrict
|
|
#endif
|
|
|
|
#if __STDC_VERSION__ >= 199901L || defined(__cplusplus)
|
|
#define __inline inline
|
|
#endif
|
|
|
|
#if __STDC_VERSION__ >= 201112L
|
|
#elif defined(__GNUC__)
|
|
#define _Noreturn __attribute__((__noreturn__))
|
|
#else
|
|
#define _Noreturn
|
|
#endif
|
|
|
|
#endif
|