Commit Graph

26413 Commits

Author SHA1 Message Date
jalegido 5628a39b82
Update mfc.cfg with more MFC macros (#4548)
* Update mfc.cfg

MFC macros

* Update mfc.cfg

Remove RUNTIME_CLASS beacuse produce this error:
Syntax Error: AST broken, binary operator '=' doesn't have two operands.

Co-authored-by: jjll <jjll@gmv.com>
2022-10-15 08:23:28 +02:00
chrchr-github 6c24d2b865
Fix #11321 FP uninitvar for in-class member initialization (#4547) 2022-10-14 19:48:27 +02:00
chrchr-github 544ec38ca9
Add test for #2490 (#4551) 2022-10-14 11:55:45 +02:00
Daniel Marjamäki b8b6be48d9 Fixed #9926 (False positive assertWithSideEffects, calling method that has no side effects) 2022-10-12 07:51:50 +02:00
Daniel Marjamäki 3e16367a97 AUTHORS: Add gerboengels 2022-10-11 22:02:56 +02:00
Daniel Marjamäki 2a81388c95 Fixed #11102 (False positive: unreadVariable when union in derived struct is used) 2022-10-11 20:47:07 +02:00
Oliver Stöneberg ca9747cf7d
address most Node.js 12 deprecation warnings in GitHub workflows (#4546) 2022-10-11 19:50:59 +02:00
chrchr-github c51fb3864a
Add test for #10801 (#4544) 2022-10-11 07:23:28 +02:00
Daniel Marjamäki 584a428025 Fixed #10831 ("Analysis failed (lambda not recognized)" with lamba default parameter in lambda signature) 2022-10-10 21:05:48 +02:00
gerboengels ed06e29f7a
Fix defaulted and deleted functions (#4540)
* Fix 9392, but for destructors: out-of-line defaulted destructors skipped everything after

Context:
```
struct S {
    ~S();
};

S::~S() = default;

void g() {
    int j;
    ++j;
}
```
Everything after `S::~S() = default;` was skipped, so the uninitialized variables in g() weren't found.

Out-of-line destructors are useful e.g. when you have a forward declared unique_ptr in the .h,
and `= default` the destructor in the .cpp, so only the cpp needs to know the header for destructing
your unique_ptr (like in the pImpl-idiom)

* Fix unit test, by correctly fixing 10789

Previous commit broke this test, but also provided the tools for a cleaner fix

* Document current behaviour

* Rewrite control flow

* Fix deleted functions, which skipped everything after

`a::b f() = delete` triggered the final else in SymbolDatabase::addNewFunction,
which sets tok to nullptr, effectively skipping to the end of the stream.

* Remove troublesome nullptr, which skips every analysis afterwards

It was introduced in 0746c241 to fix a memory leak.
But setting tok to nullptr, effectively skipping to the end, seems not needed.

Previous commits fixes prevented some cases where you could enter the `else`.
This commit is more of a fall back.

* fixup! Fix deleted functions, which skipped everything after

`a::b f() = delete` triggered the final else in SymbolDatabase::addNewFunction,
which sets tok to nullptr, effectively skipping to the end of the stream.

* fixup! Fix deleted functions, which skipped everything after

`a::b f() = delete` triggered the final else in SymbolDatabase::addNewFunction,
which sets tok to nullptr, effectively skipping to the end of the stream.

* Make it heard when encountering unexpected syntax/tokens

Co-authored-by: Gerbo Engels <gerbo.engels@ortec-finance.com>
2022-10-10 20:17:33 +02:00
Daniel Marjamäki 65cd6ea7b4 Clarify knownConditionTrueFalse warnings 2022-10-10 13:45:30 +02:00
Paul Fultz II bd22ea565f
Use return instead of condition for alwaysTrueFalse check (#4446) 2022-10-09 21:03:48 +02:00
Oliver Stöneberg fa7e08a29f
optimized `CheckOther::checkDuplicateBranch()` a bit (#4542) 2022-10-09 20:48:54 +02:00
Daniel Marjamäki 94c3108494 GUI: Detect when version is old 2022-10-09 18:51:01 +02:00
Oliver Stöneberg d1bfae989e
fixed handling of incomplete char/string literals in `isPrefixStringCharLiteral()` - also optimized it a bit (#4541)
* fixed handling of incomplete char/string literals in `isPrefixStringCharLiteral()` - also optimized it a bit / added tests for `isStringLiteral()` and `isCharLiteral()`

* utils.h: early out in `isStringCharLiteral()` to avoid the loop
2022-10-09 11:19:19 +02:00
Tomo Dote c5a226470a
Add few Japanese translations only (#4539) 2022-10-09 07:40:10 +02:00
Oliver Stöneberg b0eeb5d044
selfcheck.yml: re-enable core checks in `callgrind` step (#4538) 2022-10-09 07:39:32 +02:00
Daniel Marjamäki e35187cf9b GUI: proper loading of cppcheck.cfg 2022-10-08 17:05:18 +02:00
Oliver Stöneberg 9f7a725983
added environment variable `UNUSEDFUNCTION_ONLY` to make sure only the `unusedFunction` check is being executed (#4362) 2022-10-06 20:54:24 +02:00
Oliver Stöneberg 12afb9bbf4
cleaned up global `donate_cpu_lib.py` configuration variables (#4532) 2022-10-06 20:49:47 +02:00
Oliver Stöneberg 7ead32f96e
various optimizations (#4535)
* avoid potentially duplicated `strTolower()` call in `Path::getFilenameExtensionInLowerCase()`

* avoid unnecessary copies

* use `unordered_*` containers for faster lookups

* symboldatabase.cpp: do not perform call in `checkReturns()` until needed

* astutils.cpp: do not perform calls in `isVariableChangedByFunctionCall()` until necessary

* tokenize.cpp: small `hasIfDef()` optimization

* use `unordered_map` for `CheckUnusedFunctions::FunctionUsage::mFunctions` / adjusted test case
2022-10-06 20:12:07 +02:00
Oliver Stöneberg 6634cb95a1
matchcompiler.py: declare matchcompiled functions as `inline` (#4536) 2022-10-06 07:58:48 +02:00
Oliver Stöneberg cb095835e0
fixed `valgrind` workflow (#4537) 2022-10-05 22:05:08 +02:00
Daniel Marjamäki ca32cf11ba Fix handling of --performance-valueflow-max-time=T 2022-10-04 20:01:19 +02:00
Daniel Marjamäki 8686997292 Add experimental option --performance-valueflow-max-time=T 2022-10-04 14:02:55 +02:00
Oliver Stöneberg 6c11e2a4ee
CI-windows.yml: added Qt 6.4.0 / updated Qt to 6.3.2 (#4531) 2022-10-02 07:13:49 +02:00
Oliver Stöneberg ee124cd097
modernized `erase()` calls (#4530) 2022-10-02 07:13:31 +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
chrchr-github 586c29c772
Partial fix for #9157 False negative: stlOutOfBounds, cast (#4527)
* Fix leakNoVarFunctionCall FP

* Partial fix for #9157 False negative: stlOutOfBounds, cast
2022-09-30 14:43:21 +02:00
Oliver Stöneberg 858585ceb1
disabled all clang-tidy checks for Qt generated files (#4525)
* disabled cll clang-tidy checks for Qt generated files

* enabled `bugprone-suspicious-include` clang-tidy warning
2022-09-30 07:27:03 +02:00
Oliver Stöneberg 88be6ec596
bump simplecpp (#4524) 2022-09-30 07:26:48 +02:00
chrchr-github 4d13266e99
Fix #10083 FN unusedScopedObject: temporary lock 'std::lock_guard<std::mutex>(m)' (#4522)
* Fix #10083 FN unusedScopedObject: temporary lock 'std::lock_guard<std::mutex>(m)'

* Format

* Fix cppcheck-cfg.rng

* Format
2022-09-30 07:25:33 +02:00
Oliver Stöneberg 40b5521bf0
added `triage_version.py` for running a code sample against a given amount of Cppcheck binaries (#4332) 2022-09-29 22:01:17 +02:00
Oliver Stöneberg 73cf54a333
re-enabled valgrind in CI (#4516) 2022-09-29 22:00:08 +02:00
Oliver Stöneberg 3dfdb409c6
fixed and enabled some Clang compiler warnings (#4517) 2022-09-29 21:59:02 +02:00
chrchr-github 6142ba542a
Fix leakNoVarFunctionCall FP (#4523) 2022-09-29 21:58:11 +02:00
Oliver Stöneberg 5f79f0ccad
enabled `google-explicit-constructor` clang-tidy warnings (#4515) 2022-09-29 21:56:45 +02:00
chrchr-github 260a757791
Fix #10839 internalAstError with function returning a function (#4514) 2022-09-29 21:56:26 +02:00
Oliver Stöneberg 0ab7116891
refs #10700 - donate-cpu-server.py: added query parameter `pkgs` to some reports to request a list of affected packages (#3743) 2022-09-29 21:55:44 +02:00
Oliver Stöneberg 083efe6361
astutils.h: use pre-sized SmallVector in visitAstNodes() (#3919) 2022-09-29 21:52:42 +02:00
Oliver Stöneberg eeb6db05f1
avoid some unnecessary object creations and copies (#4493) 2022-09-29 21:47:17 +02:00
Oliver Stöneberg 0481edf9c3
return `SmallVector` from `followAllReferences()` (#3925) 2022-09-29 21:41:32 +02:00
chrchr-github b8b6b41833
Fix #10802 Broken AST lambda inside for loop (#4520)
* Fix #10802 Broken AST lambda inside for loop

* Add some boost and wxwidget defines (on behalf of "david ingamells")
2022-09-29 13:29:50 +02:00
chrchr-github 33fde8ae6b
Add tests for #1770, #10130 (#4519)
* Add test for #6541, avoid duplicate warning

* Add test for #5475

* Fix test

* Merge

* Add test for #8666

* Fix #11239 checkLibraryCheckType with asm goto() (invalid varid)

* Format

* Add tests for #1201, #2654

* Fix test

* Add test for #6379

* Add tests for #1770, #10130
2022-09-29 12:33:34 +02:00
chrchr-github 32c7b919ba
Add tests for #1201, #2654, #6379 (#4518)
* Add test for #6541, avoid duplicate warning

* Add test for #5475

* Fix test

* Merge

* Add test for #8666

* Fix #11239 checkLibraryCheckType with asm goto() (invalid varid)

* Format

* Add tests for #1201, #2654

* Fix test

* Add test for #6379
2022-09-29 07:05:29 +02:00
Oliver Stöneberg 441f9b9509
selfcheck.yml: added `callgrind` step for basic (core) performance tracking (#4171) 2022-09-28 19:32:22 +02:00
chrchr-github 56e2af5dec
Fix #9653 FP leakReturnValNotUsed although (void) is specified (#4431) 2022-09-27 20:09:04 +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 10426f6707
cppcheck.cpp: only call `getFileInfo()` if necessary (#4510) 2022-09-27 20:04:35 +02:00
Oliver Stöneberg b9e07e918e
enabled and fixed `readability-named-parameter` clang-tidy warnings (#4487) 2022-09-27 20:03:25 +02:00