changeset 9051:c2e517158d13

* lib/sys_time_.h: Use a recursion-safe inclusion guard rather than a split double-inclusion guard. Needed for cygwin, where <sys/time.h> includes <cygwin/sys_time.h> which includes <sys/select.h> which include <sys/time.h>. Reported by Eric Blake.
author Paul Eggert <eggert@cs.ucla.edu>
date Fri, 06 Jul 2007 16:42:06 +0000
parents 9a948e3ed584
children a06ebd212009
files ChangeLog lib/sys_time_.h
diffstat 2 files changed, 27 insertions(+), 15 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Fri Jul 06 14:22:21 2007 +0000
+++ b/ChangeLog	Fri Jul 06 16:42:06 2007 +0000
@@ -1,3 +1,11 @@
+2007-07-06  Bruno Haible  <bruno@clisp.org>
+
+	* lib/sys_time_.h: Use a recursion-safe inclusion guard rather than
+	a split double-inclusion guard. Needed for cygwin, where <sys/time.h>
+	includes <cygwin/sys_time.h> which includes <sys/select.h> which
+	include <sys/time.h>.
+	Reported by Eric Blake.
+
 2007-07-06  Eric Blake  <ebb9@byu.net>
 
 	Fix testing canonicalize on cygwin.
--- a/lib/sys_time_.h	Fri Jul 06 14:22:21 2007 +0000
+++ b/lib/sys_time_.h	Fri Jul 06 16:42:06 2007 +0000
@@ -18,31 +18,35 @@
 
 /* Written by Paul Eggert.  */
 
-#ifndef _GL_SYS_TIME_H
+#if defined _GL_SYS_TIME_H
 
-/* The include_next requires a split double-inclusion guard.  */
-#if @HAVE_SYS_TIME_H@
-# @INCLUDE_NEXT@ @NEXT_SYS_TIME_H@
+/* Simply delegate to the system's header, without adding anything.  */
+# if @HAVE_SYS_TIME_H@
+#  @INCLUDE_NEXT@ @NEXT_SYS_TIME_H@
+# endif
+
 #else
-# include <time.h>
-#endif
+
+# define _GL_SYS_TIME_H
 
-#ifndef _GL_SYS_TIME_H
-#define _GL_SYS_TIME_H
+# if @HAVE_SYS_TIME_H@
+#  @INCLUDE_NEXT@ @NEXT_SYS_TIME_H@
+# else
+#  include <time.h>
+# endif
 
-#if ! @HAVE_STRUCT_TIMEVAL@
+# if ! @HAVE_STRUCT_TIMEVAL@
 struct timeval
 {
   time_t tv_sec;
   long int tv_usec;
 };
-#endif
+# endif
 
-#if @REPLACE_GETTIMEOFDAY@
-# undef gettimeofday
-# define gettimeofday rpl_gettimeofday
+# if @REPLACE_GETTIMEOFDAY@
+#  undef gettimeofday
+#  define gettimeofday rpl_gettimeofday
 int gettimeofday (struct timeval *restrict, void *restrict);
-#endif
+# endif
 
 #endif /* _GL_SYS_TIME_H */
-#endif /* _GL_SYS_TIME_H */