GSoC/GCI Archive
Google Code-in 2012 BRL-CAD

Fix 20+ LLVM clang static analysis defects

completed by: Cezar

mentors: Sean

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.