bug-gnulib
[Top][All Lists]
Advanced

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

[PATCH] strptime: avoid compiler warnings


From: Eric Blake
Subject: [PATCH] strptime: avoid compiler warnings
Date: Fri, 11 Feb 2011 13:35:49 -0700

Reported against mingw, but reproduced on glibc with:

CFLAGS='-Wall -Wunused-label -Wunused-variable' \
  ac_cv_func_strptime=no ./gnulib-tool --with-tests --test strptime

* lib/strptime.c (__strptime_internal) [!_NL_CURRENT]: Avoid
compiler warnings about dead code.
Reported by Daniel P. Berrange.

Signed-off-by: Eric Blake <address@hidden>
---

Easy enough to fix.

 ChangeLog      |    7 +++++++
 lib/strptime.c |    6 ++++++
 2 files changed, 13 insertions(+), 0 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 5ed2911..eea6550 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2011-02-11  Eric Blake  <address@hidden>
+
+       strptime: avoid compiler warnings
+       * lib/strptime.c (__strptime_internal) [!_NL_CURRENT]: Avoid
+       compiler warnings about dead code.
+       Reported by Matthias Bolte.
+
 2011-02-11  Thien-Thi Nguyen  <address@hidden>

        doc: update users.txt
diff --git a/lib/strptime.c b/lib/strptime.c
index c0e0c35..9e4394b 100644
--- a/lib/strptime.c
+++ b/lib/strptime.c
@@ -251,7 +251,9 @@ __strptime_internal (rp, fmt, tm, decided, era_cnt 
LOCALE_PARAM)
   int have_mon, have_mday;
   int have_uweek, have_wweek;
   int week_no;
+#ifdef _NL_CURRENT
   size_t num_eras;
+#endif
   struct era_entry *era;

   have_I = is_pm = 0;
@@ -408,7 +410,9 @@ __strptime_internal (rp, fmt, tm, decided, era_cnt 
LOCALE_PARAM)
           break;
         case 'C':
           /* Match century number.  */
+#ifdef _NL_CURRENT
         match_century:
+#endif
           get_number (0, 99, 2);
           century = val;
           want_xday = 1;
@@ -644,7 +648,9 @@ __strptime_internal (rp, fmt, tm, decided, era_cnt 
LOCALE_PARAM)
           have_wday = 1;
           break;
         case 'y':
+#ifdef _NL_CURRENT
         match_year_in_century:
+#endif
           /* Match year within century.  */
           get_number (0, 99, 2);
           /* The "Year 2000: The Millennium Rollover" paper suggests that
-- 
1.7.4




reply via email to

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