[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 2/2] strptime: silence gcc warnings
From: |
Eric Blake |
Subject: |
[PATCH 2/2] strptime: silence gcc warnings |
Date: |
Wed, 11 Jan 2012 16:24:29 -0700 |
Cross-compiling to mingw raised a couple of gcc warnings.
* lib/strptime.c (__strptime_internal) [!_NL_CURRENT],
[!_LIBC && !HAVE_TM_GMTOFF]: Avoid unused variables.
Reported by Daniel P. Berrange.
Signed-off-by: Eric Blake <address@hidden>
---
ChangeLog | 5 +++++
lib/strptime.c | 13 ++++++++-----
2 files changed, 13 insertions(+), 5 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 3399dda..2b0dfef 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
2012-01-11 Eric Blake <address@hidden>
+ strptime: silence gcc warnings
+ * lib/strptime.c (__strptime_internal) [!_NL_CURRENT],
+ [!_LIBC && !HAVE_TM_GMTOFF]: Avoid unused variables.
+ Reported by Daniel P. Berrange.
+
inet_ntop: silence gcc warning
* lib/inet_ntop.c (inet_ntop6): Initialize best.base.
Reported by Daniel P. Berrange.
diff --git a/lib/strptime.c b/lib/strptime.c
index a09c80d..0d4c3a4 100644
--- a/lib/strptime.c
+++ b/lib/strptime.c
@@ -240,7 +240,6 @@ __strptime_internal (rp, fmt, tm, decided, era_cnt
LOCALE_PARAM)
struct locale_data *const current = locale->__locales[LC_TIME];
#endif
- const char *rp_backup;
int cnt;
size_t val;
int have_I, is_pm;
@@ -253,14 +252,14 @@ __strptime_internal (rp, fmt, tm, decided, era_cnt
LOCALE_PARAM)
int week_no;
#ifdef _NL_CURRENT
size_t num_eras;
+ struct era_entry *era = NULL;
+ const char *rp_backup;
#endif
- struct era_entry *era;
have_I = is_pm = 0;
century = -1;
want_century = 0;
want_era = 0;
- era = NULL;
week_no = 0;
have_wday = want_xday = have_yday = have_mon = have_mday = have_uweek = 0;
@@ -290,10 +289,10 @@ __strptime_internal (rp, fmt, tm, decided, era_cnt
LOCALE_PARAM)
#ifndef _NL_CURRENT
/* We need this for handling the 'E' modifier. */
start_over:
-#endif
-
+#else
/* Make back up of current processing pointer. */
rp_backup = rp;
+#endif
switch (*fmt++)
{
@@ -675,7 +674,9 @@ __strptime_internal (rp, fmt, tm, decided, era_cnt
LOCALE_PARAM)
specify hours. If fours digits are used, minutes are
also specified. */
{
+#if defined _LIBC || HAVE_TM_GMTOFF
bool neg;
+#endif
int n;
val = 0;
@@ -683,7 +684,9 @@ __strptime_internal (rp, fmt, tm, decided, era_cnt
LOCALE_PARAM)
++rp;
if (*rp != '+' && *rp != '-')
return NULL;
+#if defined _LIBC || HAVE_TM_GMTOFF
neg = *rp++ == '-';
+#endif
n = 0;
while (n < 4 && *rp >= '0' && *rp <= '9')
{
--
1.7.7.5
- FYI misc compile warnings on Mingw32, Daniel P. Berrange, 2012/01/11
- [PATCH 0/2] silence some mingw warnings, Eric Blake, 2012/01/11
- [PATCH 2/2] strptime: silence gcc warnings,
Eric Blake <=
- [PATCH 1/2] inet_ntop: silence gcc warning, Eric Blake, 2012/01/11
- Re: [PATCH 1/2] inet_ntop: silence gcc warning, Paul Eggert, 2012/01/11
- Re: [PATCH 1/2] inet_ntop: silence gcc warning, Eric Blake, 2012/01/11
- Re: [PATCH 1/2] inet_ntop: silence gcc warning, Eric Blake, 2012/01/11
- Re: [PATCH 1/2] inet_ntop: silence gcc warning, Paul Eggert, 2012/01/11
- Re: [PATCH 1/2] inet_ntop: silence gcc warning, Jim Meyering, 2012/01/12
- Re: [PATCH 1/2] inet_ntop: silence gcc warning, Eric Blake, 2012/01/12