This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: the _GNU_SOURCE blues


Phil Edwards wrote:
> 
> On Mon, Jun 18, 2001 at 09:58:55PM -0500, Stefan Seefeld wrote:
> > I have been following the discussions on this list over the last couple
> > of weeks, and I understand that libstdc++ currently needs _GNU_SOURCE
> 
> Only GNU systems, not all systems.
> 
> > which is the reason that the spec file defines it for g++ by default.
> 
> Not anymore.  This was fixed for the 3.0 release.

The spec file does indeed not contain the _GNU_SOURCE symbol any more.
Instead, it seems to be burried deeply inside the gcc source code, as the
following test proves.
Trying to compile a file 'strsignal.c' which does a test that otherwise would
be done by configure, I see this:

------------------

bash$ g++ -v -c ~/strsignal.c 
Reading specs from /usr/local/gcc-3.0/lib/gcc-lib/i686-pc-linux-gnu/3.0/specs
Configured with: ../gcc-3.0/configure --enable-shared --enable-threads --prefix=/usr/local/gcc-3.0
Thread model: posix
gcc version 3.0
 /usr/local/gcc-3.0/lib/gcc-lib/i686-pc-linux-gnu/3.0/cc1plus -v -D__GNUC__=3 -D__GNUC_MINOR__=0
-D__GNUC_PATCHLEVEL__=0 -D__ELF__ -Dunix -Dlinux -D__ELF__ -D__unix__ -D__linux__ -D__unix -D__linux
-Asystem=posix -D__NO_INLINE__ -D__STDC_HOSTED__=1 -D_GNU_SOURCE -Acpu=i386 -Amachine=i386 -Di386
-D__i386 -D__i386__ -D__tune_i686__ -D__tune_pentiumpro__ /home/stefan/strsignal.c -D__GNUG__=3
-D__GXX_DEPRECATED -D__EXCEPTIONS -D__GXX_ABI_VERSION=100 -quiet -dumpbase strsignal.c -version -o
/tmp/cchVPVID.s
GNU CPP version 3.0 (cpplib) (i386 Linux/ELF)
GNU C++ version 3.0 (i686-pc-linux-gnu)
        compiled by GNU C version 3.0.
ignoring nonexistent directory "/usr/local/gcc-3.0/i686-pc-linux-gnu/include"
#include "..." search starts here:
#include <...> search starts here:
 /usr/local/gcc-3.0/include/g++-v3
 /usr/local/gcc-3.0/include/g++-v3/i686-pc-linux-gnu
 /usr/local/gcc-3.0/include/g++-v3/backward
 /usr/local/include
 /usr/local/gcc-3.0/lib/gcc-lib/i686-pc-linux-gnu/3.0/include
 /usr/include
End of search list.
 as --traditional-format -V -Qy -o strsignal.o /tmp/cchVPVID.s
GNU assembler version 2.9.5 (i386-redhat-linux) using BFD version 2.9.5.0.22
bash$ 

------------------

bash$ gcc -v -c ~/strsignal.c 
Reading specs from /usr/local/gcc-3.0/lib/gcc-lib/i686-pc-linux-gnu/3.0/specs
Configured with: ../gcc-3.0/configure --enable-shared --enable-threads --prefix=/usr/local/gcc-3.0
Thread model: posix
gcc version 3.0
 /usr/local/gcc-3.0/lib/gcc-lib/i686-pc-linux-gnu/3.0/cc1 -lang-c -v -D__GNUC__=3 -D__GNUC_MINOR__=0
-D__GNUC_PATCHLEVEL__=0 -D__ELF__ -Dunix -Dlinux -D__ELF__ -D__unix__ -D__linux__ -D__unix -D__linux
-Asystem=posix -D__NO_INLINE__ -D__STDC_HOSTED__=1 -Acpu=i386 -Amachine=i386 -Di386 -D__i386
-D__i386__ -D__tune_i686__ -D__tune_pentiumpro__ /home/stefan/strsignal.c -quiet -dumpbase
strsignal.c -version -o /tmp/ccVPNnzq.s
GNU CPP version 3.0 (cpplib) (i386 Linux/ELF)
GNU C version 3.0 (i686-pc-linux-gnu)
        compiled by GNU C version 3.0.
ignoring nonexistent directory "/usr/local/gcc-3.0/i686-pc-linux-gnu/include"
#include "..." search starts here:
#include <...> search starts here:
 /usr/local/include
 /usr/local/gcc-3.0/lib/gcc-lib/i686-pc-linux-gnu/3.0/include
 /usr/include
End of search list.
/home/stefan/strsignal.c: In function `main':
/home/stefan/strsignal.c:32: `strsignal' undeclared (first use in this function)
/home/stefan/strsignal.c:32: (Each undeclared identifier is reported only once
/home/stefan/strsignal.c:32: for each function it appears in.)
bash$ 

----------------

which clearly shows that both, g++ and gcc, don't see the same environment.

Regards,
		Stefan

X bitmap


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]