[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] time: work with mingw + pthreads-win32 library
From: |
Bruno Haible |
Subject: |
Re: [PATCH] time: work with mingw + pthreads-win32 library |
Date: |
Thu, 3 Jun 2010 11:57:23 +0200 |
User-agent: |
KMail/1.9.9 |
Hi Eric,
> # if ! @TIME_H_DEFINES_STRUCT_TIMESPEC@
> # if @SYS_TIME_H_DEFINES_STRUCT_TIMESPEC@
> # include <sys/time.h>
> +# elif @PTHREAD_H_DEFINES_STRUCT_TIMESPEC@
> +# include <pthread.h>
> # else
Now, gnulib - not the user's code - is including this <pthread.h>, of
which you just determined that it contains a broken strtok_r and others.
I think it would reduce the damage by doing a #undef strtok_r. Like this.
Do you agree?
2010-06-03 Bruno Haible <address@hidden>
time: Undefine more broken macros.
* lib/time.in.h: Undefine broken localtime_r and gmtime_r macros only
for pthread-win32. Undefine also asctime_r, ctime_r, rand_r, strtok_r.
Reported by Eric Blake.
--- lib/time.in.h.orig Thu Jun 3 11:53:07 2010
+++ lib/time.in.h Thu Jun 3 11:52:58 2010
@@ -55,6 +55,13 @@
# include <sys/time.h>
# elif @PTHREAD_H_DEFINES_STRUCT_TIMESPEC@
# include <pthread.h>
+/* The pthread-win32 <pthread.h> also defines a couple of broken macros. */
+# undef asctime_r
+# undef ctime_r
+# undef gmtime_r
+# undef localtime_r
+# undef rand_r
+# undef strtok_r
# else
# ifdef __cplusplus
@@ -131,7 +138,6 @@
struct tm *restrict __result));
# else
# if ! @HAVE_LOCALTIME_R@
-# undef localtime_r
_GL_FUNCDECL_SYS (localtime_r, struct tm *, (time_t const *restrict __timer,
struct tm *restrict __result)
_GL_ARG_NONNULL ((1, 2)));
@@ -152,7 +158,6 @@
struct tm *restrict __result));
# else
# if ! @HAVE_LOCALTIME_R@
-# undef gmtime_r
_GL_FUNCDECL_SYS (gmtime_r, struct tm *, (time_t const *restrict __timer,
struct tm *restrict __result)
_GL_ARG_NONNULL ((1, 2)));