[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[bug-gnulib] FYI: posixtm.c nit
From: |
Jim Meyering |
Subject: |
[bug-gnulib] FYI: posixtm.c nit |
Date: |
Sat, 09 Apr 2005 15:41:30 +0200 |
Here's another one that was detected by gcc-4's -Wuninitialized,
but unlike for human.c, this time it's a false alert.
I've checked this in for gnulib and coreutils.
2005-04-09 Jim Meyering <address@hidden>
* posixtm.c (posixtime) [lint]: Avoid spurious warning from gcc-4's
-Wuninitialized: initialize tm0.tm_year.
Index: posixtm.c
===================================================================
RCS file: /fetish/cu/lib/posixtm.c,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -p -u -r1.18 -r1.19
--- posixtm.c 4 Oct 2004 20:18:43 -0000 1.18
+++ posixtm.c 9 Apr 2005 13:28:25 -0000 1.19
@@ -1,6 +1,6 @@
/* Parse dates for touch and date.
- Copyright (C) 1989, 1990, 1991, 1998, 2000, 2001, 2002, 2003, 2004
+ Copyright (C) 1989, 1990, 1991, 1998, 2000, 2001, 2002, 2003, 2004, 2005
Free Software Foundation Inc.
This program is free software; you can redistribute it and/or modify
@@ -198,6 +198,14 @@ posixtime (time_t *p, const char *s, uns
struct tm const *tm;
time_t t;
+#ifdef lint
+ /* Placate gcc-4's -Wuninitialized.
+ posix_time_parse fails to set tm0.tm_year only when it returns
+ nonzero (due to year() returning nonzero), and in that case,
+ this code doesn't use the tm0 at all. */
+ tm0.tm_year = 0;
+#endif
+
if (posix_time_parse (&tm0, s, syntax_bits))
return false;
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [bug-gnulib] FYI: posixtm.c nit,
Jim Meyering <=