bug-grep
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: avoiding warnings: one last patch


From: Paolo Bonzini
Subject: Re: avoiding warnings: one last patch
Date: Tue, 23 Mar 2010 10:44:30 +0100
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.8) Gecko/20100301 Fedora/3.0.3-1.fc12 Lightning/1.0b2pre Thunderbird/3.0.3

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




reply via email to

[Prev in Thread] Current Thread [Next in Thread]