Commit Graph

94 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 06b5ef1e4d
cleaned up includes based on include-what-you-use (#5532) 2023-10-09 10:07:20 +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
Oliver Stöneberg 33dee83c21
moved suppression-specific code out of `ErrorLogger` (#5329) 2023-08-18 11:55:23 +02:00
Oliver Stöneberg 3cf9100198
fixed #6316 (Use std::to_string() in place of MathLib::toString() ...) - deleted default implementation of `Mathlib::toString()` (#5341)
It was also used inconsistently and seemed to imply there is some
special handling which wasn't the case. It was just an alias for
`std::to_string()` for non-`double` types. So there was no need for it.

---------

Co-authored-by: Robert Reif <reif@earthlink.net>
2023-08-17 16:46:32 +02:00
Oliver Stöneberg 45de338f1b
cleaned up includes based on include-what-you-use / iwyu.yml: updated to yet another distro to get the latest version and updated the Chaotic-AUR key (#5267)
This is a mess. The version is AUR is still outdated and also doesn't
install anymore. Fedora 38 carries the latest version of it so use that
now. Keep the old steps in case we need to switch again in the future.
2023-08-02 10:36:17 +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 f5e51eace7
do not use string-to-integer conversions without error handling (#4906) 2023-04-08 22:29:09 +02:00
Oliver Stöneberg 0ec2d84f1a
optimized suppression lookups a bit when no suppressions exist (#4839) 2023-03-03 18:37:09 +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
Daniel Marjamäki 464fbe8d53 Update copyright year 2023-01-28 10:16:34 +01:00
Oliver Stöneberg 40a69e5afb
optimized deserializing of `ErrorMessage` and related main process code (#4610) 2022-12-09 19:34:51 +01: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 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 45158ec064
cleaned up includes based on include-what-you-use (#4007)
* cleaned up includes based on include-what-you-use

* updated translations
2022-04-13 12:24:00 +02:00
Oliver Stöneberg 25ef9eeb26
use std::string::empty() (#3910) 2022-04-09 19:02:37 +02:00
Jens Yllman 34a11c1673
Fix unmatched suppression (#5704) (#3886) 2022-03-30 19:24:53 +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 ba402f3e50
cleaned up includes based on include-what-you-use (#3627) 2021-12-15 19:47:27 +01:00
Daniel Marjamäki 08f9de95e2 Update copyright year 2021-09-26 11:34:56 +02:00
chrchr-github ee4d90b4fa
Refactor: fix member shadowing, return by const ref (#3407) 2021-08-21 22:00:45 +02:00
Daniel Marjamäki 88a35d2253 Fix CodeQL warning, Multiplication result converted to larger type 2020-11-06 19:50:05 +01:00
Jesse Boswell f70e8de315
Fix #9567 (Inline suppression of unusedFunction errors not working when using compile database) (#2870) 2020-11-04 21:01:48 +01:00
Daniel Marjamäki ea3a9d658a Suppressions: Add special case for backwards compatibility. suppression comment after a {. 2020-10-02 18:56:26 +02:00
eivindt 27e40af06c
Add support for comments at end of suppression in suppression files (#2736) 2020-08-20 21:49:07 +02:00
Jens Yllman 10ac0bcf54 changed variable name to match guidelines 2020-07-29 12:13:21 +02:00
Jens Yllman 62f5f248be use simplifyPath() to make sure file name is same as in the checks 2020-07-28 22:19:27 +02:00
Daniel Marjamäki 4ab04db53c Rename 'cppcheckID' to 'hash' 2020-07-21 11:27:03 +02:00
Daniel Marjamäki 118e9eb3e2 Better handling of CppcheckID suppressions 2020-07-16 15:27:23 +02:00
Daniel Marjamäki 6ab4f39f52 GUI: Suppress cppcheck-id 2020-07-15 13:03:07 +02:00
Daniel Marjamäki 08ddd84780 Update copyright year 2020-05-10 11:16:32 +02:00
Daniel Marjamäki 3e0218299b Revert "Update copyright year"
This reverts commit 6eec6c4bd5.
2020-05-10 11:13:05 +02:00
Daniel Marjamäki 6eec6c4bd5 Update copyright year 2020-05-10 11:11:34 +02:00
Oliver Stöneberg 2c1e36e63e
cleaned up includes based on include-what-you-use (#2600)
* cleaned up includes based on include-what-you-use

* check.h: trying to work around Visual Studio 2012 bug

* fixed Visual Studio compilation
2020-04-13 13:44:48 +02:00
Daniel Marjamäki 4f9a0b8420 Refactoring suppressions 2020-02-23 19:49:53 +01:00
Daniel Marjamäki 5ed5bf935f astyle formatting
[ci skip]
2020-02-23 18:04:47 +01:00
ghking 5479c7340b
a new method to declare inline suppress which is more readable and more convenient. (#2533) 2020-02-23 18:04:24 +01:00
Aleksandr Serbin 11993ed999 Ticket 5607: Allow to exclude folders with glob pattern (#2498) 2020-01-24 07:06:09 +01:00
Daniel Marjamäki 0a41f1ad6b Fix Cppcheck warning: Suppressions::dump can be const 2019-06-29 07:53:32 +02:00
Daniel Marjamäki bd7790fd8c Update copyright year 2019-02-09 07:24:06 +01:00
Daniel Marjamäki 1cd16cf94f Suppressions: Handle comment in file that starts with # 2019-01-12 15:21:47 +01:00
Daniel Marjamäki 7db671fee6 Suppressions::NO_LINE : fixed comparisons 2018-09-23 16:50:51 +02:00
shikamu 83cb0b3394 --suppress on line 0 (#1354)
Fixed --suppress on line 0
2018-09-18 12:58:14 +02:00
Daniel Marjamäki e442bc47b1 astyle formatting
[ci skip]
2018-08-17 19:55:21 +02:00
Konrad Grochowski 0e70c8a916 Added '-' and '.' to allowed chars in error ids for suppressions. (#1338)
Those chars are used for example in misra.py
2018-08-17 08:20:39 +02:00
Daniel Marjamäki 518dd8bfa3 Refactoring: Use range for loops 2018-07-15 14:51:33 +02:00