When disable check-header, cppcheck attempts to "simplify" the content of the header by keeping only the declaration of functions/classes and remove definition... With the example below, seems like cppcheck removes sth that shouldn't be removed?
main.h
namespace ns { class Object; class foo { private: int i; public: int Get() { return i; } }; }
main.cpp
#include "main.h" int main() { return 0; }
--debug
##file main.h 2: namespace ns { 3: class Object ; 4: | 13: 14: } ##file main.cpp 1: 2: 3: 4: int main ( ) { 5: 6: return 0 ; 7: } ##Value flow Line 6 0 always 0
.cppcheck file
<?xml version="1.0" encoding="UTF-8"?> <project version="1"> <platform>win64</platform> <analyze-all-vs-configs>false</analyze-all-vs-configs> <check-headers>false</check-headers> <check-unused-templates>false</check-unused-templates> <max-ctu-depth>5</max-ctu-depth> <max-template-recursion>5</max-template-recursion> </project>
class foo wasn't used, so cppcheck simply removes the entire class definition... This is not a bug and this post can be ignored
Log in to post a comment.
When disable check-header, cppcheck attempts to "simplify" the content of the header by keeping only the declaration of functions/classes and remove definition... With the example below, seems like cppcheck removes sth that shouldn't be removed?
main.h
main.cpp
--debug
.cppcheck file
Last edit: Charles-the-intern 2022-11-08
class foo wasn't used, so cppcheck simply removes the entire class definition... This is not a bug and this post can be ignored