removed SuppressionList::Suppression::NO_LINE#8429
Conversation
|
This is mostly likely the reason why lines are signed in Cppcheck but unsigned in simplecpp. This will be resolved in a follow-up. |
0e43d67 to
c6cd63b
Compare
|
The suppressions were using `-1` as indication that no line is used but in simplecpp `0` was used for that.
| if (s2.errorId == "unmatchedSuppression") { // TODO: handle unmatchedPolyspaceSuppression? | ||
| if ((s2.fileName.empty() || s2.fileName == "*" || s2.fileName == s.fileName) && | ||
| (s2.lineNumber == SuppressionList::Suppression::NO_LINE || s2.lineNumber == s.lineNumber)) { | ||
| (s2.lineNumber == 0 || s2.lineNumber == s.lineNumber)) { |
There was a problem hiding this comment.
I don't feel that we should have magic number 0 to mean "NO LINE".
A constant should be used that clearly says "no line".
There was a problem hiding this comment.
We have no done that anywhere in the code - simplecpp or Cppcheck.
If we would add that it would need to be added in simplecpp but that might lead to having to include simplecpp.h in every file and that is certainly undesirable.
There was a problem hiding this comment.
We can keep the constant SuppressionList::Suppression::NO_LINE but change its value from -1 to 0.
The constant is meant to be used on suppressions not tokens.
Maybe simplecpp should have some "no line" constant also. Off the top of my head I am unsure if tokens from simplecpp can have "no line"?
There was a problem hiding this comment.
The usage was inconsistent and misleading, and had nothing to do with suppressions at all as lines can only originate from simplecpp code. And adding a second constant would make things even worse.
Actually we should be using simplecpp::Location across Cppcheck instead of having an additional Location but I refrained from doing that so far because that would also cause the simplecpp.h to spill everywhere just because of of a single struct. But if we do that we could have a single "no line" constant there as well.



The suppressions were using
-1as indication that no line is used but in simplecpp0is used for that.