diff options
author | Pádraig Brady <P@draigBrady.com> | 2014-12-05 12:32:49 +0000 |
---|---|---|
committer | Pádraig Brady <P@draigBrady.com> | 2014-12-05 13:22:42 +0000 |
commit | 819cfe3c56733f1de97fd69cf782db968f1f68e7 (patch) | |
tree | 16763b8dc260ee53be059dcba9e809f19806a159 /lib/posixtm.c | |
parent | 1000eab5ab8c64eed6821d0a7c78024a00297a17 (diff) | |
download | gnulib-819cfe3c56733f1de97fd69cf782db968f1f68e7.tar.gz |
filevercmp, posixtm: avoid compiler warnings with -O3
* lib/filevercmp.h (filevercmp): Tag with _GL_ATTRIBUTE_PURE
* lib/posixtm.c: (IF_LINT): Define.
(posix_time_parse): Use it to void a "may be used uninitialized"
warning, seen only with -O3.
Diffstat (limited to 'lib/posixtm.c')
-rw-r--r-- | lib/posixtm.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/lib/posixtm.c b/lib/posixtm.c index 2fe81ab6a0..30239320ae 100644 --- a/lib/posixtm.c +++ b/lib/posixtm.c @@ -27,6 +27,13 @@ #include <sys/types.h> #include <string.h> +/* Use this to suppress gcc's "...may be used uninitialized" warnings. */ +#ifdef lint +# define IF_LINT(Code) Code +#else +# define IF_LINT(Code) /* empty */ +#endif + #if USE_UNLOCKED_IO # include "unlocked-io.h" #endif @@ -118,6 +125,8 @@ posix_time_parse (struct tm *tm, const char *s, unsigned int syntax_bits) if (len != 8 && len != 10 && len != 12) return 1; + IF_LINT(if (len < 8) return 1;) + if (dot) { if (!(syntax_bits & PDS_SECONDS)) |