This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: G++ defining _GNU_SOURCE
At 12:38 11.06.2001, Phil Edwards wrote:
>On Mon, Jun 11, 2001 at 12:19:24PM +0200, Franz Sirl wrote:
> > On the patch itself, how can "-D_GNU_SOURCE %(cpp_cpu)" be correct?
> > Shouldn't that be %(cpp)?
>
>*shrug* I copied the entry from AIX's config, and removed all the stuff that
>was clearly AIX-specific. Only these two remained. If this is wrong for
>one platform, it might be wrong for the other instances (including AIX) too.
aix51.h has both CPP_SPEC and CPLUSPLUS_CPP_SPEC and if you look close you
see most of the stuff between them is shared, except -ansi (makes no sense
with C++) and -posix (probably because _ALL_SOURCE is a superset of
_POSIX_SOURCE? David?). So, this means there are 2 possibilities to get the
same cpp behaviour for C and C++:
1. define CPLUSCPLUS_CPP_SPEC as "-D_GNU_SOURCE " + CPP_SPEC. Am I right to
assume that K&R doesn't support:
#define CPLUSPLUS_CPP_SPEC "-D_GNU_SOURCE " CPP_SPEC
? Or is there a way to do this in K&R? Otherwise most of the stuff between
CPP_SPEC and CPLUSPLUS_CPP_SPEC has to be shared (like aix51.h does) and
this looks quite error prone to me.
2. #define CPLUSPLUS_CPP_SPEC "-D_GNU_SOURCE %(cpp)"
AFAICT %(cpp) always expands to CPP_SPEC, contrary to %C which expands to
either CPP_SPEC or the language specific spec (eg. CPLUSPLUS_CPP_SPEC)
Anyway, I don't see this belonging into config/linux.h, each linux target
should handle this separately. IMHO all the *_SPEC definitions in
config/linux.h should be only examples and no real definitions.
>Every time I try to figure out a pattern to the specs, my brain leaks out
>my left ear.
hehe, it took me a while too :-).
Franz.