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
@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,
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
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(
#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])