[Python-Dev] Make _GNU_SOURCE default for gcc ?!
Fred L. Drake, Jr.
fdrake@beopen.com
Tue, 4 Jul 2000 13:53:15 -0400 (EDT)
Fredrik Lundh writes:
> what does "fixes warnings" mean? does it change the compiler's
> behaviour, or does it just make sure stuff are defined in the right
> files?
There's a strptime() declaration about halfway down the file in an
#if 0 section; this has to be enabled on Linux to get rid of a
warning.
Defining _GNU_SOURCE at the top of the file also gets rid of the
warning, but defining _XOPEN_SOURCE doesn't; in that case I get more:
gcc -fpic -g -O2 -I../../Modules/../Include -I.. -DHAVE_CONFIG_H -c ../../Modules/timemodule.c
../../Modules/timemodule.c: In function `inittime':
../../Modules/timemodule.c:652: structure has no member named `tm_gmtoff'
../../Modules/timemodule.c:653: structure has no member named `tm_zone'
../../Modules/timemodule.c:653: structure has no member named `tm_zone'
../../Modules/timemodule.c:653: structure has no member named `tm_zone'
../../Modules/timemodule.c:653: structure has no member named `tm_zone'
../../Modules/timemodule.c:653: structure has no member named `tm_zone'
../../Modules/timemodule.c:653: structure has no member named `tm_zone'
../../Modules/timemodule.c:653: structure has no member named `tm_zone'
../../Modules/timemodule.c:653: structure has no member named `tm_zone'
../../Modules/timemodule.c:653: structure has no member named `tm_zone'
../../Modules/timemodule.c:653: structure has no member named `tm_zone'
../../Modules/timemodule.c:657: structure has no member named `tm_gmtoff'
../../Modules/timemodule.c:658: structure has no member named `tm_zone'
../../Modules/timemodule.c:658: structure has no member named `tm_zone'
../../Modules/timemodule.c:658: structure has no member named `tm_zone'
../../Modules/timemodule.c:658: structure has no member named `tm_zone'
../../Modules/timemodule.c:658: structure has no member named `tm_zone'
../../Modules/timemodule.c:658: structure has no member named `tm_zone'
../../Modules/timemodule.c:658: structure has no member named `tm_zone'
../../Modules/timemodule.c:658: structure has no member named `tm_zone'
../../Modules/timemodule.c:658: structure has no member named `tm_zone'
../../Modules/timemodule.c:658: structure has no member named `tm_zone'
make[1]: *** [timemodule.o] Error 1
make: *** [sharedmods] Error 2
> how is this different from just a plain (and truly portable)
> #define _XOPEN_SOURCE?
A valid concern, but most of _GNU_SOURCE is just shorthand to make
sure just about every non-conflicting declaration is made, so that
differences between other platforms "standard" declarations aren't as
much of a problem. But I'm not advocating it for general use; the
sources are already working well aside from this one warning in
timemodule.c; defining _GNU_SOURCE here is sufficient as far as I can
tell.
-Fred
--
Fred L. Drake, Jr. <fdrake at beopen.com>
BeOpen PythonLabs Team Member