[Patches] Fix compiler warning on Linux

Greg Ward gward@python.net
Sun, 28 May 2000 17:25:31 -0400


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?

*** timemodule.c        2000/05/09 19:52:40     2.83
--- timemodule.c        2000/05/28 21:24:46
***************
*** 61,66 ****
--- 61,71 ----
  #include <unistd.h>
  #endif
  
+ /* Necessary to avoid warning on Linux (in glibc 2's time.h, strptime() is
+  * only declared if __USE_XOPEN is defined).
+  */
+ #define __USE_XOPEN
+ 
  #if defined(HAVE_SELECT) && !defined(__BEOS__)
  #include "myselect.h"
  #else

        Greg
-- 
Greg Ward - Unix geek                                   gward@python.net
http://starship.python.net/~gward/
Those of you who think you know everything really annoy those of us who do.