diff lib/sys_time.in.h @ 12844:aaa284caae61

sys_time: use link-warning Modernize replacement header, to allow another GNULIB_POSIXCHECK opportunity. * m4/sys_time_h.m4 (gl_HEADER_SYS_TIME_H_BODY): Split defaults... (gl_HEADER_SYS_TIME_H_DEFAULTS): ...into new macro. (gl_SYS_TIME_MODULE_INDICATOR): New macro. * modules/sys_time (Depends-on): Add warn-on-use. (Makefile.am): Always build replacement. (configure.ac): Update substitutions. * m4/gettimeofday.m4 (gl_FUNC_GETTIMEOFDAY) (gl_FUNC_GETTIMEOFDAY_CLOBBER): Include defaults, and no longer bother with SYS_TIME_H. * modules/gettimeofday (configure.ac): Declare indicator. * lib/sys_time.in.h (gettimeofday): Warn if gnulib module is not in use. Signed-off-by: Eric Blake <ebb9@byu.net>
author Eric Blake <ebb9@byu.net>
date Sat, 30 Jan 2010 08:51:59 -0700
parents c2cbabec01dd
children 88955fc5764d
line wrap: on
line diff
--- a/lib/sys_time.in.h	Sat Jan 30 07:44:38 2010 -0700
+++ b/lib/sys_time.in.h	Sat Jan 30 08:51:59 2010 -0700
@@ -41,6 +41,8 @@
 
 /* The definition of _GL_ARG_NONNULL is copied here.  */
 
+/* The definition of _GL_WARN_ON_USE is copied here.  */
+
 #ifdef __cplusplus
 extern "C" {
 #endif
@@ -53,11 +55,19 @@
 };
 # endif
 
-# if @REPLACE_GETTIMEOFDAY@
-#  undef gettimeofday
-#  define gettimeofday rpl_gettimeofday
+# if @GNULIB_GETTIMEOFDAY@
+#  if @REPLACE_GETTIMEOFDAY@
+#   undef gettimeofday
+#   define gettimeofday rpl_gettimeofday
 extern int gettimeofday (struct timeval *restrict, void *restrict)
      _GL_ARG_NONNULL ((1));
+#  endif
+# elif defined GNULIB_POSIXCHECK
+#  undef gettimeofday
+#  if HAVE_RAW_DECL_GETTIMEOFDAY
+_GL_WARN_ON_USE (gettimeofday, "gettimeofday is unportable - "
+		 "use gnulib module gettimeofday for portability");
+#  endif
 # endif
 
 #ifdef __cplusplus