From 1b9bd2b9f83a84ede12622d6a040383b6bded37d Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Fri, 6 Jul 2007 16:42:06 +0000 Subject: [PATCH] * lib/sys_time_.h: Use a recursion-safe inclusion guard rather than a split double-inclusion guard. Needed for cygwin, where includes which includes which include . Reported by Eric Blake. --- ChangeLog | 8 ++++++++ lib/sys_time_.h | 34 +++++++++++++++++++--------------- 2 files changed, 27 insertions(+), 15 deletions(-) diff --git a/ChangeLog b/ChangeLog index 93e5564922..763bf9b42f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2007-07-06 Bruno Haible + + * lib/sys_time_.h: Use a recursion-safe inclusion guard rather than + a split double-inclusion guard. Needed for cygwin, where + includes which includes which + include . + Reported by Eric Blake. + 2007-07-06 Eric Blake Fix testing canonicalize on cygwin. diff --git a/lib/sys_time_.h b/lib/sys_time_.h index 08fac3c7ea..296d20df47 100644 --- a/lib/sys_time_.h +++ b/lib/sys_time_.h @@ -18,31 +18,35 @@ /* Written by Paul Eggert. */ -#ifndef _GL_SYS_TIME_H +#if defined _GL_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 -/* The include_next requires a split double-inclusion guard. */ -#if @HAVE_SYS_TIME_H@ -# @INCLUDE_NEXT@ @NEXT_SYS_TIME_H@ #else -# include -#endif -#ifndef _GL_SYS_TIME_H -#define _GL_SYS_TIME_H +# define _GL_SYS_TIME_H + +# if @HAVE_SYS_TIME_H@ +# @INCLUDE_NEXT@ @NEXT_SYS_TIME_H@ +# else +# include +# 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 */ -- 2.30.2