Wouldn't this implicitly disable cppcheck for the other paths (Q_OS_UNIX and Q_OS_WIN) for the hole project?
If I want to avoid this, maybe I could “--inline-suppr” and manually suppress this single warning for this line of the code? This might the better choice for me because I have only one offending line with a theoretically possibly empty container, but I have much more lines in the different code paths which could profit from cppcheck.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Consider the following code:
ifdef Q_OS_DARWIN
elif defined(Q_OS_UNIX)
elif defined(Q_OS_WIN)
endif
cppcheck now complains:
"Iterating over container 'candidates' that is always empty. (CWE-398)"
However, 'candidates' is not empty for at least many platforms.
Lukas Sommer
Have you considered passing e.g.
-DQ_OS_DARWIN
to cppcheck?Wouldn't this implicitly disable cppcheck for the other paths (Q_OS_UNIX and Q_OS_WIN) for the hole project?
If I want to avoid this, maybe I could “--inline-suppr” and manually suppress this single warning for this line of the code? This might the better choice for me because I have only one offending line with a theoretically possibly empty container, but I have much more lines in the different code paths which could profit from cppcheck.