Done: https://github.com/danmar/simplecpp/pull/362
I have found the place in the code that needed to be fixed(in simplecpp), and here is my rough fix that I'm sure that is not clean (uncomment commented lines to see the difference between absolute/non-absolute paths that are consider to be different): diff --git externals/simplecpp/simplecpp.cpp externals/simplecpp/simplecpp.cpp index 47bb78f8cf17..a418b379b203 100755 --- externals/simplecpp/simplecpp.cpp +++ externals/simplecpp/simplecpp.cpp @@ -42,6 +42,8 @@ #ifdef SIMPLECPP_WINDOWS #include <windows.h>...
I noticed that header path resolving, to not including "#pragma once" header twice, isn't working by comparing full paths. For example, if I have a file "dir/a.h": #pragma once //... And "dir/a.cpp": #include "dir/a.h" #include "a.h" Then when I run cppcheck -I$PWD dir/a.cpp, cppcheck includes the "dir/a.h" twice - path resolving works, but fullpath comparing doesn't, so that the #pragma once comment doesn't avoid the header to be included twice. I believe that the algorithm for #pragma once resolution...
I also cannot reproduce it now
That's overall sounds great. Notice that clang static analyzer have similar semantics on CLI. I thought that "--check-ctu" can point to the "%.snalyzerinfo" files generated in the build dir.
This is a bug (or at least, a missing feature), that cppcheck ignores "-I."(i.e. including current dir) but process "-I$(pwd)". This bug is very annoying because our compile_commands.json file contains "-I.". Note: Clang supports "-I.", and I think that also GCC
Weird... I was testing this privately in V2.14, and the online demo with this toy example is V2.10. I will try to check this in a more updated version.
I have been able to reproduce an error happened in our company with this checker. Using the online demo (https://cppcheck.sourceforge.io/demo/), for this code that declare the two nested structs A::Foo and B::Foo, cppcheck seems to be confused about the definition of Foo: #include <vector> #include <iostream> Class A { public: struct Foo { int a; int z; }; void foo_adder(); void print_all() { for (const auto& foo : m_foos) { std::cout << foo.a << foo.z << std::endl; } } private: std::vector<Foo>...