From: Bruno Haible Date: Sun, 14 Mar 2010 18:55:44 +0000 (+0100) Subject: Fix compilation error on mingw when module 'time_r' is not used. X-Git-Tag: v0.1~4495 X-Git-Url: http://erislabs.net/gitweb/?a=commitdiff_plain;h=a8c2b3083dcaff29eb1c34e1901fae3f7858d3aa;p=gnulib.git Fix compilation error on mingw when module 'time_r' is not used. --- diff --git a/ChangeLog b/ChangeLog index 305a83576..129dd8aff 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,15 @@ 2010-03-14 Bruno Haible + 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 + Fix compilation error with Sun C. * lib/strtol.c: Use LLONG_MIN instead of GCC specific LONG_LONG_MIN. Use LLONG_MAX instead of GCC specific LONG_LONG_MAX. Use ULLONG_MAX diff --git a/lib/time.in.h b/lib/time.in.h index d2cf84be6..a5d3ae456 100644 --- a/lib/time.in.h +++ b/lib/time.in.h @@ -108,36 +108,38 @@ _GL_CXXALIASWARN (mktime); /* Convert TIMER to RESULT, assuming local time and UTC respectively. See and . */ -# 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 diff --git a/m4/time_h.m4 b/m4/time_h.m4 index ba2e19460..f572b8594 100644 --- a/m4/time_h.m4 +++ b/m4/time_h.m4 @@ -76,6 +76,7 @@ AC_DEFUN([gl_HEADER_TIME_H_DEFAULTS], 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. diff --git a/modules/time b/modules/time index 02c7a20b2..733c9695b 100644 --- a/modules/time +++ b/modules/time @@ -31,6 +31,7 @@ time.h: time.in.h $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H) -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' \ diff --git a/modules/time_r b/modules/time_r index 8349bcf4a..f181b5d59 100644 --- a/modules/time_r +++ b/modules/time_r @@ -11,6 +11,7 @@ time configure.ac: gl_TIME_R +gl_TIME_MODULE_INDICATOR([time_r]) Makefile.am: diff --git a/tests/test-time-c++.cc b/tests/test-time-c++.cc index 501345f14..bb6fd20b9 100644 --- a/tests/test-time-c++.cc +++ b/tests/test-time-c++.cc @@ -33,11 +33,13 @@ SIGNATURE_CHECK (GNULIB_NAMESPACE::nanosleep, int, 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 *,