[Patches] Fix compiler warning on Linux

M.-A. Lemburg mal@lemburg.com
Tue, 30 May 2000 10:17:48 +0200


Fredrik Lundh wrote:
> 
> Greg Ward wrote:
> > On Linux (glibc 2.0, at least), compiling the current timemodule.c
> > causes a compiler warning since the prototype for strptime() is not seen:
> >
> >   gcc  -g -O2 -I./../Include -I.. -DHAVE_CONFIG_H -c ./timemodule.c
> >   ./timemodule.c: In function `time_strptime':
> >   ./timemodule.c:442: warning: assignment makes pointer from integer without a cast
> >
> > This patch fixes that.  Anyone see a problem with this, or shall I check
> > it in?  Should the "#define __USE_XOPEN" be wrapped in glibc-detecting
> > code?
> 
> umm.  according to my copy of features.h, __USE_XOPEN is an
> *internal* GNU-specific thingie.  any reason you cannot do this
> in a portable way, and use
> 
>     #define _XOPEN_SOURCE
> 
> instead, just as the unix specifications say?
> 
> (see GNU's features.h for a discussion of environment defines)

Doesn't defining _GNU_SOURCE fix the above too ? I have
these lines in mxDateTime.c and nobody has complained ever
since ;-):

/* Some additional switches are needed on some platforms to make
   strptime() and timegm() available. */
#ifndef _GNU_SOURCE
# define _GNU_SOURCE 1
#endif

-- 
Marc-Andre Lemburg
______________________________________________________________________
Business:                                      http://www.lemburg.com/
Python Pages:                           http://www.lemburg.com/python/