Daniel Marjamäki
75311fba0f
Fixed #10218 (FP uninitvar with input from stringstream in for loop)
2021-05-10 19:48:07 +02:00
Daniel Marjamäki
db7be3e91b
Fixed #9810 (Improve check: uninitialized struct member not detected)
2021-05-10 19:24:03 +02:00
Daniel Marjamäki
c37b8ea55c
Fixed #8299 (false negative: uninitialized struct member)
2021-05-10 18:38:44 +02:00
Daniel Marjamäki
271acf8aee
Refactoring; Use isUnaryOp instead of simpleMatch
2021-05-10 18:18:21 +02:00
Rikard Falkeborn
b013f1b3d0
Fix test case for #10186 ( #3253 )
2021-05-10 08:01:30 +02:00
Daniel Marjamäki
040069ab4d
Fixed Cppcheck self-check warnings
2021-05-09 23:27:53 +02:00
Daniel Marjamäki
2c24af02c8
Fixed self-check error. Use Token::simpleMatch for simple pattern.
2021-05-09 23:02:35 +02:00
Daniel Marjamäki
2e2d766e2b
Fixed #6766 (Improve check; struct member is assigned value that is never used)
2021-05-09 20:09:10 +02:00
Daniel Marjamäki
3b37c14b3c
Parser; Partial C++20 support, explicit(bool)
2021-05-09 18:47:02 +02:00
Daniel Marjamäki
32b28d568f
Refactoring; Check structured binding in isVariableChanged()
2021-05-08 20:46:46 +02:00
Daniel Marjamäki
895a96f9dd
Tokenizer::findGarbageCode: detect wrong struct declaration
2021-05-08 15:28:21 +02:00
Daniel Marjamäki
a197e94573
Fixed #10266 (False positive; parameter can be const)
2021-05-08 13:40:52 +02:00
Daniel Marjamäki
abb4200316
Fixed #10196 ("Unhandled char constant 'x'" with non-standard escape character)
2021-05-08 12:54:18 +02:00
keinflue
0a84ad874c
Fix case ranges with single quotes and escape sequences ( #3248 )
2021-05-08 11:24:07 +02:00
Georgiy Komarov
7a009fece0
misra: Add support for expected suppressions in header files in `-verify` mode ( #3252 )
...
This commit allows to specify expected suppressions in the included
header files. This is necessary to verify MISRA checkers, which make
requirements for header files. For example, Rule 8.2 requires adding
prototypes for each function to the header files.
2021-05-08 10:27:31 +02:00
keinflue
bfa26b5a72
Fix FP leakNoVarFunctionCall with passthrough returns ( #3249 )
2021-05-08 10:26:10 +02:00
Daniel Marjamäki
be95e2bf21
Fixed #10271 (AST; Token::astOperand2() cyclic dependency in static_assert)
2021-05-07 13:19:28 +02:00
keinflue
c9a9b56e0e
Increase max AST depth and throw error if exceeded ( #3250 )
...
Co-authored-by: keinflue <>
2021-05-06 11:43:15 +02:00
Maksim Derbasov
14ea8d7e68
Align keywords with c++20 standard for CodeEditor ( #3247 )
2021-05-05 07:35:13 +02:00
Daniel Marjamäki
b8de69489d
Fixed #10079 (AST: switch does not have two operands)
2021-05-04 20:15:57 +02:00
Maksim Derbasov
f0005665a8
Scratchpad using CodeEditor class ( #3246 )
2021-05-04 19:17:03 +02:00
Daniel Marjamäki
2f984b201a
AST; Fix wrong AST for initializer list
2021-05-04 19:02:29 +02:00
Daniel Marjamäki
08184f4681
Fixed #10070 (FP warning: Logical disjunction always evaluates to true)
2021-05-04 13:47:09 +02:00
dummyunit
661ebd3a96
Fix AST for brace initialization after decltype() ( #3245 )
...
Currently sub-expressions like decltype(x){} break AST creation for
subsequent tokens in the whole expression. In some cases this triggers
validation checks in validateAst() and analysis on the file stops.
For example, code like this:
int x = decltype(0){} ? 0 : 1;
currently produces internalAstError.
To fix the issue iscpp11init_impl() was changed to recognize { preceded
by decltype(expr) as a start of C++11 brace initialization expression.
2021-05-03 21:40:49 +02:00
Daniel Marjamäki
82636d4f07
AST: Fixed ast for a: 🅱️ :c..
2021-05-03 20:33:03 +02:00
Daniel Marjamäki
70ab30e3c6
AST; Fixed problem with initializer list and cleanup of compileScope
2021-05-03 20:22:08 +02:00
Daniel Marjamäki
7fefdf2bf7
astyle formatting
2021-05-03 16:34:55 +02:00
keinflue
f47fd20e14
Add test cases and improvements for PR #3240 . ( #3242 )
2021-05-03 10:45:37 +02:00
Daniel Marjamäki
cb8ee825fd
AST; remove special handling of semicolon in if|switch as Tokenizer will simplify the code instead
2021-05-03 10:43:14 +02:00
keinflue
6b8029633f
Fix build warnings and checkcfg errors with musl and libc++. ( #3244 )
...
* Fix musl include warning.
* Fix test/cfg errors with musl/libc++.
* Use correct C++ include for PR #3244
Co-authored-by: keinflue <>
2021-05-03 09:39:33 +02:00
Daniel Marjamäki
1bce1cf83c
astyle formatting
...
[ci skip]
2021-05-02 21:36:24 +02:00
dummyunit
ac505afe69
Fixed #9729 (AST broken: lambda with noexcept keyword) ( #3243 )
...
The previous fix for the issue (43b58dbc9e
) didn't seem to actually fix
it because it added a check for noexcept without a condition, but when
AST is created noexcept always has a condition due to simplification
from "noexcept" to "noexcept(true)" in Tokenizer::simplifyKeyword().
The issue from the ticket couldn't be reproduced neither on 43b58dbc9e
nor on the previous commit, so it is hard to tell whether the fix was
effective or not.
The issue appeared again after a refactoring of AST code in ac67049661
.
Test added with the original fix was unable to catch that because it
used testAst() helper function which skips most simplification steps.
To fix the issue we now check for noexcept with a condition and add a
proper regression test that:
1. Uses tokenizeAndStringify() to ensure that all simplifications are
performed before AST is created.
2. Parses the code snippet from the ticket, as having "if (cond)" is
crucial to reproducing the original issue (internalAstError).
Also fix AST creation for lambdas that have both constexpr and mutable
keywords.
2021-05-02 21:34:28 +02:00
Daniel Marjamäki
f7d0bf7a59
Refactoring; Reuse simplecpp::characterLiteralToLL
2021-05-02 13:44:37 +02:00
dummyunit
da27159d7c
Fixed #9728 (Support function level try blocks)
2021-05-02 09:05:12 +02:00
keinflue
d553df75c6
Fix FP unknownEvaluationOrder on __builtin_bswap*. ( #3240 )
2021-05-02 08:48:43 +02:00
Daniel Marjamäki
6f60c6d965
Revert "Refactoring; Reuse function in simplecpp"
...
This reverts commit dbe9eb2a27
.
2021-05-01 19:54:14 +02:00
Daniel Marjamäki
e1dd04c536
Fixed make checkcfg
2021-05-01 19:17:07 +02:00
Daniel Marjamäki
e03ef93ed7
Fix compiler error
2021-05-01 18:57:10 +02:00
Daniel Marjamäki
e6d1b44758
Revert "Remove unnecessary null check ( #3213 )"
...
This reverts commit 6d13975def
.
2021-05-01 18:54:51 +02:00
Ken-Patrick Lehrmann
6d13975def
Remove unnecessary null check ( #3213 )
2021-05-01 18:51:51 +02:00
Daniel Marjamäki
e78612d280
Refactoring; Use TinyXml methods to parse bool/int attribute values
2021-05-01 18:40:20 +02:00
Daniel Marjamäki
dbe9eb2a27
Refactoring; Reuse function in simplecpp
2021-05-01 18:13:40 +02:00
Daniel Marjamäki
636387b31c
AUTHORS: Added keinflue
2021-05-01 17:26:58 +02:00
keinflue
6541f52e61
Fix false positive invalidFunctionArg for zero arguments to calloc. ( #3238 )
2021-05-01 12:39:01 +02:00
Daniel Marjamäki
a32d6257d5
Fix Cppcheck self-check, extra whitespace in match patterns
2021-05-01 12:15:54 +02:00
Daniel Marjamäki
0bd1b1c249
AUTHORS: Added DGarry82
2021-05-01 12:14:01 +02:00
Daniel Marjamäki
9b717b8835
Refactoring __attribute__ simplification
2021-05-01 11:39:26 +02:00
Daniel Marjamäki
07c1f28035
astyle formatting
2021-05-01 07:35:03 +02:00
DGarry82
d3035c246f
Attribute lists support ( #3239 )
2021-05-01 07:33:55 +02:00
Paul Fultz II
31e3e4d87b
Fix issue 10086: false positive: (style) constVariable: Variable 'x' can be declared with const ( #3219 )
2021-04-30 17:47:08 +02:00