Paul Eggert <[email protected]> skribis:

> That workaround looks OK to me.  pthread-win32
> seems like it's in pretty bad shape, so hacks like
> that appear to be necessary.

Here’s a complete patch.

Ludo’.

>From 1147bf0f9efe58680f571b87907a741ce2d93a24 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= <[email protected]>
Date: Fri, 29 Mar 2013 12:52:26 +0100
Subject: [PATCH] time: work around pthreads-win32 defects to define 'struct
 timespec'

* lib/time.in.h [@PTHREAD_H_DEFINES_STRUCT_TIMESPEC]: #undef
  HAVE_STRUCT_TIMESPEC to work around pthreads-win32's buggy <pthread.h>
  as reported at
  <http://lists.gnu.org/archive/html/bug-gnulib/2013-03/msg00096.html>.
---
 ChangeLog     |    8 ++++++++
 lib/time.in.h |    6 ++++++
 2 files changed, 14 insertions(+)

diff --git a/ChangeLog b/ChangeLog
index 3843c33..61fd612 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2013-03-29  Ludovic Courtès  <[email protected]>
+
+	time: work around pthreads-win32 defects to define 'struct timespec'
+	* lib/time.in.h [@PTHREAD_H_DEFINES_STRUCT_TIMESPEC]: #undef
+	HAVE_STRUCT_TIMESPEC to work around pthreads-win32's buggy <pthread.h>
+	as reported at
+	<http://lists.gnu.org/archive/html/bug-gnulib/2013-03/msg00096.html>.
+
 2013-03-21  Paul Eggert  <[email protected]>
 
 	sys_select, sys_time: port 2013-01-30 Solaris 2.6 fix to Cygwin
diff --git a/lib/time.in.h b/lib/time.in.h
index ceea2ee..c2a9db6 100644
--- a/lib/time.in.h
+++ b/lib/time.in.h
@@ -54,6 +54,12 @@
 #  if @SYS_TIME_H_DEFINES_STRUCT_TIMESPEC@
 #   include <sys/time.h>
 #  elif @PTHREAD_H_DEFINES_STRUCT_TIMESPEC@
+
+/* The pthreads-win32 <pthread.h> (as of version 1.10.0) includes the
+   user's <config.h>, and defines 'struct timespec' only when
+   HAVE_STRUCT_TIMESPEC is undefined.  Work around that.  */
+#   undef HAVE_STRUCT_TIMESPEC
+
 #   include <pthread.h>
 /* The pthreads-win32 <pthread.h> also defines a couple of broken macros.  */
 #   undef asctime_r
-- 
1.7.10.4

Reply via email to