You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
#include"test.h"externvoidf()
{
A a; // unusedVariable
}
In Cppcheck 2.4 the header will generate a syntaxError with the Windows version:
test.h:1:1: error: syntax error [syntaxError]
enum Type
^
This leads to the unusedVariable in function f() not being reported making it seems like a false negative since the syntaxError is being suppressed as it didn't occur in the file we are analyzing.
We need to make this error visible - possibly via a global warning about this.
There's most likely other errors which may lead to the same problem.
The text was updated successfully, but these errors were encountered:
This syntax error is a bug in Cppcheck. Also Cppcheck is built to being able to handle incomplete and invalid code.
There's also cases where it could be caused by a simple misconfiguration.
I came across this while working on code and trying to figure out the "false negative" of a unused variable not being reported which turned out to be this issue in the header.
I already know how to fix it but I want to get #60 in before since it simplifies things.
I am not sure if you can put links in such in messages. Being able to directly jump to the file/line in question would be awesome.
firewave
changed the title
syntaxError in include is hidden leading to suspected false negativesyntaxError in include is hidden - leading to suspected false negative
Mar 14, 2022
test.h
test.cpp
In Cppcheck 2.4 the header will generate a
syntaxError
with the Windows version:This leads to the
unusedVariable
in functionf()
not being reported making it seems like a false negative since thesyntaxError
is being suppressed as it didn't occur in the file we are analyzing.We need to make this error visible - possibly via a global warning about this.
There's most likely other errors which may lead to the same problem.
The text was updated successfully, but these errors were encountered: