ChangeLog | 8 ++++++++ doc/posix-headers/sys_time.texi | 7 ++++++- m4/sys_time_h.m4 | 8 ++++++-- 3 files changed, 20 insertions(+), 3 deletions(-)
diff --git a/ChangeLog b/ChangeLog index 78b2ab3..590bcc1 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,13 @@ 2012-07-05 Paul Eggert <egg...@cs.ucla.edu> + sys_time: allow too-wide tv_sec + * m4/sys_time_h.m4 (gl_HEADER_SYS_TIME_H_BODY): Allow struct + timeval even if tv_sec is wider than time_t. This allows + OpenBSD 5.1 amd64 and fixes an Emacs porting glitch with utimens.c, + as without this patch gnulib replaces struct timeval + and OpenBSD futimes therefore has a type mismatch. + * doc/posix-headers/sys_time.texi: Mention this. + pthread: check for both pthread_create and pthread_join * m4/pthread.m4 (gl_PTHREAD_CHECK): Revert previous change, but alter the check so that it tests for both pthread_create and diff --git a/doc/posix-headers/sys_time.texi b/doc/posix-headers/sys_time.texi index 6650b7e..2cacaa5 100644 --- a/doc/posix-headers/sys_time.texi +++ b/doc/posix-headers/sys_time.texi @@ -13,7 +13,8 @@ MSVC 9. @item @samp{struct timeval} is not defined on some platforms. @item -@samp{struct timeval} is defined with an incompatible type for @code{tv_sec} +@samp{struct timeval} is defined with a @code{tv_sec} type that is +narrower than @code{time_t} on some native Windows platforms: mingw64 in 64-bit mode, mingw64 in 32-bit mode when @code{__MINGW_USE_VC2005_COMPAT} is defined, @@ -23,4 +24,8 @@ MSVC 9 in 32-bit mode when @code{_USE_32BIT_TIME_T} is not defined. Portability problems not fixed by Gnulib: @itemize +@item +@samp{struct timeval} is defined with a @code{tv_sec} type that is +wider than @code{time_t}: +OpenBSD 5.1 in 64-bit mode. @end itemize diff --git a/m4/sys_time_h.m4 b/m4/sys_time_h.m4 index 26eaf8e..c4a30cd 100644 --- a/m4/sys_time_h.m4 +++ b/m4/sys_time_h.m4 @@ -52,7 +52,9 @@ AC_DEFUN([gl_HEADER_SYS_TIME_H_BODY], dnl (in <sys/time.h> and <winsock2.h> for mingw64, in <winsock2.h> only dnl for MSVC) with a tv_sec field of type 'long' (32-bit!), which is dnl smaller than the 'time_t' type mandated by POSIX. - AC_CACHE_CHECK([for correct struct timeval.tv_sec member], + dnl On OpenBSD 5.1 amd64, tv_sec is 64 bits and time_t 32 bits, but + dnl that is good enough. + AC_CACHE_CHECK([for wide-enough struct timeval.tv_sec member], [gl_cv_sys_struct_timeval_tv_sec], [AC_COMPILE_IFELSE( [AC_LANG_PROGRAM( @@ -65,7 +67,9 @@ AC_DEFUN([gl_HEADER_SYS_TIME_H_BODY], #endif ]], [[static struct timeval x; - typedef int verify_tv_sec_type[sizeof (x.tv_sec) == sizeof (time_t) ? 1 : -1]; + typedef int verify_tv_sec_type[ + sizeof (time_t) <= sizeof x.tv_sec ? 1 : -1 + ]; ]])], [gl_cv_sys_struct_timeval_tv_sec=yes], [gl_cv_sys_struct_timeval_tv_sec=no]) -- 1.7.6.5