Commit Graph

2805 Commits

Author SHA1 Message Date
Oliver Stöneberg d6eb3a8f40
some changes for clang/clang-tidy 15 (#4310) 2022-07-26 15:30:53 +02:00
Daniel Marjamäki db155a59c1 Tokenizer: remove simplifyTokenList2 2022-07-18 16:20:36 +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 47c2a01392
Fix #11166 inefficient way to remove last character from std::string (#4267)
* Fix #11166 inefficient way to remove last character from std::string

* Format

* Modify message, add test

* Format

* Fix another warning
2022-07-11 23:07:37 +02:00
chrchr-github f5c4a21eae
Fix #10704 FN redundantCopyLocalConst (#4115) 2022-07-10 11:33:24 +02:00
Oliver Stöneberg c9c1f83a69
use `emptyString` more consistently (#4034) 2022-07-10 10:57:29 +02:00
Daniel Marjamäki d8239b26f1 Tokenizer: Remove simplifyCalculations from simplifyTokenList2 2022-07-04 22:54:43 +02:00
Daniel Marjamäki d204c5f894 Tokenizer: Cleanup stuff in simplifyTokenList2 2022-06-25 17:09:51 +02:00
chrchr-github 63e567eb50
Remove simplifyKnownVariables() (#4232)
* Remove simplifyKnownVariables()

* Add some test cases back

* Remove unused functions

* Format
2022-06-25 08:38:17 +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
PKEuS 9eb16e1002
Replaced check for pipe() buffer size by ordinary CheckBufferOverrun, provide required Library configuration option (#4183)
Merged from LCppC.
2022-06-19 12:01:55 +02:00
Daniel Marjamäki 6873f5237b Tokenizer: removing more stuff from simplifyTokenList2 2022-06-19 10:41:15 +02:00
Daniel Marjamäki a7815ed5b0 Tokenizer: Remove more stuff from simplifyTokenList2 2022-06-18 07:31:36 +02:00
Daniel Marjamäki aa8c17a701 Tokenizer: remove stuff from simplifyTokenList2 2022-06-17 09:44:58 +02:00
Daniel Marjamäki dbb12cb333 Tokenizer: Remove some functions from simplifyTokenList2 2022-06-16 14:06:07 +02:00
Paul Fultz II 46fcdca5ee
Add debug_valuetype intrinsic (#4210) 2022-06-15 21:25:55 +02:00
Daniel Marjamäki 343d04feb4 Tokenizer: Remove simplifyCharAt from simplifyTokenList2 2022-06-12 15:14:48 +02:00
PKEuS cb382ac52c
C++20 support: Support consteval and constinit (#4203)
Backported from LCppC.
2022-06-11 15:28:20 +02:00
Daniel Marjamäki 533b3e2bcb Tokenizer: Clarify code. The variableMap.find, variableMap.end was not strictly matching. 2022-06-11 09:47:06 +02:00
PKEuS 99ce89c003
Improvement: Set varId for variables with global scope operator :: Refactorization: Moved internal class from tokenize.h to tokenize.cpp (#4184)
Merged from LCppC.
2022-06-11 08:11:16 +02:00
Daniel Marjamäki 375880988c Tokenizer: remove removeRedundantAssignment from simplifyTokenList2 2022-06-10 12:35:05 +02:00
Daniel Marjamäki a76ba698c2 Tokenizer: remove simplifyCompoundAssignment from simplifyTokenList2 2022-06-09 07:38:27 +02:00
Daniel Marjamäki c0f3d5b2fb Tokenizer: remove simplifyAssignmentInFunctionCall used in simplifyTokenList2 2022-06-08 19:08:18 +02:00
PKEuS 1275b5275e
LCppC backport: Various optimizations (#4182)
* Optimization: Use Token::eIncDecOp instead of expensive Token::Match calls

Merged from LCppC.

* Small Optimizations: - Moved a std::set that is only need during initialization of SymbolDatabase to function scope - Use std::vector instead of std::list

Merged from LCppC.

* Optimization: Refactorized various Token::Match calls and surrounding conditions

Merged from LCppC.

* Refactorization: Cleanup usage of std::multimap

Merged from LCppC.
2022-06-08 16:58:57 +02:00
Daniel Marjamäki 86a8d88729 Tokenizer: Remove simplification of math functions from simplifyTokenList2 2022-06-08 09:58:11 +02:00
chrchr-github bb3f490edd
Fix #11090 Infinite recursion in findTypeInBase() (#4178) 2022-06-08 09:20:16 +02:00
Paul Fultz II e430a11b49
Add debug_valueflow instrinsic to show valueflow values and its error path (#4159)
* Add debug_valueflow instrinsic to show valueflow values and its error path

* Format
2022-06-01 06:53:21 +02:00
chrchr-github 2ceaf308de
Fix #11084: ValueType for pointer typedef, don't warn for typedef'd pointers, improve error message (#4123)
* Fix ValueType for pointer typedef

* Add test

* Don't warn for typedef'd pointers, improve error message

* Fix tests

* Add TODO

* Fix test

* Set isSimplifiedTypedef() for more tokens, add test

* Add test
2022-05-24 10:09:48 +02:00
Daniel Marjamäki 03c9253962 Token: add isRestrict flag 2022-05-22 14:10:55 +02:00
Paul Fultz II e2c35abde5
Fix 11050: False positive: unreadVariable for class variable when another function uses the same variable name (#4121) 2022-05-22 09:20:32 +02:00
Paul Fultz II a62fb986a5
Fix 11090: Infinite recursion in findTypeInBase() (#4120) 2022-05-21 08:24:29 +02:00
chrchr-github 52f507d1fb
Fix #8004 unintentional semicolon in expression '.. ; +dostuff();' (#4109)
* Fix #8004 unintentional semicolon in expression '.. ; +dostuff();'

* Improve error message

* Don't remove single unary + in front of variables
2022-05-13 06:54:02 +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
chrchr-github 759c16fcef
Fix boolean expressions (#4099)
* Enable experimental check

* Remove experimental

* Don't compare Booleans using relational operators

* Fix boolean expressions
2022-05-10 20:42:24 +02:00
Daniel Marjamäki 0a4e2abf01 dump: add token isComplex attribute 2022-05-10 19:05:02 +02:00
chrchr-github e2bb77f990
Remove severity 'experimental' from checkComparisonOfBoolWithBool() (#4097)
* Enable experimental check

* Remove experimental

* Don't compare Booleans using relational operators
2022-05-10 18:25:13 +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 961ecfbe33
Fix #11003 cppcheckError with nested template arguments (#4049) 2022-04-25 22:23:06 +02:00
chrchr-github b4df064875
Fix #11004 FP AssignmentIntegerToAddress with volatile (#4046) 2022-04-25 22:00:37 +02:00
chrchr-github c8936d04f6
Fix #3886 New Check : Return value of "new" ignored (#3884) 2022-04-09 19:06:32 +02:00
Oliver Stöneberg 25ef9eeb26
use std::string::empty() (#3910) 2022-04-09 19:02: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