Basically just run `scan-build make` instead of `make`.
Note that in order for it to check anything you need to override the compiler variables to use c**-analyzer like I've done when calling cmake above. FIrst of all, this is sort of mentioned in the documentation, but they don't give any examples so I didn't get it to work properly until after a colleague explained it to me. Secondly, the location of the analyzers might differ from platform to platform, the example above is where they are located on Arch. (Looks like it is in /usr/share/clang/scan-build/c++-analyzer on Debian-based platforms.)
After you've successfully run `scan-build make` it will tell you how many issues it found, which directory it stored the report it and how to view the report in your favorite browser (`scan-view directory`).
Protip: if it runs through the compilation, but at the end tells you it didn't find any issues and deletes the directory containing the report, it's likely misconfigured somehow. At least in my experience. ^^
How to run scan-build on the code (along with explanation/ caveats) :
cmake $WL_SOURCE \ BUILD_TYPE= Debug \ C_COMPILER= /usr/lib/ clang-analyzer/ scan-build/ ccc-analyzer \ CXX_COMPILER= /usr/lib/ clang-analyzer/ scan-build/ c++-analyzer \
-DCMAKE_
-DWL_PORTABLE=true \
-DCMAKE_
-DCMAKE_
&& scan-build make
Basically just run `scan-build make` instead of `make`.
Note that in order for it to check anything you need to override the compiler variables to use c**-analyzer like I've done when calling cmake above. FIrst of all, this is sort of mentioned in the documentation, but they don't give any examples so I didn't get it to work properly until after a colleague explained it to me. Secondly, the location of the analyzers might differ from platform to platform, the example above is where they are located on Arch. (Looks like it is in /usr/share/ clang/scan- build/c+ +-analyzer on Debian-based platforms.)
After you've successfully run `scan-build make` it will tell you how many issues it found, which directory it stored the report it and how to view the report in your favorite browser (`scan-view directory`).
Protip: if it runs through the compilation, but at the end tells you it didn't find any issues and deletes the directory containing the report, it's likely misconfigured somehow. At least in my experience. ^^
Let me know if you run into any trouble.
See also http:// clang-analyzer. llvm.org/ scan-build. html for more info