Movatterモバイル変換
[0]ホーム
This is the mail archive of thelibc-alpha@sourceware.orgmailing list for theglibc project.
Re: [PING] [PATCH v2] manual: Document missing feature test macros.
On Fri, 11 Aug 2017, Rical Jasan wrote:> On 08/10/2017 03:26 PM, Joseph Myers wrote:> > OK, but suggested followups:> > > > * In the description of _DEFAULT_SOURCE, note that features from the C > > standard version used by the compiler are also enabled by default. (With > > GCC 5 and later, which defaults to -std=gnu11, that means C11 features are > > enabled, but unlike C99 they aren't part of the 2008 edition of POSIX, so > > aren't already included in the description of default features.)> > How would you like that said? That whole paragraph refers to /either/> feature test macros /or/ compiler options, and uses examples of the> latter, so I already read it as implying if you use a specific compiler> option such as -std=gnu11, you get what it entails, along with anything> that is "default":I read the existing text as saying that certain strict conformance options *disable* features that would otherwise be enabled by default; nothing about compiler options serving to *enable* visibility of features not otherwise listed as present by default.Maybe more of a rework is needed in this area. It's also the case that this section of the manual is preferentially referring to the old -ansi option, when I'd think -std=c11 would be a better example of a standards conformance option in most places (de-emphasising the use of options for old standards). Information to include (some is already present) includes:* Features from the compiler's language version are enabled, regardless of any feature test macros passed.* If you use a strict conformance option, this disables features beyond those from the compiler's language version, and feature test macros need to be used to enable them.* If you don't use a strict conformance option, but you use any C/POSIX feature test macros, this overrides the default enabling of POSIX.1-2008 features. (The logic for this in features.h actually checks for _ISOC99_SOURCE but not _ISOC11_SOURCE. That inconsistency should be fixed, presumably by adding _ISOC99_SOURCE to the conditionals.)* _ISOC99_SOURCE and _ISOC11_SOURCE are not generally needed; they are only relevant if you specifically want to add those newer library features on top of an older language version (e.g. -std=c90 -D_ISOC99_SOURCE).> "@Theglibc{} has a complete implementation of the @w{ISO C99} standard,> and to enable its features, the macro @code{_ISOC99_SOURCE} should be> defined."I think we only need to comment on the state of the glibc implementation when it's significantly incomplete (as for various __STDC_WANT_*). It's more relevant to point out here that there is no need for this macro if your compiler (+ options) uses C99 or later.-- Joseph S. Myersjoseph@codesourcery.com
[8]ページ先頭