[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: glibc devel info pages



Lo, on Wednesday, January 3, Ben Collins did write:

> On Wed, Jan 03, 2001 at 04:37:44PM +1100, Brian May wrote:
> > >>>>> "Ben" == Ben Collins <bcollins@debian.org> writes:
> > 
> >     Ben> By default, __USE_GNU is defined. If you want to define it
> > 
> > (perhaps you meant "...is undefined"???)
> > 
> >     Ben> explicitly, then use -D_GNU_SOURCE in your CFLAGS.
> > 
> > It doesn't seem to be the case here:
> > 
> > > gcc -DHAVE_CONFIG_H -I. -I. -I.. -I../include    -g -O2 -Wall -c -o main.o main.c        
> > main.c: In function `xmlparse_file':
> > main.c:14: warning: implicit declaration of function `asprintf'
> > 
> > 
> > >gcc -DHAVE_CONFIG_H -I. -I. -I.. -I../include    -g -O2 -D_GNU_SOURCE -Wall -c -o main.o main.c
> > [no warnings]
> > 
> > So it looks like I have to define _GNU_SOURCE explicitly in order to
> > get rid of the warning.
> 
> No, __USE_GNU is defined, unless one of the other _XXX_SOURCE macros are
> also defined (like _SVID_SOURCE or _XOPEN_SOURCE, or similar). Most
> likely the program you are compiling is defining one of these aswell. In
> that case, yes, you do have to define _GNU_SOURCE explicitly.

Hm.  Seems to be a bug somewhere, then:

[minbar:~]$ cat foo.cc
#include <stdio.h>
int main() { return 3 ; }
[minbar:~]$ g++ -E -dM foo.cc | grep USE_GNU
[minbar:~]$ g++ -E -dM -D_GNU_SOURCE foo.cc | grep USE_GNU
#define __USE_GNU 1 

(The -E -dM stuff simply prints out all known preprocessor macros rather
than compiling the file.)

Stock potato install.

Richard



Reply to: