]> git.ipfire.org Git - thirdparty/autoconf.git/commitdiff
Allow AC_FUNC_MKTIME to work with C++.
authorRalf Wildenhues <Ralf.Wildenhues@gmx.de>
Tue, 12 Jan 2010 18:43:04 +0000 (19:43 +0100)
committerRalf Wildenhues <Ralf.Wildenhues@gmx.de>
Tue, 12 Jan 2010 18:43:04 +0000 (19:43 +0100)
* lib/autoconf/functions.m4 (AC_FUNC_MKTIME): ANSIfy KnR function
definitions.  Use `const char*' for character literals; cast them
to `char*' for putenv.

Signed-off-by: Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
ChangeLog
lib/autoconf/functions.m4

index 577c52116efe46a673711353e31f084be10a53df..2ca9eabaf1d93b7b8b81edf96736dc458d1e5b68 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2010-01-12  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
+
+       Allow AC_FUNC_MKTIME to work with C++.
+       * lib/autoconf/functions.m4 (AC_FUNC_MKTIME): ANSIfy KnR function
+       definitions.  Use `const char*' for character literals; cast them
+       to `char*' for putenv.
+
 2010-01-11  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
 
        Export AUTOM4TE in tests/atlocal.in, for aclocal.
index 9d51088c99ee936a747381a3a7115d2e5de40f96..24dcf86931311435c469ce70bb0b73c1aef99b46 100644 (file)
@@ -1004,8 +1004,8 @@ static time_t time_t_max;
 static time_t time_t_min;
 
 /* Values we'll use to set the TZ environment variable.  */
-static char *tz_strings[] = {
-  (char *) 0, "TZ=GMT0", "TZ=JST-9",
+static const char *tz_strings[] = {
+  (const char *) 0, "TZ=GMT0", "TZ=JST-9",
   "TZ=EST+3EDT+2,M10.1.0/00:00:00,M2.3.0/00:00:00"
 };
 #define N_STRINGS (sizeof (tz_strings) / sizeof (tz_strings[0]))
@@ -1022,7 +1022,7 @@ spring_forward_gap ()
      instead of "TZ=America/Vancouver" in order to detect the bug even
      on systems that don't support the Olson extension, or don't have the
      full zoneinfo tables installed.  */
-  putenv ("TZ=PST8PDT,M4.1.0,M10.5.0");
+  putenv ((char*) "TZ=PST8PDT,M4.1.0,M10.5.0");
 
   tm.tm_year = 98;
   tm.tm_mon = 3;
@@ -1035,16 +1035,14 @@ spring_forward_gap ()
 }
 
 static int
-mktime_test1 (now)
-     time_t now;
+mktime_test1 (time_t now)
 {
   struct tm *lt;
   return ! (lt = localtime (&now)) || mktime (lt) == now;
 }
 
 static int
-mktime_test (now)
-     time_t now;
+mktime_test (time_t now)
 {
   return (mktime_test1 (now)
          && mktime_test1 ((time_t) (time_t_max - now))
@@ -1068,8 +1066,7 @@ irix_6_4_bug ()
 }
 
 static int
-bigtime_test (j)
-     int j;
+bigtime_test (int j)
 {
   struct tm tm;
   time_t now;
@@ -1113,7 +1110,7 @@ year_2050_test ()
      instead of "TZ=America/Vancouver" in order to detect the bug even
      on systems that don't support the Olson extension, or don't have the
      full zoneinfo tables installed.  */
-  putenv ("TZ=PST8PDT,M4.1.0,M10.5.0");
+  putenv ((char*) "TZ=PST8PDT,M4.1.0,M10.5.0");
 
   t = mktime (&tm);
 
@@ -1148,7 +1145,7 @@ main ()
   for (i = 0; i < N_STRINGS; i++)
     {
       if (tz_strings[i])
-       putenv (tz_strings[i]);
+       putenv ((char*) tz_strings[i]);
 
       for (t = 0; t <= time_t_max - delta; t += delta)
        if (! mktime_test (t))