bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

strptime on mingw


From: Bruno Haible
Subject: strptime on mingw
Date: Sat, 3 Apr 2010 19:25:06 +0100
User-agent: KMail/1.9.9

Another error in C++ mode on mingw:

  ../gllib/time.h:433: error: `strptime' was not declared in this scope

The reason is a mistake that I made on 2010-03-08, because the macro name
REPLACE_STRPTIME and the "#define strptime rpl_strptime" made me think
an existing function was being replaced. This fixes it:


2010-04-03  Bruno Haible  <address@hidden>

        strptime: Fix C++ test error on mingw.
        * lib/time.in.h (strptime): Use HAVE_STRPTIME, not REPLACE_STRPTIME.
        * m4/strptime.m4 (gl_FUNC_STRPTIME): Set HAVE_STRPTIME, not
        REPLACE_STRPTIME. Invoke gl_PREREQ_STRPTIME.
        (gl_PREREQ_STRPTIME): New macro, extracted from gl_FUNC_STRPTIME.
        * m4/time_h.m4 (gl_HEADER_TIME_H_DEFAULTS): Initialize HAVE_STRPTIME,
        not REPLACE_STRPTIME.
        * modules/time (Makefile.am): Substitute HAVE_STRPTIME, not
        REPLACE_STRPTIME.

--- lib/time.in.h.orig  Sat Apr  3 19:56:03 2010
+++ lib/time.in.h       Sat Apr  3 19:55:37 2010
@@ -157,23 +157,15 @@
    the resulting broken-down time into TM.  See
    <http://www.opengroup.org/susv3xsh/strptime.html>.  */
 # if @GNULIB_STRPTIME@
-#  if @REPLACE_STRPTIME@
-#   if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-#    undef strptime
-#    define strptime rpl_strptime
-#   endif
-_GL_FUNCDECL_RPL (strptime, char *, (char const *restrict __buf,
+#  if ! @HAVE_STRPTIME@
+_GL_FUNCDECL_SYS (strptime, char *, (char const *restrict __buf,
                                      char const *restrict __format,
                                      struct tm *restrict __tm)
                                     _GL_ARG_NONNULL ((1, 2, 3)));
-_GL_CXXALIAS_RPL (strptime, char *, (char const *restrict __buf,
-                                     char const *restrict __format,
-                                     struct tm *restrict __tm));
-#  else
+#  endif
 _GL_CXXALIAS_SYS (strptime, char *, (char const *restrict __buf,
                                      char const *restrict __format,
                                      struct tm *restrict __tm));
-#  endif
 _GL_CXXALIASWARN (strptime);
 # endif
 
--- m4/strptime.m4.orig Sat Apr  3 19:56:03 2010
+++ m4/strptime.m4      Sat Apr  3 19:55:37 2010
@@ -1,4 +1,4 @@
-# strptime.m4 serial 5
+# strptime.m4 serial 6
 dnl Copyright (C) 2007, 2009, 2010 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -8,11 +8,17 @@
 [
   AC_REQUIRE([gl_HEADER_TIME_H_DEFAULTS])
   AC_REQUIRE([AC_C_RESTRICT])
-  AC_REPLACE_FUNCS([strptime])
-  AC_REQUIRE([gl_TM_GMTOFF])
-  if test $ac_cv_func_strptime = yes; then
-    REPLACE_STRPTIME=0
-  else
-    REPLACE_STRPTIME=1
+  AC_CHECK_FUNCS_ONCE([strptime])
+  if test $ac_cv_func_strptime != yes; then
+    HAVE_STRPTIME=0
+    AC_LIBOBJ([strptime])
+    gl_PREREQ_STRPTIME
   fi
 ])
+
+# Prerequisites of lib/strptime.c.
+AC_DEFUN([gl_PREREQ_STRPTIME],
+[
+  AC_REQUIRE([gl_TM_GMTOFF])
+  :
+])
--- m4/time_h.m4.orig   Sat Apr  3 19:56:03 2010
+++ m4/time_h.m4        Sat Apr  3 19:55:49 2010
@@ -79,6 +79,7 @@
   GNULIB_TIME_R=0;                       AC_SUBST([GNULIB_TIME_R])
   dnl Assume proper GNU behavior unless another module says otherwise.
   HAVE_LOCALTIME_R=1;                    AC_SUBST([HAVE_LOCALTIME_R])
+  HAVE_STRPTIME=1;                       AC_SUBST([HAVE_STRPTIME])
   HAVE_TIMEGM=1;                         AC_SUBST([HAVE_TIMEGM])
   dnl If another module says to replace or to not replace, do that.
   dnl Otherwise, replace only if someone compiles with -DGNULIB_PORTCHECK;
@@ -86,6 +87,5 @@
   REPLACE_LOCALTIME_R=GNULIB_PORTCHECK;  AC_SUBST([REPLACE_LOCALTIME_R])
   REPLACE_MKTIME=GNULIB_PORTCHECK;       AC_SUBST([REPLACE_MKTIME])
   REPLACE_NANOSLEEP=GNULIB_PORTCHECK;    AC_SUBST([REPLACE_NANOSLEEP])
-  REPLACE_STRPTIME=GNULIB_PORTCHECK;     AC_SUBST([REPLACE_STRPTIME])
   REPLACE_TIMEGM=GNULIB_PORTCHECK;       AC_SUBST([REPLACE_TIMEGM])
 ])
--- modules/time.orig   Sat Apr  3 19:56:03 2010
+++ modules/time        Sat Apr  3 19:55:37 2010
@@ -33,11 +33,11 @@
              -e 's|@''GNULIB_TIMEGM''@|$(GNULIB_TIMEGM)|g' \
              -e 's|@''GNULIB_TIME_R''@|$(GNULIB_TIME_R)|g' \
              -e 's|@''HAVE_LOCALTIME_R''@|$(HAVE_LOCALTIME_R)|g' \
+             -e 's|@''HAVE_STRPTIME''@|$(HAVE_STRPTIME)|g' \
              -e 's|@''HAVE_TIMEGM''@|$(HAVE_TIMEGM)|g' \
              -e 's|@''REPLACE_LOCALTIME_R''@|$(REPLACE_LOCALTIME_R)|g' \
              -e 's|@''REPLACE_MKTIME''@|$(REPLACE_MKTIME)|g' \
              -e 's|@''REPLACE_NANOSLEEP''@|$(REPLACE_NANOSLEEP)|g' \
-             -e 's|@''REPLACE_STRPTIME''@|$(REPLACE_STRPTIME)|g' \
              -e 's|@''REPLACE_TIMEGM''@|$(REPLACE_TIMEGM)|g' \
              -e 
's|@''SYS_TIME_H_DEFINES_STRUCT_TIMESPEC''@|$(SYS_TIME_H_DEFINES_STRUCT_TIMESPEC)|g'
 \
              -e 
's|@''TIME_H_DEFINES_STRUCT_TIMESPEC''@|$(TIME_H_DEFINES_STRUCT_TIMESPEC)|g' \




reply via email to

[Prev in Thread] Current Thread [Next in Thread]