On 03/23/2010 10:05 AM, Jim Meyering wrote:
Testing with other versions of gcc, I encountered these warnings from gcc-4.1.2 (mapped to error with -Werror):cc1: warnings being treated as errors dfa.c: In function 'lex': dfa.c:467: warning: 'wc' may be used uninitialized in this function dfa.c:463: warning: 'c' may be used uninitialized in this function dfa.c:467: warning: 'wc2' may be used uninitialized in this function dfa.c:467: warning: 'wc1' may be used uninitialized in this function dfa.c:463: warning: 'c2' may be used uninitialized in this function make[2]: *** [dfa.o] Error 1 And in a way, they seem legitimate, assuming that older gcc doesn't recognize "error (EXIT_TROUBLE, ..." as something that resolves to exit (EXIT_TROUBLE). The clang static analyzer makes the same "mistake" in reporting a false-positive "used-uninitialized" warning, so I wrote the following patch, which is sufficient to teach both clang and gcc-4.1.2 enough that they no longer give FP warnings. It's risky to do *anything* this close to release, but I've confirmed this solves the problem and everything still builds on numerous systems, so unless someone points out a problem very soon, I'll push it and it will be included in grep-2.6.
Yes, good idea. Paolo
