When --cppheck-build-dir "cache" is created without the --check-level=exhaustive first, using --check-level=exhaustive seems to have no effect and CheckLevelMaxBranches warning is still printed. Removing the "cache" dir helps. I have not tested any other order of operations, e.g. creating cache with exhaustive level first and then not using the exhaustive level option but reusing the cache directory.
What about the unused function warning? It seems to be happening a lot for Gtest tests, but des not happen always. I cannot see the pattern in yet.
This is a bit shorter and still produces the same error struct Struct { int member1; }; int main() { Struct s {}; auto& [member1] = s; member1 = 42; return 0; }
This is a bit shorter and still produces the same error #include <vector> struct Struct { std::vector<int> member1; }; int main() { Struct s; auto& [member1] = s; member1.push_back(42); return 0; }
This is a bit shorter and still produces the same error #include <vector> struct Struct { std::vector<int> member1; std::vector<int> member2; }; int main() { Struct s; auto& [member1, member2] = s; member1.push_back(42); member2.push_back(42); return 0; }
#include <vector> struct Struct { std::vector<int> member1; std::vector<int> member2; }; void f(Struct* s) { auto& [member1, member2] = *s; member1.push_back(42); member2.push_back(42); } int main() { Struct s; f(&s); return 0; } $ cppcheck --version Cppcheck 2.15.0 $ cppcheck --enable=all test.cpp --suppress=missingIncludeSystem --suppress=checkersReport Checking test.cpp ... test.cpp:5:22: style: struct member 'Struct::member1' is never used. [unusedStructMember] std::vector<int> member1; ^ test.cpp:6:22:...
#include <gtest/gtest.h> namespace Namespace { class TestClass : public testing::Test { public: std::string const ApplicationName = "TestApp"; }; TEST_F(TestClass, testCase) { ASSERT_NO_THROW(std::string(ApplicationName)); } } $ cppcheck --version Cppcheck 2.15.0 $ cppcheck --library=googletest --enable=all test.cpp Checking test.cpp ... test.cpp:1:0: information: Include file: <gtest/gtest.h> not found. Please note: Cppcheck does not need standard library headers to get proper results. [missingIncludeSystem]...
Removed comment.