From 1617567b827a345f7a2142a9b1ce5a65f632825a Mon Sep 17 00:00:00 2001 From: Waldir Pimenta Date: Wed, 28 Dec 2016 15:26:07 +0000 Subject: [PATCH] cppcheck: add page (#1212) --- pages/common/cppcheck.md | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 pages/common/cppcheck.md diff --git a/pages/common/cppcheck.md b/pages/common/cppcheck.md new file mode 100644 index 0000000000..880ab582f5 --- /dev/null +++ b/pages/common/cppcheck.md @@ -0,0 +1,32 @@ +# cppcheck + +> A static analysis tool for C/C++ code. +> Instead of syntax errors, it focuses on the types of bugs that compilers normally do not detect. + +- Recursively check the current folder, showing progress on the screen and logging error messages to a file: + +`cppcheck . 2> cppcheck.log` + +- Recursively check a given folder, and don't print progress messages: + +`cppcheck --quiet {{path/to/folder}}` + +- Check a given file, specifying which tests to perform (by default only errors are shown): + +`cppcheck --enable={{error|warning|style|performance|portability|information|all}} {{path/to/file.cpp}}` + +- List available tests, filtered by a given search pattern: + +`cppcheck --errorlist | grep "{{search pattern}}"` + +- Check a given file, ignoring specific tests: + +`cppcheck --suppress={{test_id1}} --suppress={{test_id2}} {{path/to/file.cpp}}` + +- Check the current folder, providing paths for include files located outside it (e.g. external libraries): + +`cppcheck -I {{include/folder_1}} -I {{include/folder_2}} .` + +- Check a Microsoft Visual Studio project (`*.vcxproj`) or solution (`*.sln`): + +`cppcheck --project={{path/to/project.sln}}`