[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
time_r fix
From: |
Bruno Haible |
Subject: |
time_r fix |
Date: |
Sun, 14 Mar 2010 19:56:35 +0100 |
User-agent: |
KMail/1.9.9 |
Compiling a testdir for 'time' on mingw, I see this error:
../gllib/time.h:379: error: `::localtime_r' has not been declared
../gllib/time.h:394: error: `::gmtime_r' has not been declared
This fixes it.
2010-03-14 Bruno Haible <address@hidden>
Fix compilation error on mingw when module 'time_r' is not used.
* lib/time.in.h (localtime_r, gmtime_r): Declare only if GNULIB_TIME_R
is 1.
* tests/test-time-c++.cc (localtime_r, gmtime_r): Likewise.
* modules/time_r (configure.ac): Invoke gl_TIME_MODULE_INDICATOR.
* modules/time (Makefile.am): Substitute GNULIB_TIME_R.
* m4/time_h.m4 (gl_HEADER_TIME_H_DEFAULTS): Initialize GNULIB_TIME_R.
--- lib/time.in.h.orig Sun Mar 14 19:50:53 2010
+++ lib/time.in.h Sun Mar 14 19:46:59 2010
@@ -108,36 +108,38 @@
/* Convert TIMER to RESULT, assuming local time and UTC respectively. See
<http://www.opengroup.org/susv3xsh/localtime_r.html> and
<http://www.opengroup.org/susv3xsh/gmtime_r.html>. */
-# if @REPLACE_LOCALTIME_R@
-# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-# undef localtime_r
-# define localtime_r rpl_localtime_r
-# endif
+# if @GNULIB_TIME_R@
+# if @REPLACE_LOCALTIME_R@
+# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+# undef localtime_r
+# define localtime_r rpl_localtime_r
+# endif
_GL_FUNCDECL_RPL (localtime_r, struct tm *, (time_t const *restrict __timer,
struct tm *restrict __result)
_GL_ARG_NONNULL ((1, 2)));
_GL_CXXALIAS_RPL (localtime_r, struct tm *, (time_t const *restrict __timer,
struct tm *restrict __result));
-# else
+# else
_GL_CXXALIAS_SYS (localtime_r, struct tm *, (time_t const *restrict __timer,
struct tm *restrict __result));
-# endif
-_GL_CXXALIASWARN (localtime_r);
-# if @REPLACE_LOCALTIME_R@
-# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-# undef gmtime_r
-# define gmtime_r rpl_gmtime_r
# endif
+_GL_CXXALIASWARN (localtime_r);
+# if @REPLACE_LOCALTIME_R@
+# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+# undef gmtime_r
+# define gmtime_r rpl_gmtime_r
+# endif
_GL_FUNCDECL_RPL (gmtime_r, struct tm *, (time_t const *restrict __timer,
struct tm *restrict __result)
_GL_ARG_NONNULL ((1, 2)));
_GL_CXXALIAS_RPL (gmtime_r, struct tm *, (time_t const *restrict __timer,
struct tm *restrict __result));
-# else
+# else
_GL_CXXALIAS_SYS (gmtime_r, struct tm *, (time_t const *restrict __timer,
struct tm *restrict __result));
-# endif
+# endif
_GL_CXXALIASWARN (gmtime_r);
+# endif
/* Parse BUF as a time stamp, assuming FORMAT specifies its layout, and store
the resulting broken-down time into TM. See
--- m4/time_h.m4.orig Sun Mar 14 19:50:53 2010
+++ m4/time_h.m4 Sun Mar 14 19:48:12 2010
@@ -76,6 +76,7 @@
GNULIB_NANOSLEEP=0; AC_SUBST([GNULIB_NANOSLEEP])
GNULIB_STRPTIME=0; AC_SUBST([GNULIB_STRPTIME])
GNULIB_TIMEGM=0; AC_SUBST([GNULIB_TIMEGM])
+ GNULIB_TIME_R=0; AC_SUBST([GNULIB_TIME_R])
dnl If another module says to replace or to not replace, do that.
dnl Otherwise, replace only if someone compiles with -DGNULIB_PORTCHECK;
dnl this lets maintainers check for portability.
--- modules/time.orig Sun Mar 14 19:50:53 2010
+++ modules/time Sun Mar 14 19:47:59 2010
@@ -31,6 +31,7 @@
-e 's|@''GNULIB_NANOSLEEP''@|$(GNULIB_NANOSLEEP)|g' \
-e 's|@''GNULIB_STRPTIME''@|$(GNULIB_STRPTIME)|g' \
-e 's|@''GNULIB_TIMEGM''@|$(GNULIB_TIMEGM)|g' \
+ -e 's|@''GNULIB_TIME_R''@|$(GNULIB_TIME_R)|g' \
-e 's|@''REPLACE_LOCALTIME_R''@|$(REPLACE_LOCALTIME_R)|g' \
-e 's|@''REPLACE_MKTIME''@|$(REPLACE_MKTIME)|g' \
-e 's|@''REPLACE_NANOSLEEP''@|$(REPLACE_NANOSLEEP)|g' \
--- modules/time_r.orig Sun Mar 14 19:50:53 2010
+++ modules/time_r Sun Mar 14 19:45:27 2010
@@ -11,6 +11,7 @@
configure.ac:
gl_TIME_R
+gl_TIME_MODULE_INDICATOR([time_r])
Makefile.am:
--- tests/test-time-c++.cc.orig Sun Mar 14 19:50:54 2010
+++ tests/test-time-c++.cc Sun Mar 14 19:47:23 2010
@@ -33,11 +33,13 @@
SIGNATURE_CHECK (GNULIB_NAMESPACE::mktime, time_t, (struct tm *));
#endif
+#if GNULIB_TIME_R
SIGNATURE_CHECK (GNULIB_NAMESPACE::localtime_r, struct tm *,
(time_t const *, struct tm *));
SIGNATURE_CHECK (GNULIB_NAMESPACE::gmtime_r, struct tm *,
(time_t const *, struct tm *));
+#endif
#if GNULIB_STRPTIME
SIGNATURE_CHECK (GNULIB_NAMESPACE::strptime, char *,
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- time_r fix,
Bruno Haible <=