[cfe-dev] uninitialized variable warning, etc

Chris Lattner clattner at apple.com
Fri Mar 6 23:14:57 PST 2009


On Mar 6, 2009, at 2:11 PM, Eli Friedman wrote:

> On Thu, Mar 5, 2009 at 6:36 PM,  <rdogra at earthlink.net> wrote:
>> test.c: In function ‘main’:
>> test.c:8: warning: format ‘%s’ expects type ‘char *’, but argument 2
>
> There's a TODO in the code to add this check.
>
>> has type ‘int’
>> test.c:7: warning: ‘b’ is used uninitialized in this function
>
> clang doesn't have a warning like this as part of the default
> compilation process, at least for the moment.  There is a separate
> analysis module which prints warnings like this, though; see
> http://clang.llvm.org/StaticAnalysis.html.

Right, note that GCC only produces "dataflow warnings" when  
optimizations are enabled though.

>> libavcodec/dsputil.c:3966:10: warning: use of unary operator that may
>> be intended as compound assignment (-=)
>
> This warning triggers on a lot of stuff... we should probably disable
> it by default.

What sorts of cases does it trigger on that are false positives?

-Chris



More information about the cfe-dev mailing list