chrchr-github
1aa259569e
Fix #10138 syntax error : int (operator"" _ii)(unsigned long long v) … ( #4374 )
...
* Fix #10138 syntax error : int (operator"" _ii)(unsigned long long v) { return v; }
* Format
2022-08-18 23:38:45 +02:00
chrchr-github
e9f1665d4f
Add test for #10212 ( #4373 )
...
* Add test for #10603
* Add test for #10559
* Add test for #10212
* Format
2022-08-17 19:38:37 +02:00
chrchr-github
0978cc2d46
Add tests for #10559 , #10603 ( #4367 )
2022-08-17 10:01:49 +02:00
chrchr-github
974e34490f
Fix #9282 FP Unused private function ( #4327 )
2022-08-07 20:06:32 +02:00
chrchr-github
38fdbe0890
Fix #9716 Syntax error for function-try-block in global scope ( #4305 )
...
* Fix #9716 Syntax error for function-try-block in global scope
* static through instance
* Handle multiple catch blocks
* Add test
* Fix skip logic
* Handle init lists in simplifyFunctionTryCatch()
2022-07-31 14:49:50 +02:00
chrchr-github
b08aabefee
Fix #9877 FP unreadVariable (incomplete code; missing macro definition) ( #4278 )
2022-07-17 19:40:39 +02:00
chrchr-github
a658baf962
Fix #11143 FP: unreadVariable (remove simplifyMathExpressions()) ( #4227 )
...
* Fix #11143 FP: unreadVariable (remove simplifyMathExpressions())
* Remove unused function, tests
2022-06-21 15:42:23 +02:00
Daniel Marjamäki
86a8d88729
Tokenizer: Remove simplification of math functions from simplifyTokenList2
2022-06-08 09:58:11 +02:00
Paul Fultz II
a62fb986a5
Fix 11090: Infinite recursion in findTypeInBase() ( #4120 )
2022-05-21 08:24:29 +02:00
Daniel Marjamäki
72ba85a2fc
AST: Fix AST for array size calculation in cast (char (*)[...])
2022-05-10 22:47:57 +02:00
Daniel Marjamäki
4257f9d46a
Tokenizer: fix for __attribute__ before function that returns a reference
2022-05-10 20:59:24 +02:00
chrchr-github
a70d11adb6
Fix #11052 inline static global struct declaration interferes with checks ( #4098 )
2022-05-10 20:43:11 +02:00
Daniel Marjamäki
eb9c4b4aed
Tokenizer: Fix handling of __attribute__ for overloaded operator function
2022-05-08 18:19:52 +02:00
Daniel Marjamäki
fab55287f7
Tokenizer: improved handling of __asm__ in function declaration
2022-05-08 16:03:09 +02:00
Daniel Marjamäki
449d351095
Revert "Tokenizer: handle when __asm__ directive is provided for function"
...
This reverts commit f25b8cf662
.
2022-05-07 21:53:10 +02:00
Daniel Marjamäki
f25b8cf662
Tokenizer: handle when __asm__ directive is provided for function
2022-05-07 19:40:03 +02:00
chrchr-github
612d7be85a
Fix #11045 syntaxError with unknown macros and using namespace ( #4086 )
2022-05-05 19:47:56 +02:00
chrchr-github
51b4cf592b
Fix #11029 unknownMacro reported with noexcept (regression) ( #4073 )
2022-05-03 13:37:14 +02:00
chrchr-github
67f4fe575f
Fix #10978 syntaxError with attribute for function pointer ( #4069 )
2022-05-02 15:05:48 +02:00
chrchr-github
e9a0d7979e
Fix #11014 FN redundantPointerOp / remove simplifyMulAndParens() ( #4062 )
2022-05-01 15:46:07 +02:00
chrchr-github
b4df064875
Fix #11004 FP AssignmentIntegerToAddress with volatile ( #4046 )
2022-04-25 22:00:37 +02:00
Paul Fultz II
d2a0b0f78e
Fix 10951: FP knownEmptyContainer with east-const ( #3988 )
...
* Fix 10951: FP knownEmptyContainer with east-const
* Format
* Use simpleMatch
2022-04-08 08:22:39 +02:00
chrchr-github
955d6d8fc6
Fix #10793 internalAstError with brace-init in ternary ( #3966 )
...
* Fix #10793 internalAstError with brace-init in ternary
* Undo
2022-04-03 20:05:03 +02:00
Paul Fultz II
5bea50cd36
Fix 10908: FP: uninitvar after for-loop ( #3942 )
2022-03-31 21:24:20 +02:00
chrchr-github
343a23135d
Fix #10932 FP constStatement with reference and direct initialization ( #3952 )
2022-03-30 19:22:01 +02:00
chrchr-github
47ba053054
Fix #10744 FP constVariable with static pointer ( #3957 )
2022-03-30 19:21:09 +02:00
chrchr-github
11cbb2eb00
Fix AST cyclic dependency [cppcheckError] 3 ( #3953 )
2022-03-28 22:05:41 +02:00
chrchr-github
d57d536f01
Fix #10882 FP constStatement with negation and cast ( #3951 )
2022-03-28 21:52:08 +02:00
chrchr-github
401f0de18b
Fix #10929 FP constStatement with new ( #3947 )
2022-03-27 07:59:19 +02:00
chrchr-github
1dd19dcaef
Fix AST cyclic dependency [cppcheckError] ( #3945 )
2022-03-26 22:39:14 +01:00
chrchr-github
12cb19bdf2
Fix AST cyclic dependency [cppcheckError] ( #3940 )
2022-03-25 14:03:32 +01:00
chrchr-github
3630e9c49d
Fix #10874 FP constStatement with extra parentheses in declaration ( #3931 )
2022-03-24 22:07:21 +01:00
chrchr-github
479af21405
Fix #10698 FP uninitvar with new and braced initializer ( #3934 )
2022-03-24 20:08:51 +01:00
chrchr-github
0d2af9a5b7
Fix #10880 FP constStatement with init list in function call ( #3929 )
2022-03-23 18:10:33 +01:00
Paul Fultz II
72d0f3e444
Fix 10808: cppcheckError AST cyclic dependency with decltype ( #3850 )
...
* Fix 10808: cppcheckError AST cyclic dependency with decltype
* Format
2022-02-22 06:30:17 +01:00
chrchr-github
d77fa64051
Fix #10256 Function::addArguments found argument 'x' with varid 0 ( #3845 )
2022-02-21 18:06:26 +01:00
Daniel Marjamäki
30cec97cc8
Tokenizer: Support C++20 default bit-field member initializer
2022-02-12 12:19:08 +01:00
Oliver Stöneberg
f32583e097
removed OVERRIDE and FINAL defines and use the keywords directly ( #3767 )
2022-02-10 23:02:24 +01: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
Paul Fultz II
8b1ed9cbe1
Another fix for 10739: internalAstError with decltype ( #3738 )
...
* Another fix for 10739: internalAstError with decltype
* Format
2022-01-22 07:22:57 +01:00
Paul Fultz II
57b50e4b00
Fix 10739: internalAstError with decltype ( #3723 )
2022-01-20 21:36:48 +01:00
Paul Fultz II
abb0563cef
Fix 10726: Crash in CheckExceptionSafety::checkRethrowCopy ( #3711 )
2022-01-16 12:35:51 +01:00
Paul Fultz II
0b1cd8626d
Fix 10664: Crash in Token::linkAt ( #3708 )
...
* Fix 10664: Crash in Token::linkAt
* Format
2022-01-14 23:51:01 +01:00
Armin Müller
5a05631c84
Typos found by running "codespell" ( #3702 )
2022-01-13 17:24:26 +01:00
Paul Fultz II
fa651272f0
Fix 10001: Syntax error on valid C++ code ( #3697 )
2022-01-12 22:04:28 +01:00
Paul Fultz II
7bf0ca8d00
Fix 10672: crash: CheckAutoVariables ( #3657 )
2022-01-01 00:14:36 +01:00
Paul Fultz II
d69257e8cd
Fix 9740: FP accessMoved related to designated initialization ( #3644 )
2021-12-19 12:36:48 +01:00
Paul Fultz II
ac4f4258a0
Fix 10651: Crash on static template method ( #3633 )
2021-12-16 22:32:44 +01:00
Paul Fultz II
16110b6157
Fix 10339: Lambda in leads to analysis fail ( #3629 )
2021-12-15 19:34:18 +01:00
Paul Fultz II
c0af66bb52
Fix 10552: Internal error with unusedFunction ( #3600 )
2021-12-05 15:46:17 +01:00
Paul Fultz II
35f14962fc
Regression test for 9523: Syntax Error: AST broken, 'if' doesn't have two operands. ( #3602 )
2021-12-04 17:03:02 +01:00
Paul Fultz II
29dbded4af
Fix 10615: Crash in Token::linkAt ( #3599 )
2021-12-04 12:57:59 +01:00
Paul Fultz II
bc31419da0
Fix 9301: Syntax error when specializing template variable array ( #3601 )
2021-12-04 12:56:25 +01:00
chrchr-github
ca311ebcdf
ASSERT() on calls to Tokenizer::tokenize() in test code ( #3501 )
2021-11-29 07:34:39 +01:00
chrchr-github
22eeeed17a
Add test for #6342 ( #3569 )
...
* Add test for #6342
* Format
2021-11-18 20:25:21 +01:00
chrchr-github
77069d810c
Add test case ( #3554 )
2021-11-08 20:31:45 +01:00
Paul Fultz II
5c3b69fe96
Fix 10496: crash: endless recursion (symbolDatabaseCreateExprId => isSameExpr => isSameExpr ...) ( #3467 )
2021-09-25 11:55:49 +02:00
Paul Fultz II
edd435d5f0
Fix 10491: Crash in unusedFunction on valid C++ code ( #3465 )
2021-09-22 13:03:46 +02:00
Daniel Marjamäki
0d31486264
Fixed #10403 (Wrong AST for destructor call)
2021-08-28 22:11:30 +02:00
Paul Fultz II
c0765c451d
Fix 10139: AST broken; std::enable_if_t<> ( #3424 )
2021-08-28 09:28:56 +02:00
Paul Fultz II
422e411b6c
Fix 9444: Syntax error on valid C++14 code ( #3403 )
2021-08-15 07:43:02 +02:00
Paul Fultz II
6d65f86871
Fix 9245: Synax error on valid C++14 code: AST broken, binary operator '=' doesn't have two operands. ( #3400 )
2021-08-14 22:50:58 +02:00
Paul Fultz II
818fd248e1
Simplify template keyword bracket ( #3399 )
2021-08-14 21:16:27 +02:00
Paul Fultz II
7f358b2bed
Format with uncrustify ( #3388 )
2021-08-07 20:51:18 +02:00
Paul Fultz II
00eb71fd49
Remove constexpr -> const simplification ( #3346 )
2021-07-22 07:22:26 +02:00
Paul Fultz II
2300a773e1
Fix 10336: AST cyclic dependency on valid C++ code ( #3331 )
2021-07-09 07:22:24 +02:00
Daniel Marjamäki
00a9671f46
misra: implement 8.1
2021-07-07 13:34:55 +02:00
Daniel Marjamäki
e1cff1d1ef
Fixed #10334 (AST: hang with c++ initializer and emplace_back)
2021-06-30 21:40:45 +02:00
Daniel Marjamäki
2a2e071a85
Tokenizer::simplifyAttribute; Set function attribute for function pointer
2021-06-26 14:23:39 +02:00
Paul Fultz II
b13e44fce5
Fix 10309 and 10034: internalAstError with init lists ( #3303 )
2021-06-24 08:25:13 +02:00
Paul Fultz II
6e74fc64b9
Fix 10317: Regression: internalAstError on valid C++ code ( #3302 )
2021-06-24 08:22:03 +02:00
Daniel Marjamäki
3c3435dd10
Fix bug in Tokenizer::simplifyVarDecl
2021-06-06 08:13:40 +02:00
dummyunit
9652ca39a3
Improve support for labels in simplifyAddBraces step ( #3278 )
...
Previously only a single regular label before a compound statement was
allowed in simplifyAddBracesPair() after if/switch/do/while/for.
This patch adds support for:
* case-labels;
* labels before a single statement;
* labels before try/catch blocks;
* multiple consecutive labels.
Additionally the code for skipping a case label was extracted into a
separate function from simplifyLabelsCaseDefault() and reused in
simplifyAddBracesPair().
2021-06-02 07:00:37 +02:00
keinflue
0a84ad874c
Fix case ranges with single quotes and escape sequences ( #3248 )
2021-05-08 11:24:07 +02:00
Daniel Marjamäki
be95e2bf21
Fixed #10271 (AST; Token::astOperand2() cyclic dependency in static_assert)
2021-05-07 13:19:28 +02:00
Daniel Marjamäki
b8de69489d
Fixed #10079 (AST: switch does not have two operands)
2021-05-04 20:15:57 +02:00
Daniel Marjamäki
2f984b201a
AST; Fix wrong AST for initializer list
2021-05-04 19:02:29 +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
70ab30e3c6
AST; Fixed problem with initializer list and cleanup of compileScope
2021-05-03 20:22:08 +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
dummyunit
da27159d7c
Fixed #9728 (Support function level try blocks)
2021-05-02 09:05:12 +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
Daniel Marjamäki
b798b99777
Parser; do not remove alignof and alignas in the same way
2021-04-26 11:44:08 +02:00
Daniel Marjamäki
28a7bb63ec
Parser; simplify (break out) init expression from if/switch/range-for
2021-04-25 14:37:27 +02:00
Daniel Marjamäki
4f43dbf954
Parser; fixed ast and auto type deduction for c++17 braced init lists
2021-04-25 10:38:33 +02:00
Daniel Marjamäki
c9dc92c266
Parser; C++20 for loop with initialization expression
2021-04-24 11:47:51 +02:00
Daniel Marjamäki
26c0945309
Handle c++20 spaceship operator
2021-04-22 19:15:22 +02:00
Daniel Marjamäki
56773b82c4
Simple handling of coroutines
2021-04-18 19:42:22 +02:00
Daniel Marjamäki
fe87afb2f9
TestTokenizer: Align function pointer test case names
2021-04-18 12:33:04 +02:00
Daniel Marjamäki
c98afa83fd
Tokenizer; Add test for c++14 lambda expression 'lambda=[value=1]{...}'
2021-04-16 15:18:02 +02:00
Daniel Marjamäki
11f828a669
Fixed #9415 (C++11: `alignas` not handled -> wrong code -> false negatives)
2021-04-15 20:26:53 +02:00
Daniel Marjamäki
73e698b84d
Fixed #9214 (Tests are run on simplified token list)
2021-04-06 21:21:53 +02:00
Lars Even Almaas
9786f1c34b
Suggested implementation for rule 8.2 ( #3169 )
2021-03-25 08:25:43 +01:00
Daniel Marjamäki
42437277dc
Update Copyright year
2021-03-21 20:58:32 +01:00
Tetrix
9b7f1f6280
simplifyCPPAttribute tokenizer strips alignas ( #3171 )
2021-03-20 10:38:47 +01:00
Rikard Falkeborn
103e52f394
Fix tokenizing of x[i](0) ( Fixes #8875 ) ( #3167 )
...
Fix faulty removal of parenthesis when "]" is followed by parenthesis
with a number inside, for example when calling a function pointer in
an array or (perhaps more common) in c++, calling operator ( on an
element in an array.
Fixes #8875 where such wrong simplification lead to a FP with too many
bits shifted due to "<<" was interpreted like a shift operator rather
than a stream output.
2021-03-11 08:16:25 +01:00
Daniel Marjamäki
7106e1f48f
Moved TestTokenizer::simplifyCasts tests to TestSimplifyTokens
2021-02-27 04:19:54 +01:00
Daniel Marjamäki
81c7fa0348
Moved TestTokenizer::tokenize6 to TestSimplifyTokens
2021-02-27 04:07:33 +01:00