changeset 5788:e8448ee7f92d

(posixtime) [lint]: Avoid spurious warning from gcc-4's -Wuninitialized: initialize tm0.tm_year.
author Jim Meyering <jim@meyering.net>
date Sat, 09 Apr 2005 13:31:08 +0000
parents cbe22a271d32
children d6cfe90c3014
files lib/posixtm.c
diffstat 1 files changed, 9 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/lib/posixtm.c
+++ b/lib/posixtm.c
@@ -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 @@
   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;