From dc6d2b5b3652b68d4c62a3875c6960a473b4eaea Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Sat, 10 Aug 2013 22:02:58 -0700 Subject: [PATCH] sys_time: port to OpenBSD * lib/sys_time.in.h: Simply delegate to the system's header in the BSDish cases as well. Problem reported by Mike Miller in . * tests/test-sys_select.c, tests/test-sys_time.c (verify_tv_sec_type): Allow platforms like 64-bit OpenBSD where timeval's tv_sec is wider than time_t. --- ChangeLog | 10 ++++++++++ lib/sys_time.in.h | 5 +++-- tests/test-sys_select.c | 5 +++-- tests/test-sys_time.c | 5 +++-- 4 files changed, 19 insertions(+), 6 deletions(-) diff --git a/ChangeLog b/ChangeLog index 3363d6fbb..b850fb683 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +2013-08-10 Paul Eggert + + sys_time: port to OpenBSD + * lib/sys_time.in.h: Simply delegate to the system's header + in the BSDish cases as well. Problem reported by Mike Miller in + . + * tests/test-sys_select.c, tests/test-sys_time.c (verify_tv_sec_type): + Allow platforms like 64-bit OpenBSD where timeval's tv_sec is + wider than time_t. + 2013-08-09 Pádraig Brady bootstrap: support checksum utils having -c but not --status diff --git a/lib/sys_time.in.h b/lib/sys_time.in.h index 09c9601e4..90dd02bea 100644 --- a/lib/sys_time.in.h +++ b/lib/sys_time.in.h @@ -24,11 +24,12 @@ #endif @PRAGMA_COLUMNS@ -/* On Cygwin, includes itself recursively via . +/* On Cygwin and on many BSDish systems, includes itself + recursively via . Simply delegate to the system's header in this case; it is a no-op. Without this extra ifdef, the C++ gettimeofday declaration below would be a forward declaration in gnulib's nested . */ -#ifdef _CYGWIN_SYS_TIME_H +#if defined _CYGWIN_SYS_TIME_H || defined _SYS_TIME_H || defined _SYS_TIME_H_ # @INCLUDE_NEXT@ @NEXT_SYS_TIME_H@ #else diff --git a/tests/test-sys_select.c b/tests/test-sys_select.c index cd84c0103..160469987 100644 --- a/tests/test-sys_select.c +++ b/tests/test-sys_select.c @@ -40,8 +40,9 @@ SIGNATURE_CHECK (FD_ZERO, void, (fd_set *)); /* Check that the 'struct timeval' type is defined. */ struct timeval a; -/* Check that &a.tv_sec is a 'time_t *', ignoring signedness issues. */ -typedef int verify_tv_sec_type[sizeof (a.tv_sec) == sizeof (time_t) ? 1 : -1]; +/* Check that a.tv_sec is wide enough to hold a time_t, ignoring + signedness issues. */ +typedef int verify_tv_sec_type[sizeof (time_t) <= sizeof (a.tv_sec) ? 1 : -1]; /* Check that sigset_t is defined. */ sigset_t t2; diff --git a/tests/test-sys_time.c b/tests/test-sys_time.c index 1389b5200..80628423e 100644 --- a/tests/test-sys_time.c +++ b/tests/test-sys_time.c @@ -23,8 +23,9 @@ /* Check that the 'struct timeval' type is defined. */ struct timeval a; -/* Check that &a.tv_sec is a 'time_t *', ignoring signedness issues. */ -typedef int verify_tv_sec_type[sizeof (a.tv_sec) == sizeof (time_t) ? 1 : -1]; +/* Check that a.tv_sec is wide enough to hold a time_t, ignoring + signedness issues. */ +typedef int verify_tv_sec_type[sizeof (time_t) <= sizeof (a.tv_sec) ? 1 : -1]; int main (void) -- 2.11.0