sys_time: port to OpenBSD
authorPaul Eggert <eggert@cs.ucla.edu>
Sun, 11 Aug 2013 05:02:58 +0000 (22:02 -0700)
committerPaul Eggert <eggert@cs.ucla.edu>
Sun, 11 Aug 2013 05:03:36 +0000 (22:03 -0700)
* lib/sys_time.in.h: Simply delegate to the system's header
in the BSDish cases as well.  Problem reported by Mike Miller in
<http://lists.gnu.org/archive/html/bug-gnulib/2013-08/msg00016.html>.
* 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
lib/sys_time.in.h
tests/test-sys_select.c
tests/test-sys_time.c

index 3363d6f..b850fb6 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2013-08-10  Paul Eggert  <eggert@cs.ucla.edu>
+
+       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
+       <http://lists.gnu.org/archive/html/bug-gnulib/2013-08/msg00016.html>.
+       * 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 <P@draigBrady.com>
 
        bootstrap: support checksum utils having -c but not --status
index 09c9601..90dd02b 100644 (file)
 #endif
 @PRAGMA_COLUMNS@
 
-/* On Cygwin, <sys/time.h> includes itself recursively via <sys/select.h>.
+/* On Cygwin and on many BSDish systems, <sys/time.h> includes itself
+   recursively via <sys/select.h>.
    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 <sys/time.h>.  */
-#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
 
index cd84c01..1604699 100644 (file)
@@ -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;
index 1389b52..8062842 100644 (file)
@@ -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)