Clang, which use LLVM infrastructure, is a compiler for the C language family. His goal is to offer a moder alternative to GCC. With Clang come a pretty cool static analyser. Here is how to use it for Gimp.
A small disclaimer before, I shamefully copied and adapted the procedure given by Campbell Barton, form the Blender team. (http://wiki.blender.org/index.php/User:Ideasman42/BlenderClang).
I first tried the LLVM provided by ArchLinux, but the compilation ended with a fatal error. It goes flawlessly with the development version. To fetch it, Campbell Barton’s script works well.
First, we need to add LLVM’s binary to the PATH:
The only difference with a classic GCC compilation, is that we explicitly ask to use Clang’s compiler:
If you just want to compile, the procedure doesn’t change.
If you want to run a static analyse, you have to use scan-build:
Just be aware that a static analyse will take a lot of time (3h40 with my Core 2 Duo E4500).
The static analyzer of Clang will probably find a lot of bug in the code. Yes, there is false positive, but it’s globally remarkably well done ! You can find here the result of the analyse of master i did today: http://pellelatarte.fr/dawa/gimp-llvm/