Commit Graph

585 Commits

Author SHA1 Message Date
Daniel Marjamäki dd76504f82
Fixed #3537 (Allow inline suppression comments for macros) (#5559) 2023-10-16 19:43:15 +02:00
Daniel Marjamäki ec15772381
Refactoring suppressions code. (#5550) 2023-10-13 19:57:08 +02:00
Johan Bertrand 44ab976451
Inline suppression for block of code or whole file (#5402)
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/11902
https://trac.cppcheck.net/ticket/8528
2023-10-13 12:45:13 +02:00
Oliver Stöneberg 639a4131c4
changed `bool_to_string()` to return `const char*` instead and use it in more cases (#5385) 2023-09-11 11:34:22 +02:00
Oliver Stöneberg 91070ca794
utils.h: added `startsWith()` and started using it (#5381)
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.
2023-09-08 19:30:25 +02:00
Daniel Marjamäki 9d6449cc44
dump file: fix xml format error in <macro> (#5095) 2023-05-30 14:51:11 +02:00
Oliver Stöneberg a77ab9759c
Suppressions: some cleanups (#4980)
* 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
2023-05-04 18:15:18 +02:00
Oliver Stöneberg c249cc9098
avoid redundant `simplecpp::Output::type` switch blocks (#5005)
* avoid redundant `simplecpp::Output::type` switch blocks

* fixed `useStlAlgorithm` warnings
2023-04-28 15:37:59 +02:00
Oliver Stöneberg db955a13a9
moved test-only `Preprocessor::getcode()` out of `lib` (#4993) 2023-04-22 10:22:00 +02:00
Oliver Stöneberg ad464c4feb
Preprocessor: relaxed dependency on `Suppressions` (#4983)
* 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
2023-04-21 10:14:34 +02:00
Oliver Stöneberg 5be8eee943
iwyu.yml: use a distro which has the latest `include-what-you-use` / enabled Qt mappings / cleaned up includes (#4885) 2023-04-08 16:08:47 +02:00
Oliver Stöneberg 901b2ab838
Preprocessor: provide suppressions separately from settings (#4878) 2023-03-09 20:15:53 +01:00
Oliver Stöneberg 7fd4118d60
Fix #10039 (integrate `--check-config` include findings with normal analysis) / also fixes #11283 (#3229) 2023-03-04 09:02:35 +01:00
Oliver Stöneberg 5af6ca6637
made `Platform` a member of `Settings` instead of inheriting from it / cleanups (#4791) 2023-03-03 18:36:27 +01:00
Oliver Stöneberg b70e1d5461
avoid some unchecked pointer dereferences (#4811) 2023-03-02 22:05:41 +01:00
Oliver Stöneberg 381361629e
Preprocessor: removed unreachable `ConfigurationNotChecked` finding (#4790) 2023-03-02 21:50:57 +01:00
Paul Fultz II 346ecdb53a
Improve valueflow after pushing to container (#4803) 2023-02-23 18:05:31 +01:00
Oliver Stöneberg 8ef14dad98
fixed and enabled `performance-faster-string-find` clang-tidy warning (#4769) 2023-02-08 21:01:51 +01:00
Oliver Stöneberg 4d9caa99f3
improved testing of missing includes / made it possible to clear the include cache in simplecpp (#4704) 2023-02-07 22:02:12 +01:00
Daniel Marjamäki 464fbe8d53 Update copyright year 2023-01-28 10:16:34 +01:00
Oliver Stöneberg 1cfe49e340
use `const_iterator` where possible (#4662) 2022-12-30 15:13:47 +01:00
Oliver Stöneberg 3c68b9b29f
use `cbegin()` and `cend()` with `const_ierator` loops (#4658) 2022-12-20 20:32:16 +01:00
Oliver Stöneberg 40a69e5afb
optimized deserializing of `ErrorMessage` and related main process code (#4610) 2022-12-09 19:34:51 +01:00
chrchr-github 3273e51fd5
Fix #10412 FN useStlAlgorithm with iterators (#4157) 2022-10-16 13:46:26 +02:00
Oliver Stöneberg cff1cd9cda
applied clang-tidy `misc-const-correctness` fixes for POD types, iterators and references (#4529)
* applied `misc-const-correctness` fixes for POD types and iterators

* applied `misc-const-correctness` fixes for references
2022-10-02 07:12:40 +02:00
Oliver Stöneberg d6f1d7bb23
replaced `static const`/fixed `std::vector` containers with `std::array` (#4440) 2022-09-27 20:06:15 +02:00
Oliver Stöneberg b3ec225480
iwyu.yml: use `debian:unstable` to always get latest include-what-you-use / cleaned up includes (#4466)
* 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
2022-09-16 07:15:49 +02:00
Oliver Stöneberg 76d1b9f31a
avoid unnecessary copies with `emplace_back()` (#4450)
* avoid unnecessary copies with `emplace_back()`

* cmdlineparser.cpp: suppress `accessMoved` selfcheck false positives
2022-09-10 11:25:15 +02:00
Oliver Stöneberg d46ea7ba86
avoid unnecessary copies with `push_back()` and `push_front()` (#4451) 2022-09-08 09:21:35 +02:00
Oliver Stöneberg 16f598c409
added missing `sstream` includes (#4381) 2022-08-19 10:16:23 +02:00
Oliver Stöneberg 98b9f2cbf1
reduced scope of some variables and avoided some copies (#4328) 2022-08-16 22:28:39 +02:00
Oliver Stöneberg 4bf5dcd29f
cleaned up includes based on include-what-you-use (#4358)
* cleaned up includes based on include-what-you-use

* testlibrary.cpp: no need for `empyString` optimization
2022-08-14 12:44:19 +02:00
Oliver Stöneberg 156323c95e
avoid unnecessary copies with `insert()` (#4323) 2022-08-07 19:31:16 +02:00
Oliver Stöneberg efaaa58896
fixed some `modernize-use-emplace` false negatives and some `bugprone-assignment-in-if-condition` warnings (#4311) 2022-07-28 22:53:59 +02:00
Oliver Stöneberg b65b47d3a8
enabled and fixed `modernize-pass-by-value` clang-tidy warnings (#4169) 2022-07-28 22:51:45 +02:00
Oliver Stöneberg d6eb3a8f40
some changes for clang/clang-tidy 15 (#4310) 2022-07-26 15:30:53 +02:00
Oliver Stöneberg c9c1f83a69
use `emptyString` more consistently (#4034) 2022-07-10 10:57:29 +02:00
Oliver Stöneberg c36320747f
some `missingInclude`/`missingIncludeSystem` fixes and tests (#4027)
* 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
2022-07-09 23:21:11 +02:00
Daniel Marjamäki b888f9cf92 use hash instead of checksum to check if content is changed 2022-07-07 12:16:01 +02:00
PKEuS 4bd189c3c8
Refactorization: Faster calculation of CRC32 by avoiding to create a temporary string. Use proper types in checksum functions. (#4180)
Merged from LCppC
2022-06-08 16:55:06 +02:00
Oliver Stöneberg d36e05af28
enabled and fixed `modernize-use-emplace` clang-tidy warnings (#4165)
* enabled and fixed `modernize-use-emplace` clang-tidy warnings

* avoid unnecessary creation of temporaries in `emplace_back()` calls
2022-06-03 15:09:29 +02:00
chrchr-github 7fbb9c7c13
Fix #10980 FN constVariable with range-based for loop (#4144)
* Fix #10980 FN constVariable with range-based for loop

* Format

* nullptr check

* Restrict scopes

* Add const

* Undo

* Add more const
2022-05-29 17:06:33 +02:00
Oliver Stöneberg 8f728cb4b6
added (partial) support for specifying C++23 and support more "-std" options (#3212) 2022-04-15 16:17:36 +02:00
Daniel Marjamäki 3989408738 Update copyright year 2022-02-05 11:45:17 +01:00
Oliver Stöneberg 171da2e6f9
avoid dependency on transitive includes - based on include-what-you-use (#3757) 2022-01-27 19:03:20 +01:00
Oliver Stöneberg 0ba9cb4e64
fixed some unusedFunction warnings (#3618) 2022-01-04 15:48:08 +01:00
chrchr-github 05acc13582
Shadow variables, const, rename function (#3456) 2021-09-15 20:28:58 +02:00
Paul Fultz II 7f358b2bed
Format with uncrustify (#3388) 2021-08-07 20:51:18 +02:00
Daniel Marjamäki 74ab8f1a48 misra; implemented rule 20.8 2021-07-22 08:46:28 +02:00
Daniel Marjamäki 140aa6afb4 Preprocessor; do not write macro usage in dump output if it is empty 2021-07-08 16:53:25 +02:00