Commit Graph

2993 Commits

Author SHA1 Message Date
chrchr-github e2082267e2
Fix #12218: class and union (#5705)
Co-authored-by: chrchr-github <chrchr@github>
2023-12-01 10:03:43 +01:00
chrchr-github 42a64d4d39
Fix #12218 syntaxError with typedef in namespace (#5694) 2023-11-25 22:59:51 +01:00
chrchr-github 33981fe42c
Fix #12214 FN constParameterReference / #12216 FP constParameterReference (#5691) 2023-11-25 22:58:16 +01:00
Daniel Marjamäki 727d086dc4
Fix #12217 (misra 11.4: report conversion in macro) (#5692) 2023-11-22 12:47:48 +01:00
Oliver Stöneberg 2b61c9ef2f
Tokenizer: moved `VariableMap` into anonymous namespace (#5686) 2023-11-21 11:35:17 +01:00
chrchr-github 6ac804d209
Fix #12178 extern "C++" scope generates valueflow (#5654) 2023-11-14 10:02:41 +01:00
chrchr-github 2d232dcaac
Fix varid0 with rvalue reference typedef (#5649) 2023-11-11 10:09:08 +01:00
chrchr-github 328daeceb4
Fix #11334 debug: varid0 with anonymous union (#5648) 2023-11-11 10:01:03 +01:00
chrchr-github d24074f7b1
Fix #12166 debug: varid0 with reference typedef (#5643)
Why do we even split any declarations in the first place?
2023-11-09 10:11:34 +01:00
Daniel Marjamäki 780b742568
Fix #12165 (simplifyTypedef: the "enum" token is not inserted) (#5641) 2023-11-09 07:48:33 +01:00
Daniel Marjamäki 8f432880fa
Fix #12164 (False positive: operator precedence warning even though there are parentheses) (#5640) 2023-11-08 18:54:40 +01:00
Daniel Marjamäki c1aed9681d
Fix #12151 (Tokenizer::arraySize: enum constant used as index in array initialization) (#5633) 2023-11-07 19:19:19 +01:00
Daniel Marjamäki fc8c244675
CI: Add selfcheck using Cppcheck Premium. Activates Misra C++ 2008 and Cert C++ 2016 checkers. (#5623) 2023-11-06 15:31:47 +01:00
chrchr-github 099d96ffa1
Fix #12137 syntaxError with attribute in typedef (#5612) 2023-11-03 09:56:41 +01: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 f4d18a8d1e
#12077 FP constStatement with ctor in namespace (#5572) 2023-10-21 12:12:56 +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 285ef96b5b
Report unknownMacro in string concatenation (refs #11378) (#5558) 2023-10-18 18:46:47 +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 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 f13134a6a4
Refactoring: use init list, redundant init (#5552) 2023-10-15 14:51:12 +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
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
Oliver Stöneberg a22c181553
fixed "Redundant elaborated type specifier" Rider warnings (#5517) 2023-10-08 09:10:17 +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
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 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
Daniel Marjamäki ed5532c2a7
Fix #12019 (False positive: null pointer, array zero initialization) (#5495) 2023-09-28 15:18:08 +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
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
chrchr-github 5a21851bb7
Fix #11981 internalAstError with using declaration (#5446) 2023-09-14 12:14:08 +02:00
chrchr-github 523c41a60b
Fix #11978 debug: Executable scope 'x' with unknown function. (#5437) 2023-09-13 11:39:09 +02:00
Oliver Stöneberg 02b836baad
do not pass POD types by reference (based on clazy `function-args-by-value` check) (#5388) 2023-09-11 20:40:39 +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 c3136dbc2a
Refactor: The code to generate id string from pointer can be simplified (#5382) 2023-08-31 23:14:28 +02:00
Oliver Stöneberg 0fadf9ed25
sped up `Tokenizer::dump()` (#5009)
Scanning the `cli` folder with `DISABLE_VALUEFLOW=1` `Tokenizer::dump()`
will consume almost 25% of the total Ir count when an addon is
specified. This is mainly caused by the usage of `std::ostream`.

Encountered while profiling #4958.
2023-08-31 11:54:46 +02:00
Oliver Stöneberg e669b102f8
renamed `Check::reportError(const ErrorMessage&)` to `writeToErrorList()` to reflect its actual behavior (#5322) 2023-08-18 13:45:25 +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
Anton Lindqvist 5c6962c273
Fix FP unusedVariable with arrays (#5319) 2023-08-12 16:55:52 +02:00
chrchr-github c3d7c91e88
Additional call to setValueTypeInTokenList() (#5300) 2023-08-08 22:54:27 +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 e38a031ae6
ValueFlow: pass `SymbolDatabase` by reference into `ValueFlow::setValues()` (#5295) 2023-08-07 18:41:50 +02:00
Oliver Stöneberg 77c479a6c4
pass `TokenList` as reference into `ValueFlow::setValues()` (#4868)
This avoid lots of unchecked pointer dereferences.

There was a single case which checked it and that looked like a
leftover. The only way this might have been a `nullptr` pointer was
through several default constructors which were not used at all so I
removed them.
2023-08-04 18:17:27 +02:00
chrchr-github faf8047050
Fix FP truncLongCastReturn on Windows (#5262) 2023-08-02 12:27:29 +02:00