No need to penalize the code just to silence a gcc warning, so
follow the conventions used elsewhere in gnulib. Clients that
want to use extra warnings should also be using -Dlint.
* lib/inet_ntop.c (inet_ntop6): Mark spurious initialization, for
better code generation when not checking for warnings.
Suggested by Paul Eggert and Jim Meyering.
Signed-off-by: Eric Blake <eblake@redhat.com>
2012-01-12 Eric Blake <eblake@redhat.com>
+ inet_ntop: guard extra work by IF_LINT
+ * lib/inet_ntop.c (inet_ntop6): Mark spurious initialization, for
+ better code generation when not checking for warnings.
+ Suggested by Paul Eggert and Jim Meyering.
+
strptime: fix regression on mingw
* lib/strptime.c (__strptime_internal) [!_LIBC && !HAVE_TM_GMTOFF]:
Fix regression. Reported by Bruno Haible.
/* Specification. */
#include <arpa/inet.h>
+/* Use this to suppress gcc's "...may be used before initialized" warnings.
+ Beware: The Code argument must not contain commas. */
+#ifndef IF_LINT
+# ifdef lint
+# define IF_LINT(Code) Code
+# else
+# define IF_LINT(Code) /* empty */
+# endif
+#endif
+
#if HAVE_DECL_INET_NTOP
# undef inet_ntop
for (i = 0; i < NS_IN6ADDRSZ; i += 2)
words[i / 2] = (src[i] << 8) | src[i + 1];
best.base = -1;
- best.len = 0;
cur.base = -1;
+ IF_LINT(best.len = 0);
+ IF_LINT(cur.len = 0);
for (i = 0; i < (NS_IN6ADDRSZ / NS_INT16SZ); i++)
{
if (words[i] == 0)