Commit Graph

13734 Commits

Author SHA1 Message Date
Paul Fultz II 8945c151f5
Fix 11124: FP knownConditionTrueFalse with fruit (#4196)
* Update valueType

* Allow comparisons

* Fix compare op

* Add test

* Format

* Fix FP

* Format
2022-06-11 11:02:04 +02:00
chrchr-github 8579feb3aa
Fix #10545 FP redundantCopyLocalConst with modified object [inconclusive] (#4197)
* Fix  #10545 FP redundantCopyLocalConst with modified object [inconclusive]

* Comment
2022-06-11 11:01:23 +02:00
Paul Fultz II 653a1ea83e
Fix 11100: FP knownConditionTrueFalse with getter/setter member functions (#4198)
* Fix 11100: FP knownConditionTrueFalse with getter/setter member functions

* Format
2022-06-11 11:00:40 +02:00
PKEuS 82af702c6f
LCppC backport: Restored Check: Detect negative VLA and allocation (new[]) sizes (#4187) 2022-06-11 09:55:38 +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
Paul Fultz II c9b85010f9
Fix 11096: FP knownConditionTrueFalse in do while loop (#4192)
* Check for loop

* Improve handling of exit values

* Add more checks to test

* Simplify

* Remove unnecessary test

* Fix typo

* Format

* Use simpleMatch
2022-06-10 20:42:02 +02:00
chrchr-github 829ca9ab7f
Fix #10935 FP: compareBoolExpressionWithInt with enum and template parameter (#4193) 2022-06-10 20:40:37 +02:00
chrchr-github 51c8630bb3
Fix #10618 FP knownConditionTrueFalse with virtual function (#4194)
* Fix #10618 FP knownConditionTrueFalse with virtual function

* Remove redundant check
2022-06-10 20:17:57 +02:00
Daniel Marjamäki 375880988c Tokenizer: remove removeRedundantAssignment from simplifyTokenList2 2022-06-10 12:35:05 +02:00
chrchr-github 90392faa2b
Fix crash on nullptr deref (#4189) 2022-06-09 18:25:17 +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
PKEuS 4bd189c3c8
Refactorization: Faster calculation of CRC32 by avoiding to create a temporary string. Use proper types in checksum functions. (#4180)
Merged from LCppC
2022-06-08 16:55:06 +02:00
PKEuS 898a3a25a1
ValueType: Added additional unit test (#4185)
Removed unnecessary library export

Backported from LCppC.
2022-06-08 15:27:56 +02:00
PKEuS d20ea41325
Refactorization: Removed compatibility hacks for outdated or non-conformant compilers (#4186)
Merged from LCppC.
2022-06-08 15:16:01 +02:00
PKEuS 44097b59ff
Implemented error handling in cppcheck::Platform::loadFromXmlDocument(), enabled related unit test (#8409) (#4181) 2022-06-08 12:35:23 +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
Oliver Stöneberg 9367be804e
fixed `modernize-use-equals-delete` warnings in headers (#4177) 2022-06-07 21:25:23 +02:00
chrchr-github 69834d537b
Fix #9997 False negative: variable is not used (#4104) 2022-06-07 21:20:33 +02:00
chrchr-github 1d677c57a8
Fix #11126 FN: noExplicitConstructor with single default parameter (#4174) 2022-06-07 21:15:13 +02:00
chrchr-github b80d06b69e
Don't warn for 'x | MACRO' when MACRO is 0 (#4176) 2022-06-07 21:13:31 +02:00
chrchr-github 52453947c8
Don't warn for 'x | 0' in macro (#4172)
* Fix #11082 FN badBitmaskCheck for binary or with 0

* Add test for #10703

* Don't warn for 'x | 0' in macro

* Add test for #10876
2022-06-06 11:17:36 +02:00
chrchr-github f962436826
Fix #11082 FN badBitmaskCheck for binary or with 0 (#4170)
* Fix #11082 FN badBitmaskCheck for binary or with 0

* Add test for #10703
2022-06-04 17:25:10 +02:00
orbitcowboy 433ce58fe6 Fixed FP found with daca@home: ftp://ftp.de.debian.org/debian/pool/main/libs/libslirp/libslirp_4.7.0.orig.tar.bz2; head libslirp-v4.7.0/src/tftp.c:336:20: error: Invalid strcasecmp() argument nr 1. A nul-terminated string is required. [invalidFunctionArgStr] 2022-06-04 12:00:54 +02:00
orbitcowboy 1c1c72058f Fixed FP found with daca@home: ftp://ftp.de.debian.org/debian/pool/main/libs/libslirp/libslirp_4.7.0.orig.tar.bz2; head libslirp-v4.7.0/src/tftp.c:336:20: error: Invalid strcasecmp() argument nr 1. A nul-terminated string is required. [invalidFunctionArgStr] 2022-06-04 07:46:28 +02:00
Oliver Stöneberg ce945ec7fc
enabled and fixed `modernize-use-override` clang-tidy warnings (#4168) 2022-06-03 21:32:39 +02:00
chrchr-github e6f2929fac
Fix #11085 FN constVariable with range-based for (#4118) 2022-06-03 19:24:59 +02:00
Oliver Stöneberg cc08a661e6
astutils.h: reserve `std::vector` space in `visitAstNodes()` to avoid excess allocations (#4158) 2022-06-03 19:21:17 +02:00
orbitcowboy 00abf21d40 Format 2022-06-03 18:59:43 +02:00
orbitcowboy a74bb485b0 Fixed TODO_ASSERT 2022-06-03 18:59:09 +02:00
orbitcowboy 6680bf9790 Fixed TODO_ASSERT 2022-06-03 18:35:11 +02:00
Oliver Stöneberg d36e05af28
enabled and fixed `modernize-use-emplace` clang-tidy warnings (#4165)
* enabled and fixed `modernize-use-emplace` clang-tidy warnings

* avoid unnecessary creation of temporaries in `emplace_back()` calls
2022-06-03 15:09:29 +02:00
chrchr-github 111f4e17da
Fix #11117 FP nullPointerArithmetic when adding 0 (#4167) 2022-06-03 13:11:54 +02:00
orbitcowboy 1a4bd0a7b3 Fixed FP, found with daca@home: ftp://ftp.de.debian.org/debian/pool/main/k/knot/knot_3.1.8.orig.tar.xz; knot-3.1.8/tests/knot/test_confio.c:301:18: error: Invalid strcmp() argument nr 2. A nul-terminated string is required. [invalidFunctionArgStr] 2022-06-03 13:10:45 +02:00
orbitcowboy 7dac213734 Removed useless parentheses 2022-06-03 10:50:07 +02:00
orbitcowboy 9b0f41e1a0 Revert change 3dfe9eff3e (commitcomment-75236431). 2022-06-03 10:22:29 +02:00
orbitcowboy c24edc528e astutils.cpp: Removed useless parentheses 2022-06-03 00:18:35 +02:00
orbitcowboy 3dfe9eff3e astutils.cpp: Improved const correctness 2022-06-03 00:07:15 +02:00
Paul Fultz II 72342de0da
Fix 11114: FP knownConditionTrueFalse across functions (#4163)
* Fix 11114: FP knownConditionTrueFalse across functions

* Format
2022-06-02 23:24:11 +02:00
orbitcowboy 67795cdfcf
Fixed FPs from Ticket 11119 - invalidFunctionArgStr with null-terminated strings (#4164)
* Fixed first FP from #11119 - invalidFunctionArgStr with null-terminated strings

* Fixed second test case from #11119.

* Fixed another FP, found on daca@home ftp://ftp.de.debian.org/debian/pool/main/g/glhack/glhack_1.2.orig.tar.gz.

* Format
2022-06-02 19:30:29 +02:00
orbitcowboy 58460edaf8 Fixed crash due to missing null pointer check. 2022-06-02 11:32:55 +02:00
orbitcowboy 7275350f3e Combined consecutive Token::simpleMatch() calls 2022-06-02 07:27:19 +02:00
orbitcowboy 3b2509c9cc Fixed failing self-check: style: Call to 'Token::previous()' followed by 'Token::tokAt()' can be simplified. [redundantNextPrevious] 2022-06-02 07:16:09 +02:00
orbitcowboy 886b5d1039 Improved invalidFunctionArgStr checking and detect more cases where a NON-null-terminated string is used to call functions, configured with <strz/>. 2022-06-02 01:09:09 +02:00
chrchr-github cd7362e0e7
Fix FN with default init (#4162)
* Fix #11099 FP: variableScope when using range constructor to vector

* Format

* Fix FN with default init
2022-06-01 23:18:59 +02:00
chrchr-github 2452a2c01d
Fix #11099 FP: variableScope when using range constructor to vector (#4161)
* Fix #11099 FP: variableScope when using range constructor to vector

* Format
2022-06-01 21:15:41 +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