Should we define _GNU_SOURCE (was Re: GNOME CVS: gnome-common kmaraas)



Kjartan Maraas <kmaraas@fib.hl.no> writes:
> Lars Wirzenius wrote:
> > Kjartan Maraas <kmaraas@fib.hl.no> writes:
> > > I get a warning waying 'assignment makes pointer from integer without
> > > a cast'.
> > 
> > This almost certainly means that as far as the compiler knows, strndup
> > returns an int, not a pointer. That is, a declaration for strndup
> > is missing.
> 
> After reading the code some more I found that if I comment out '#definr
> HAVE_STRNDUP 1'
> in config.h, the error message dissapears, because strndup is declared
> in gnome-argp.h. Is there a possibility that something is wrong with my
> system here or what? 

`autoconf' does a link test.  So, if the symbol `strndup' exists in the
libc, HAVE_STRNDUP will be 1.  However, 

> Shouldn't it be enough to #include <string.h> to get the declaration
> for strndup()?

No.  In GLIBC `strndup' is declared by `string.h' only if _GNU_SOURCE is
defined.  

I don't think it will do any harm if we define _GNU_SOURCE when we
compile `gnome'.  We should probably slip in a -D_GNU_SOURCE into
gnomeConf.sh -- easiest way ;-).

- Hari
-- 
Raja R Harinath ------------------------------ harinath@cs.umn.edu
"When all else fails, read the instructions."      -- Cahn's Axiom
"Our policy is, when in doubt, do the right thing."   -- Roy L Ash



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