<URL: http://bugs.freeciv.org/Ticket/Display.html?id=39849 >

On Tue, 27 Nov 2007 10:10:57 -0800 Jason Short wrote:

> > [cazfi74 - Tue Nov 27 17:48:50 2007]:
> > On 27/11/2007, Marko Lindqvist wrote:
> > >  Now I got this same error in Ubuntu system.
> > >
> > >  It seems that user has to define "_GNU_SOURCE" for "__USE_GNU" to
> > > be defined.
> > >
> > >  No idea how it always gets set at configure time.
> >
> >  Patch to define it both configure and compile time.
> This *can't* be the right fix.
> First of all, why is configure finding the function when it can't be
> found by gcc later?

It doesn't give a warning about implicit function for the next file:
#include <stdio.h> 
#include <string.h> 

int main(void)
  char *c;

  c = strcasestr("123456", "45");
  printf("%s", c);
However, the warning about "assignment makes pointer from integer
without a cast" is present until "#define _GNU_SOURCE" is added. It is
also _shown_ if this define placed _after_ "#include <stdio.h>"

Main thought here is that we have different includes while configuring
and while compiling, and this may affects.

We also have different gcc parameters at the configure time and at the
compile time.

> Secondly, _GNU_SOURCE? Is this a real define or just something internal
> to glibc?  Why would strcasestr not be presented to the user by default
> as the manual indicated?

Which manual?!

       #include <string.h>

       char *strstr(const char *haystack, const char *needle);

       #define _GNU_SOURCE

       #include <string.h>

       char *strcasestr(const char *haystack, const char *needle);

       The  strstr() function conforms to C89 and C99.  The strcasestr() func-
       tion is a non-standard extension.

> Honestly this looks like a glibc bug.

Don't think so.

Thanks, evyscr

Freeciv-dev mailing list

Reply via email to