Commit Graph

66 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
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 33dee83c21
moved suppression-specific code out of `ErrorLogger` (#5329) 2023-08-18 11:55:23 +02:00
chrchr-github eee1221738
Use in-class initializers, default constructors, class -> struct (#4842) 2023-08-08 11:05:02 +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 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 0ec2d84f1a
optimized suppression lookups a bit when no suppressions exist (#4839) 2023-03-03 18:37:09 +01:00
Daniel Marjamäki 464fbe8d53 Update copyright year 2023-01-28 10:16:34 +01:00
Oliver Stöneberg 8cc3e0b2ff
errortypes.h: use `enum class` instead of wrapping types into classes (#4693) 2023-01-08 19:31:54 +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 897826006e
mitigated some clang-tidy warnings in headers (#4472)
* erroritem.h: avoid `performance-no-int-to-ptr` clang-tidy warning

* suppress `readability-inconsistent-declaration-parameter-name` clang-tidy warnings for Qt signals

* tokenlist.h: mitigated `readability-make-member-function-const` clang-tidy warnings

* fixed `modernize-use-override` clang-tidy warnings in headers

* fixed `modernize-pass-by-value` clang-tidy warnings in headers

* tokenize.cpp: avoid unnecessary copy
2022-09-16 18:59:15 +02:00
Oliver Stöneberg 14421ae627
fail `run-clang-tidy` in case of compiler warnings / fixed Clang warnings / cleanups (#4036) 2022-05-15 12:42:29 +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
chrchr-github ee4d90b4fa
Refactor: fix member shadowing, return by const ref (#3407) 2021-08-21 22:00:45 +02:00
Paul Fultz II 7f358b2bed
Format with uncrustify (#3388) 2021-08-07 20:51:18 +02:00
Daniel Marjamäki 42437277dc Update Copyright year 2021-03-21 20:58:32 +01:00
PKEuS 141d2ac215 Refactorization: Improved internal implementation of severity and certainty levels
Backported from LCppC.
2021-02-24 22:00:06 +01: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 63e08689c1 Fix Cppcheck warning 2020-10-02 19:35:24 +02:00
Daniel Marjamäki ea3a9d658a Suppressions: Add special case for backwards compatibility. suppression comment after a {. 2020-10-02 18:56:26 +02:00
Daniel Marjamäki 4ab04db53c Rename 'cppcheckID' to 'hash' 2020-07-21 11:27:03 +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
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
orbitcowboy c98c7a2ebf suppressions: Avoid duplicate comparison. 2018-10-04 17:13:11 +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 37bcec8804 Renamed _fileName 2018-06-17 08:19:10 +02:00
Daniel Marjamäki 8d66eecf47 Renamed _suppressions to mSuppressions 2018-06-17 08:16:37 +02:00
Daniel Marjamäki 45379a3aa6 Updated copyright year for modified files
[ci skip]
2018-06-10 22:07:21 +02:00
amai2012 f947b3b025 Fix some doxygen warnings 2018-06-07 08:33:32 +02:00
Alexander Mai fe1b1d537e Fix compiler warning by useless semicolon 2018-05-16 21:33:26 +02:00
Daniel Marjamäki 1e7c1841f7 Fixed #8515 (Wrong info message about unmatched suppression) 2018-05-11 09:01:24 +02:00
rebnridgway 995b496ddf Add suppressions to the XML dump (#1166)
* Added parsing suppressions from dump xml.

* Added code to dump suppressions to an xml file

* Added declaration for dump function

* Suppressions will now be written to the xml file when a dump is requested

* Fixed syntax error

* Removed excess whitespace

* Fixed indentation to be consistent

* Fixed indentation to be consistent

* Fixed indentation to be consistent

* Added missing include for ErrorLogger::toXml

* Fixed suggestions from pull request #1166

Switched to using ranged for loop to iterate through suppressions.
Made the line number attribute optional, rather than 0 if not specified.  This means when Python deserialises it it will be None, which is more pythonic.

* Implemented checking suppressions in reportError

This modification expects suppressions and a function to be called to write a line of output to be passed in.  The function checks if any of the suppressions match the warning (with the new Suppression.isMatch function) and if so returns None.  This change maintains the old behaviour of returning the warning text, but adds the possibility of returning None if the warning was suppressed.

* Fixed code quality warnings

* Removed more extraneous whitespace
2018-04-24 22:19:24 +02:00
Simon Martin 5c1540915d Fix warning emitted by clang. (#1173) 2018-04-15 20:40:24 +02:00
Daniel Marjamäki a0c9de0048 Suppressions: Validate inline suppressions 2018-04-11 08:18:00 +02:00
Daniel Marjamäki a0906140a6 Suppressions: New extensible Suppressions xml format that allow more attributes. To start with it also allows symbolName. 2018-04-09 06:43:48 +02:00
Daniel Marjamäki c4caee6b18 Updated copyright year 2018-01-14 15:37:52 +01:00
Ayaz Salikhov 28aa939d69 iwyu - include what you use 2017-05-27 04:33:47 +02:00
Lauri Nurmi 996c9244d8 Update copyright year to 2007-2016. 2016-01-01 15:34:45 +02:00
Daniel Marjamäki 0f9d90d2be Changed Copyrights. Removed my name. 2015-11-18 20:04:50 +01:00
Thomas Jarosch ec21134817 Fix false negatives for local suppressions
Introduce a new bool setting jointSuppressionReport
that will be set by the analyseWholeProgram() code path.

When the flag is enabled, unmatched suppressions are
collected after running the final whole program analysis
to prevent false positives for the unusedFunction check.

The check functions in the unit test
for single / multi file suppressions were unified.
2015-01-20 18:47:30 +01:00