Subject: bug#17336: [PATCH] grep: warning to be uninitialized with -Wall

From: Paul Eggert <[email-masked]>
Date: Thu, 24 Apr 2014 21:52:59 -0700

Norihiro Tanaka wrote:
> I can't find any reasons that `accept' variable should be uninitialized.

Two reasons.  First, if we add initialization to the source, that might 
cause some compilers to generate less-efficient code.  More important, 
adding initialization might cause some human readers of the code to 
become confused, and to think that the initialization is necessary.

If you're using -Wall, I suggest configuring with './configure 
--enable-gcc-warnings', as that should avoid the problem.

Come to think of it, perhaps we should get rid of the '#ifdef lint' code 
here, as in the attached patch.  These days GCC is smart enough to 
figure this stuff out without that code, if one uses 
--enable-gcc-warnings.  This works for me with GCC 4.9.0 and with GCC 
4.8.2.  --enable-gcc-warnings is intended for relatively-recent GCC 
versions; we needn't worry about supporting old versions.
diff --git a/src/kwset.c b/src/kwset.c
index f86ee03..617db2f 100644
--- a/src/kwset.c
+++ b/src/kwset.c
@@ -630,10 +630,6 @@ cwexec (kwset_t kwset, char const *text, size_t len, struct kwsmatch *kwsmatch)
   struct tree const *tree;
   char const *trans;
 
-#ifdef lint
-  accept = NULL;
-#endif
-
   /* Initialize register copies and look for easy ways out. */
   if (len < kwset->mind)
     return -1;