[Patches] Fix compiler warning on Linux

Greg Stein gstein@lyra.org
Mon, 29 May 2000 14:48:14 -0700 (PDT)


+1

I don't think it needs to be wrapped, since extra #define's "shouldn't
hurt". Not opposed to wrapping, tho.

Cheers,
-g

On Sun, 28 May 2000, 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?
> 
> *** 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.
> 
> _______________________________________________
> Patches mailing list
> Patches@python.org
> http://www.python.org/mailman/listinfo/patches
> 

-- 
Greg Stein, http://www.lyra.org/