Mercurial > hg > octave-lojdl > gnulib-hg
changeset 16970:536d27654da7
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.
author | Paul Eggert <eggert@cs.ucla.edu> |
---|---|
date | Fri, 06 Jul 2012 02:28:29 +0000 |
parents | b284d21804b8 |
children | 76dee4804e7e |
files | ChangeLog doc/posix-headers/sys_time.texi m4/sys_time_h.m4 |
diffstat | 3 files changed, 20 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,13 @@ 2012-07-05 Paul Eggert <eggert@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
--- a/doc/posix-headers/sys_time.texi +++ b/doc/posix-headers/sys_time.texi @@ -13,7 +13,8 @@ @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 @@ 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
--- a/m4/sys_time_h.m4 +++ b/m4/sys_time_h.m4 @@ -52,7 +52,9 @@ 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 @@ #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])