As reported in
https://sourceforge.net/p/cppcheck/discussion/general/thread/fa43fb8ab1/
removeContradiction() minValue/maxValue.remove(..) can access free'd
memory as it removes all matching values by iterating over the complete
list. Creating a full copy instead of a reference avoids this issue.
Signed-off-by: Dirk Müller <dirk@dmllr.de>
Added new suppress comments:
- `cppcheck-suppress-begin` and `cppcheck-suppress-end` to remove blocks
of suppression
- `cppcheck-suppress-file` to remove suppression at file level
The suppressions do not interfere with each others. For example, all the
suppressions are matched in the following code:
```c
// cppcheck-suppress-file uninitvar
void f() {
int a;
// cppcheck-suppress-begin uninitvar
// cppcheck-suppress uninitvar
a++;
// cppcheck-suppress-end uninitvar
}
```
Tickets:
https://trac.cppcheck.net/ticket/11902https://trac.cppcheck.net/ticket/8528
This makes the code much more readable. It also makes it less prone to
errors because we do not need to specify the length of the string to
match and the returnvalue is clear.
The code with the bad returnvalue check was never executed and I added a
test to show that.
* Suppressions: merged `isSuppressedLocal()` into `isSuppressed()`
* avoid some unnecessary copies when adding suppressions
* TestSuppressions: improved readability of multiple line string literals
* supressions.h: got rid of unnecessary copy and assignment operators for `Suppressions::Suppression` - fixes `performance-move-const-arg` clang-tidy warning
* TestSuppressions: cleaned up a variable construction
* Preprocessor: cleaned up `missingInclude()`
* Preprocessor: relaxed dependency on `Suppressions` / adjusted `TestPreProcessor::inline_suppression_for_missing_include()` which was not testing production behavior
* test/cli/test-other.py: added test for `missingInclude` and `missingIncludeSystem` inline suppressions
* fixed `constParameterReference` selfcheck warning
* iwyu.yml: use debian:unstable to always get latest include-what-you-use
* cleaned up includes based on include-what-you-use
* mitigated include-what-you-use false positives
* do not emit `missingInclude` and `missingIncludeSystem` errors when not enabled / fixed and improved TestPreprocessor::inline_suppression_for_missing_include()
* testpreprocessor.cpp: added missing tests for `missingInclude` and `missingIncludeSystem`
* cppcheckexecutor.cpp: `missingIncludeSystem` was not emitted in normal analysis if `missingInclude` existed
* dmake
* added `run-dmake` as `testrunner` dependency