Commit Graph

14826 Commits

Author SHA1 Message Date
chrchr-github 72a36172aa
Fix #12142 FP uninitStructMember, unreadVariable with pointer to member (#5618) 2023-11-04 13:40:06 +01:00
chrchr-github fa7891e37b
Fix #12139 FP redundantCopyLocalConst for small type (#5617) 2023-11-04 13:38:02 +01:00
chrchr-github 789c032e42
Fix #12138 FP passedByValue with anonymous union (#5611) 2023-11-04 13:34:08 +01:00
Oliver Stöneberg ca6d1aafdb
moved `fileSettings` out of `Settings` (#5608)
Moved the `FileSettings` out of the `Settings` and pass them around
explicitly. They can never be specified at the same time and are used
exclusively. The code hasn't been fully adjusted to reflect this as this
is only the refactoring without any functional changes.
2023-11-03 23:24:04 +01:00
Oliver Stöneberg 8b0916c319
ValueFlow: improved `checkLevelNormal` message (#5584) 2023-11-03 21:05:56 +01:00
Oliver Stöneberg 989d276dde
removed the need for `Check` object in `CTU::getUnsafeUsage()` callback / some CheckUninitVar cleanups (#5610)
The `Check` objects were just created for that purpose so they basically
just were wrappers for the pointers passed into them and were
unnecessary.
2023-11-03 18:27:11 +01:00
chrchr-github 099d96ffa1
Fix #12137 syntaxError with attribute in typedef (#5612) 2023-11-03 09:56:41 +01:00
Oliver Stöneberg 63e00ea918
fixed some "Variable can be made constexpr" Rider warnings (#5615) 2023-11-03 09:55:44 +01:00
Oliver Stöneberg e6d15b17ff
extracted `FileSettings` from `ImportProject` to `filesettings.h` (#5604) 2023-11-02 17:42:41 +01:00
Oliver Stöneberg dd627a2b1d
moved `ImportProject` out of `Settings` and only store `fileSettings` (#5603)
`ImportProject` is not needed outside of the command-line parsing so we
do not need it inside the `Settings` at all. We only use the
`fileSettings` in the executors.
2023-11-01 21:08:30 +01:00
chrchr-github 10654386db
Fix #12128 FP uninitDerivedMemberVar with brace init (#5606) 2023-11-01 09:49:32 +01:00
chrchr-github 29001b651b
Fix #12129 FN (regression): constParameterPointer (#5605) 2023-11-01 09:49:19 +01:00
chrchr-github 67b61a0ab7
Fix #12134 false negative: passedByValue (#5607) 2023-10-31 19:08:08 +01:00
chrchr-github c2d5aef435
Fix #12083 FN passedByValue with usage in ternary (#5575) 2023-10-31 16:12:38 +01:00
chrchr-github bbaa7be901
Fix #12118 FP passedByValue for callbacks (#5591) 2023-10-31 12:06:31 +01:00
Swasti Shrivastava 7618e100b4
Do not add AST for pointer in variable declaration (#5593) 2023-10-31 10:26:03 +01:00
Paul Fultz II 18373bc64b
Fix 12116: FP negativeContainerIndex with redundant assignment (regression) (#5602) 2023-10-29 00:11:03 +02:00
Daniel Marjamäki 083c4aa34b
Fix #12079 (Make misra-config a critical error) (#5578) 2023-10-28 16:58:59 +02:00
chrchr-github 77bfec4317
Fix #12119 FN constVariablePointer with reassigned pointer (#5592) 2023-10-28 16:48:39 +02:00
chrchr-github cae27c5ec7
Fix #12117 FP integerOverflowCond for shift by 31 bits (#5596) 2023-10-28 16:47:57 +02:00
chrchr-github f6fb3334f3
Set enumerator in ctor init list (refs #10045) (#5599) 2023-10-28 13:51:52 +02:00
chrchr-github 6bc164e0d0
Fix #12122 FP knownConditionTrueFalse with type traits (#5595) 2023-10-26 23:33:35 +02:00
chrchr-github 80c5cb6690
Fix #12008 debug: Executable scope 'x' with unknown function. (#5588) 2023-10-25 14:50:10 +02:00
chrchr-github 502d7ea6db
Fix #12120 FP constStatement with class in C code (#5594) 2023-10-25 10:05:42 +02:00
chrchr-github 89df134fed
Fix #12109 Crash in calculate.h (#5587) 2023-10-24 10:05:32 +02:00
chrchr-github 7e2fcea3d9
Fix #12044 FN knownConditionTrueFalse comparing qualified constant with number (#5518) 2023-10-23 11:18:05 +02:00
Oliver Stöneberg a765a1310d
ValueFlow: omit unnecessary location information from `valueFlowBailoutIncompleteVar` (#5583)
This is unnecessary since we only issue it from a single location. It
also leads to a lot of unnecessary noise in the daca diff reports.
2023-10-23 10:13:10 +02:00
Oliver Stöneberg 3103736c51
refs #11928 / refs #10045 / fixes #11794 - generate `limits.h`/`climits` defines from platform (#5414) 2023-10-21 17:21:12 +02:00
Oliver Stöneberg 09785a4eb8
moved `MyFileInfo` definitions into source files (#4697) 2023-10-21 16:58:29 +02:00
chrchr-github 26ba29c303
Fix #12086 FN passedByValue with index operator and namespaced function call (#5574) 2023-10-21 12:41:39 +02:00
chrchr-github f4d18a8d1e
#12077 FP constStatement with ctor in namespace (#5572) 2023-10-21 12:12:56 +02:00
Oliver Stöneberg 85f40ed47c
moved `TokensFrontBack` from `token.h` to `tokenlist.h` (#5547) 2023-10-21 09:14:25 +02:00
Oliver Stöneberg 7086ffaa1b
fixed #12045 - print error when using an option which has not been compiled in instead of treating it as non-existent or a no-op (#5508)
Also disabled more internal code around those options and did some
cleanups.
2023-10-21 09:12:59 +02:00
chrchr-github 41bd28c0b3
Fix #12087 Library: add Container::Action::FIND_CONST (#5579) 2023-10-20 21:22:06 +02:00
chrchr-github b61feaf77f
Fix syntaxError with const lambda (refs #11275) (#5571) 2023-10-20 15:32:46 +02:00
chrchr-github 0070a78101
Fix #12088 FP constStatement with delete in loop increment (#5576) 2023-10-20 10:25:31 +02:00
Daniel Marjamäki 17ea101e7b
Fix #12081 (Tokenizer::simplifyTypedef: Handle volatile structs better) (#5577) 2023-10-19 21:02:03 +02:00
Paul Fultz II f2c8153231
Set the lower and upper bounds for variable that are only incremented or decremented (#5523)
Also, changed `isExpressionChanged` and `isThisChanged` to return the
token that is being modified and renamed the functions to
`findExpressionChanged` and `findThisChanged`.
2023-10-19 18:42:52 +02:00
chrchr-github 7c3ae68e4d
Fix #11893 FP constStatement unused variable (#5567) 2023-10-19 10:51:16 +02:00
Paul Fultz II e1a120e6b0
Partial fix for 12031: False positive: uninitialized variable (#5573) 2023-10-18 23:49:22 +02:00
chrchr-github 09f426d980
Fix #12082 FP uninitvar for assignment to array member in conditional (#5570) 2023-10-18 18:50:49 +02:00
chrchr-github 285ef96b5b
Report unknownMacro in string concatenation (refs #11378) (#5558) 2023-10-18 18:46:47 +02:00
chrchr-github b60b374f9c
Fix internalASTError with decltype (regression, refs #11378) (#5564) 2023-10-18 12:17:20 +02:00
Oliver Stöneberg bfe19af6b2
fixed some "Declaration and assignment can be joined" Rider warnings (#5569) 2023-10-18 10:06:17 +02:00
Oliver Stöneberg 85fe627c68
fixed some typos (#5562) 2023-10-17 18:32:07 +02:00
Daniel Marjamäki dd76504f82
Fixed #3537 (Allow inline suppression comments for macros) (#5559) 2023-10-16 19:43:15 +02:00
Oliver Stöneberg 3811d01498
fixed "Redundant dereferencing and tasking address expression" Rider warnings (#5563) 2023-10-16 14:09:03 +02:00
Oliver Stöneberg 5e89eb05a6
iwyu.yml: made `include-what-you-use` output more verbose / cleaned up includes (#5540) 2023-10-16 12:57:49 +02:00
chrchr-github 93297727ef
Fix internalASTError with decltype (refs #11378) (#5553) 2023-10-15 20:47:01 +02:00
chrchr-github f13134a6a4
Refactoring: use init list, redundant init (#5552) 2023-10-15 14:51:12 +02:00
chrchr-github 903df84ddc
Fix #12072 FN constStatement with enum (#5554) 2023-10-13 21:40:47 +02:00
Daniel Marjamäki ec15772381
Refactoring suppressions code. (#5550) 2023-10-13 19:57:08 +02:00
chrchr-github efd488b519
Partial fix for #12062 FN: memleak (#5548) 2023-10-13 18:47:06 +02:00
chrchr-github f56677a99d
Fix #11857 FP constParameterReference with std::map (#5551) 2023-10-13 18:08:40 +02:00
Oliver Stöneberg ebb877adcc
gui/platforms.h: renamed `Platform` to `PlatformData` / Platform: removed unnecessary `cppcheck` namespace (#5545) 2023-10-13 16:02:04 +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
Daniel Marjamäki 9d4e3829c2
Partial fix #12030 (False positive: uninitialized variable, conditional modification, flag) (#5543) 2023-10-12 13:56:47 +02:00
Oliver Stöneberg 8c0d43d928
removed unnecessary encapsulation of severity enum and made it an `enum class` (#5541) 2023-10-12 11:58:39 +02:00
chrchr-github 179d26f06b
Fix #12064 FP useStlAlgorithm with loop over initializer list (#5542) 2023-10-12 10:06:52 +02:00
chrchr-github e247e818ec
Fix #12052 FP: containerOutOfBounds (#5534) 2023-10-11 14:08:17 +02:00
Oliver Stöneberg e4028f6820
fixed some "Declarator is never used" Rider warnings (#5535) 2023-10-09 18:06:35 +02:00
Oliver Stöneberg 2f62e9d316
mitigated several compiler warnings / suppress compiler warnings in CI where we don't care about them (#5497)
There's no need to generate any warnings in the CI unless we react on
them.
2023-10-09 12:25:56 +02:00
Daniel Marjamäki 47d2c0f619
Fix Cert C++ warnings reported by Cppcheck Premium (#5528) 2023-10-09 11:20:56 +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 0f28f3e493
generate `AddonInfo` only once (#4958)
Currently the `AddonInfo` is generated and discarded on each addon
invocation. This leads to an unnecessary process invocation for each
addon on each file.

Also if an addon is completely broken we will still perform the whole
analysis only for it to be failed at the end so we should bail out early
if we know it doesn't work at all.
2023-10-08 21:28:57 +02:00
Oliver Stöneberg a22c181553
fixed "Redundant elaborated type specifier" Rider warnings (#5517) 2023-10-08 09:10:17 +02:00
Oliver Stöneberg 8dee551cad
added testing of clang-tidy invocation to executor tests / also some cleanups (#5514) 2023-10-08 09:06:02 +02:00
Paul Fultz II d48df980b4
Fix 12030: False positive: uninitialized variable, conditional modification, flag (#5520) 2023-10-07 14:01:06 +02:00
chrchr-github 903eccb336
Fix #12039 FP knownConditionTrueFalse (#5513) 2023-10-06 09:53:24 +02:00
Oliver Stöneberg 5a52fa80fb
refs #12022 - disallow multiple `--project` options (#5499) 2023-10-05 21:36:44 +02:00
Oliver Stöneberg fe8730cf0f
MathLib: renamed `to{U}LongNumber()` to `toBig{U}Number()` (#5503)
The name was misleading as it was actually a `long long` and also if we
ever move to an (optional) 128-bit value it wouldn't even less fitting.
We should name it to match our alias type.
2023-10-05 19:21:42 +02:00
Oliver Stöneberg fc700b68eb
refs #4452 / refs #11705 - improved `--showtime=` behavior and testing (#4876)
This is a step onto leveraging the `ThreadExecutor` implementation for
`ProcessExecutor` which is a follow-up to #4870. We need to have the
proper test coverage and the existing implementations working as
expected before we move to the shared code.

Fixes:
- added `--showtime=` tests for all executor implementations
- only print `--showtime=summary` once at the end
- prevents `--showtime=` by multiple threads to be written at the same
time - essentially breaking the output
- reset the timer results before each test
- deprecated `top5` in favor of `top5_file`
- fixed printing for all executors except `ProcessExecutor`
2023-10-05 19:04:06 +02:00
chrchr-github 787da43dc9
Fix #12036 FN knownConditionTrueFalse comparing enum with number (#5510) 2023-10-05 18:15:18 +02:00
Daniel Marjamäki a52d2a23a0
Fix #12018 (False positive: null pointer, multiple arguments) (#5509) 2023-10-05 15:08:25 +02:00
andymacg f054feba85
Fix #12015 by adding pid to filelist name (#5491) 2023-10-05 11:44:48 +02:00
chrchr-github d9a8909d2a
Fix #11408 debug: Function::addArguments found argument 't' with varid 0 (#5507) 2023-10-05 10:01:46 +02:00
Daniel Marjamäki d069dbfd93
Fix #12029 (Fix definitions of global constants) (#5504) 2023-10-02 20:32:51 +02:00
Daniel Marjamäki 6a8f787915
Fix #12026 (simplifyTypedef: not handled properly when typedef and enum constant has same name) (#5500) 2023-10-01 21:26:54 +02:00
chrchr-github 6773cdb34b
Fix #12014 syntaxError due to bad typedef simplification (#5493) 2023-09-28 19:26:12 +02:00
chrchr-github 033cf64961
Avoid const_cast (#5490) 2023-09-28 18:20:43 +02:00
Daniel Marjamäki ed5532c2a7
Fix #12019 (False positive: null pointer, array zero initialization) (#5495) 2023-09-28 15:18:08 +02:00
Daniel Marjamäki c4fe5ac8b7
Fix #12012 (FP: uninitvar, address of variable is casted to uintptr_t that is passed to function) (#5494) 2023-09-28 13:47:11 +02:00
chrchr-github 63b76d2266
Fix valueFlowBailoutIncompleteVar with ptr to ptr (refs #10045) (#5488) 2023-09-28 10:36:18 +02:00
chrchr-github 73d305ea46
Fix #12013 crash: crashes in release builds if cppcheck build dir is used (#5489) 2023-09-27 16:44:22 +02:00
chrchr-github e928f2b5aa
Fix valueFlowBailoutIncompleteVar with new (refs #10045) (#5487) 2023-09-26 21:39:07 +02:00
chrchr-github 4ba19c42ba
Bump simplecpp (fix #11991) (#5486) 2023-09-26 15:58:16 +02:00
Oliver Stöneberg a9952d9da6
CppCheck: avoid expensive `std::ostringstream` usage in `checkFile()` (#5481)
Scanning `common` from `xrdp` project with `DISABLE_VALUEFLOW=1` and
`-D__GNUC__ --addon=misra`:

Clang 16 `627,748,337` -> `541,852,912`
2023-09-26 14:22:52 +02:00
chrchr-github f037edf586
Fix #11440 FN Moved value when using {} to initialize (#5479) 2023-09-26 10:04:22 +02:00
chrchr-github 99e38cf8f8
Partial fix for #10968 FN detect always false/true comparison of function with constant (#5480) 2023-09-25 22:18:07 +02:00
Oliver Stöneberg 3979ade9ea
got rid of test-only `Library` functions / avoid some more direct modifications of library data structures in test (#5468) 2023-09-25 13:37:24 +02:00
chrchr-github bba96c5c8f
Fix valueFlowConditionExpressions bailout for C++ casts (refs #10045) (#5472) 2023-09-22 18:19:36 +02:00
chrchr-github b745d9ad6e
Fix #12010 Improve unknownMacro message: int (#5473) 2023-09-22 10:16:21 +02:00
chrchr-github dc59543348
Fix #12006 Improve unknownMacro message (#5470) 2023-09-21 00:28:49 +02:00
chrchr-github 57bbb17f3b
Fix #11986 debug: Executable scope 'x' with unknown function. (#5463) 2023-09-20 17:18:00 +02:00
chrchr-github dc19916966
Fix valueFlowConditionExpressions bailout for library function (refs #10045) (#5461) 2023-09-20 15:49:13 +02:00
Oliver Stöneberg f49fedb2ad
fixed #11483 (FN unusedFunction for method with inline implementation) (#5457)
Co-authored-by: chrchr-github <78114321+chrchr-github@users.noreply.github.com>
2023-09-20 14:45:44 +02:00
Oliver Stöneberg a43b55a0ca
Improved addon execution errorhandling (#5451) 2023-09-20 10:40:57 +02:00
Paul Fultz II 58a7519cbb
Fix 11992: FN (regression): uninitvar (#5465) 2023-09-20 06:43:58 +02:00
chrchr-github c6b3c56174
Improve findEnumerator() (refs #10045) (#5459) 2023-09-19 11:45:59 +02:00
Tomasz Edward Posluszny b6f60ad952
Support importing projects with project-name (#5456) 2023-09-18 13:54:20 +02:00