Subject: Re: Solaris like __EXTENSIONS__ ?
To: None <mouse@Rodents.Montreal.QC.CA>
From: Ben Harris <bjh21@netbsd.org>
List: tech-userlevel
Date: 04/21/2003 17:58:50
[ Argh.  Must teach my newsreader how to reply to the list.  Sorry Mouse. ]

In article <200304211643.MAA20707@Sparkle.Rodents.Montreal.QC.CA> you write:
>> That's because it's in <sys/types.h>, which no ANSI C program will
>> ever include, so there's no need to protect ANSI C programs from it.
>
>Will ever include _directly_.  Are you certain none of the
>ANSI-specified headers end up pulling it in?

Not entirely certain, but it'd be a bug if they did.

>For example, it looks as
>though <stdlib.h> will unless you have _ANSI_SOURCE, _POSIX_C_SOURCE,
>or _XOPEN_SOURCE defined - does -ansi define _ANSI_SOURCE?

I think it should do, though it doesn't actually seem to be doing so for me
(1.6 macppc).  The compiler just seems to give me __STRICT_ANSI__.  Anyone  
know what's going on here?  In the absence of better ideas, I'd suggest
adding the following to <sys/featuretest.h>:

#if defined(__STRICT_ANSI__) && !defined(_ANSI_SOURCE)
#define _ANSI_SOURCE 1
#endif

I think we need some comments in there explaining what's going on, too. 
That way we might avoid getting into such a mess again.
   
-- 
Ben Harris                                                   <bjh21@netbsd.org>
Portmaster, NetBSD/acorn26           <URL:http://www.netbsd.org/Ports/acorn26/>