Mercurial > hg > octave-nkf > gnulib-hg
changeset 12992:4ca54426154c
Fix compilation error on mingw when module 'time_r' is not used.
author | Bruno Haible <bruno@clisp.org> |
---|---|
date | Sun, 14 Mar 2010 19:55:44 +0100 |
parents | 1276be199c4c |
children | e6ab76eb5d57 |
files | ChangeLog lib/time.in.h m4/time_h.m4 modules/time modules/time_r tests/test-time-c++.cc |
diffstat | 6 files changed, 31 insertions(+), 14 deletions(-) [+] |
line wrap: on
line diff
--- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +2010-03-14 Bruno Haible <bruno@clisp.org> + + 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. + 2010-03-14 Bruno Haible <bruno@clisp.org> Fix compilation error with Sun C.
--- a/lib/time.in.h +++ b/lib/time.in.h @@ -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 +# 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 +# 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 +_GL_CXXALIASWARN (gmtime_r); # endif -_GL_CXXALIASWARN (gmtime_r); /* Parse BUF as a time stamp, assuming FORMAT specifies its layout, and store the resulting broken-down time into TM. See
--- a/m4/time_h.m4 +++ b/m4/time_h.m4 @@ -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.
--- a/modules/time +++ b/modules/time @@ -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' \
--- a/modules/time_r +++ b/modules/time_r @@ -11,6 +11,7 @@ configure.ac: gl_TIME_R +gl_TIME_MODULE_INDICATOR([time_r]) Makefile.am:
--- a/tests/test-time-c++.cc +++ b/tests/test-time-c++.cc @@ -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 *,