Cppcheck: Reduction of False Positives: Manual Approach

Luke Benes lukebenes at hotmail.com
Thu Sep 13 05:59:31 UTC 2018


By manually specifying  includes and preprocessor configurations, I was able to reduce the number of warning from ~9000 to 30.

https://drive.google.com/file/d/1Ai_Zcj18cdQxVIQESb4lJr5K9LnzjnpW/view?usp=sharing

You can view it by unzipping and opening 'index.html'.Did this uncover any valid issues?

The command line used to scan our code base was:

$ cppcheck -j4 -DLINUX -D__GNUC__ -DUNX -DNDEBUG -DCORE_LITTLE_ENDIAN -D__LITTLE_ENDIAN__ -D__x86_64__ -UMACOSX -UFREEBSD -U_WIN32 -i external/ -i workdir/ --includes-file=inc.txt --xml --suppressions-list=cppcheck_supp.txt --enable=all --max-configs=100  ./  2> ./err.xml

inc.txt was generated with:
$ find . -type d \( -name "inc" -o -name "include" \) |sort > inc.txt

If this is useful, I could modify the weekly Cppcheck Report script to include these improvements. Who could set me up with permissions?

Ideally, the next step would be to extract the "DEFS": and "INCLUDE": from gbuild-to-ide and pass that to cppcheck. But that's for another time. 

-Luke


More information about the LibreOffice mailing list