RFC: handling ISO C feature test macros

Joseph Myers joseph@codesourcery.com
Sun May 22 03:24:00 GMT 2016


On Fri, 20 May 2016, Paul Eggert wrote:

> On 05/20/2016 03:00 PM, Joseph Myers wrote:
> > (_GNU_SOURCE should not cause __STDC_WANT_IEC_60559_BFP_EXT__ to be
> > defined because the user might define it with a different expansion.
> 
> Is this a pragmatic suggestion, or is this required by the standards? Surely

It's pragmatic.  So that e.g.

#include <stdio.h>
#define __STDC_WANT_IEC_60559_BFP_EXT__
#include <math.h>

which is valid under TS 18661-1 works even if someone defines _GNU_SOURCE, 
or compiles as C++ (g++ defines _GNU_SOURCE by default 
<https://gcc.gnu.org/bugzilla/show_bug.cgi?id=11196> because of the C++ 
practice of having much of the library implementation in the libstdc++ 
headers, which in turn means those headers depend on libc features outside 
of ISO C).  Although of course the only case covered by the standards is 
if the above is compiled with -std=c11 and no other feature test macros, 
since TS 18661-1 is defined as an extension to C11.

-- 
Joseph S. Myers
joseph@codesourcery.com



More information about the Libc-alpha mailing list