Fix 20+ LLVM clang static analysis defectsBRL-CAD
Status: ClosedTime to complete: 48 hrs Mentors: SeanTags: C, C++, llvm, clang, static analysis, fix bugs

This task involves running the LLVM Clang static analysis tool that reports defects in source code:

svn co https://brlcad.svn.sf.net/svnroot/brlcad/brlcad/trunk brlcad
cd brlcad
mkdir .build
cd .build
CC=clang CXX=clang++ scan-build cmake .. -DBRLCAD_BUNDLED_LIBS=ON
cd src/other
make -j9
cd ../../
scan-build make   (may be able to use -j flag here as well, haven't tried yet)

scan-build: 3147 bugs found.
scan-build: Run 'scan-view /tmp/scan-build-2012-11-29-4' to examine bug reports.

scan-view /tmp/scan-build-2012-11-29-4

Once you run the static analysis, fix 20 or more of the defects listed.  Submit your changes as a single patch file, make sure to test compilation, and re-run the static analysis to make sure they're really fixed.  See http://brlcad.org/wiki/Deuces for help getting started.

It's often easier and faster to fix entire files or types of defects at once.  If you do this and find yourself spending more than a few hours, let us know and we'll consider creating additional follow-up tasks.

Uploaded Work
File name/URLFile sizeDate submitted
llvm_analyzer_fixes.patch15.9 KBDecember 26 2012 04:23 UTC
Comments
Cezaron December 25 2012 06:33 UTCTask Claimed

I would like to work on this task.

Andrei Popescu on December 25 2012 12:43 UTCTask Assigned

This task has been assigned to Cezar. You have 48 hours to complete this task, good luck!

Cezaron December 26 2012 04:23 UTCReady for review

The work on this task is ready to be reviewed.

Sean on December 26 2012 19:01 UTChow long?

Cezar, roughly how long did it take to fix that many?


 

Sean on December 26 2012 19:01 UTCTask Closed

Congratulations, this task has been completed successfully.

Cezaron December 26 2012 19:05 UTCHow long

Well... running `make` with `scan-build` is painful. It took about two and a half hours for 80% of the project without the docs, and I had to do it before and after the fixes. Fixing the actual errors took somewhere between two and three hours.

Sean on December 29 2012 06:17 UTCthanks

Thanks Cezar, that's good to know and is roughly on-par with what I estimated.  The build time is something we can't account for since different hardware and build settings will greatly affect how long a compile takes.


Note that there are several other fix-clang-issues tasks if you're interested. ;)


Thanks again!