grundprinzip / gerrit-check

Line annotations for syntax checkers for Gerrit
Apache License 2.0
15 stars 9 forks source link

False positives on cppcheck - struct member unused #2

Closed utopalex closed 8 years ago

utopalex commented 8 years ago

Using gerrit-check, I get frequent false positives about struct members being unused, even though they are clearly being used in .cpp implementation files, and checking those files directly will not find an issue. It turns out that the way check.py includes header files for passing to cppcheck is wrong. In fact this is confirmed on http://stackoverflow.com/questions/36825903/cppcheck-claims-that-a-field-is-not-used-while-it-is-in-another-file

Header files should not be explicitly checked, but are implicitly checked. Therefore check.py, line 28 should be changed to not include .h and .hpp files.

sschuberth commented 8 years ago

Therefore check.py, line 28 should be changed to not include .h and .hpp files.

Doing that would also affect other tools than just cppcheck, so I've implemented this slightly differently in PR #3 .