Re: Squid 3.1 Static Analysis

From: Pawel Worach <pawel.worach_at_gmail.com>
Date: Sun, 10 Jan 2010 03:17:05 +0100

On Nov 7, 2009, at 08:45, Amos Jeffries wrote:

> Been playing with cppcheck this afternoon. It's the first static analyzer that I've managed to both install and use without annoying troubles.
>
> Most useful seem to be the file dumping what precompiler defines depend on what others. This can be used after a bit of cleanup to generate the component matrix the TestBed has been waiting for.
>
> Secondly is a short list of various bugs it sees in 3.1. I'm fairly sure that half of these will turn out to be false alerts. The other half may be real issues though.
>
> I've attached those for the record and in case anyone wants to fix one of the error2 problems.
>
> Just note that many of the reported memory leaks are for global objects which are leaked on restart/reconfigure/shutdown. Known problems with fixes blocked by pending code redesign. I also suspect the unused functions reported are false but thats one worth looking into anyway.

Looks like cppcheck did a much better job than clang on C++, however clang's C++ support is just maturing and the analyzer stuff is not done for C++ (but the compiler is almost self-compiling :)

I did a run on squid-2 and squid-3, most .cc files on squid-3 failed to parse (constructors with explicit template arguments not working yet). I'll monitor this and rerun a check on squid-3 when it can parse all the squid-3 source.

http://lev.vlakno.cz/~pwo/scan-build-squid-2.HEAD/
http://lev.vlakno.cz/~pwo/scan-build-squid-3.HEAD/

Also a warning that might be of interest on squid-3
cachemgr.cc:822:19: warning: using the result of an assignment as a condition without parentheses [-Wparentheses]
    } else if ( S = req->hostname)
                ~~^~~~~~~~~~~~~~~
                ( )
cachemgr.cc:822:19: note: use '==' to turn this assignment into an equality comparison
    } else if ( S = req->hostname)
                  ^
                  ==

-- 
Pawel
Received on Sun Jan 10 2010 - 02:17:19 MST

This archive was generated by hypermail 2.2.0 : Sun Jan 10 2010 - 12:00:03 MST