Commit Graph

11941 Commits

Author SHA1 Message Date
chrchr-github a62c3ea90e
Fix #11234 Broken AST with auto**, FP constStatement (#4339) 2022-08-03 19:03:38 +02:00
chrchr-github 0eabe0505b
Handle float values (#4336) 2022-08-02 22:11:31 +02:00
chrchr-github 71f9a7269f
Add test for #6541, #5475, avoid duplicate warning (#4335)
* Add test for #6541, avoid duplicate warning

* Add test for #5475

* Fix test
2022-08-02 21:43:18 +02:00
chrchr-github bc409776e3
Fix #10320 Wrong redundant condition: misleading/wrong message (#4334)
* Fix #10320 Wrong redundant condition: misleading/wrong message

* Use expressionString()

* Clarify condition

* Update testcondition.cpp

* Trigger CI
2022-08-02 18:31:02 +02:00
chrchr-github 92d569afb6
#11233 FP: knownConditionTrueFalse (wrong message text) (#4330)
* #11233 FP: knownConditionTrueFalse (wrong message text)

* Format

* Update testcondition.cpp

* Trigger CI
2022-08-02 18:18:46 +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 c878285a42
Add tests for #5804, #8958, #9002, #10031 (#4326) 2022-07-30 16:15:32 +02:00
orbitcowboy 1934386738 windows.cfg: deprecate '_alloca()'. Ref. https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/alloca?view=msvc-170 2022-07-29 21:41:32 +02:00
Oliver Stöneberg efaaa58896
fixed some `modernize-use-emplace` false negatives and some `bugprone-assignment-in-if-condition` warnings (#4311) 2022-07-28 22:53:59 +02:00
chrchr-github 304e448749
Fix #8476 --check-library reports missing configuration for static_assert (#4314) 2022-07-28 22:47:15 +02:00
chrchr-github c340b6ae6c
Fix #11191 FP moduloofone with pow() (#4312) 2022-07-28 22:11:23 +02:00
Daniel Marjamäki 898ad314ab badBitmaskCheck: Avoid FP when there is #ifdef in expression 2022-07-28 21:56:05 +02:00
chrchr-github 3fc276fb51
Add test for #11061 (#4307) 2022-07-26 11:14:35 +02:00
chrchr-github 58d7185d64
Fix #10077 FP functionConst when overloaded operator ++ is used (#4309) 2022-07-26 08:30:59 +02:00
chrchr-github 15f8c71ec3
Fix #9946 FP: unassignedVariable when operator() is called subsequently (#4303) 2022-07-24 17:52:14 +02:00
chrchr-github 479533a80a
Rework fix for #11008 (#4296) 2022-07-24 12:15:04 +02:00
chrchr-github 1aceded300
Fix #10977 FP noExplicitConstructor with variadic template (#4301) 2022-07-24 10:18:19 +02:00
chrchr-github 0d72216cca
Fix BufferOverrun TODO (#4300)
* Fix BufferOverrun TODO

* clang-tidy
2022-07-22 07:24:34 +02:00
chrchr-github 79f091c59a
Fix uselessCallsConstructor TODOs (#4299)
* Fix uselessCallsConstructor TODOs

* Format
2022-07-21 22:15:16 +02:00
chrchr-github 5342e2cd03
Fix #11037 FP knownConditionTrueFalse with dynamic_cast (#4297) 2022-07-20 20:48:17 +02:00
chrchr-github 457a0cff87
Fix #11016 FP unusedStructMember when used through iterator (regression) (#4289)
* Format

* Fix #11016 FP unusedStructMember when used through iterator (regression)

* Format

* Fix test

* Format

* Nullptr check
2022-07-19 20:42:54 +02:00
chrchr-github 5e537a666f
Fix --check-library warning for int(i) (#4293) 2022-07-19 20:41:18 +02:00
chrchr-github c736fe8787
Fix #11008 FP doubleFree with pointer in struct (#4294) 2022-07-19 20:41:08 +02:00
chrchr-github 6dc606fd6a
Add tests for #8446, #10750, #10894 (#4287) 2022-07-18 18:03:08 +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
orbitcowboy 4de443957c gnu.cfg: Added support for error() function. And a TODO testcase for ticket #11197. 2022-07-17 14:43:52 +02:00
chrchr-github 4894cdab8f
Fix #11108 FP unreadVariable with unique_ptr and unknown c'tor (#4284)
* Fix #11108 FP unreadVariable with unique_ptr and unknown c'tor

* Fix test
2022-07-16 23:46:55 +02:00
chrchr-github b16d12b5fb
Improve check for wchar_t (#4285) 2022-07-16 23:46:10 +02:00
chrchr-github 109a031ec7
Fix #11195 Add redundantContinue check (#4283) 2022-07-16 16:02:58 +02:00
chrchr-github 9e74da6126
Fix #11098 FP compare with negated constant (#4282) 2022-07-16 07:28:15 +02:00
chrchr-github 71d386819e
Fix #10356 FP bufferAccessOutOfBounds is reported on strncmp() (#4281)
* Add test

* Fix #10356 FP bufferAccessOutOfBounds is reported on strncmp()

* Remove suppressions
2022-07-15 17:43:18 +02:00
chrchr-github 53cd3dc665
Fix #10661 FP extern function reported as unused (#4279) 2022-07-14 20:59:58 +02:00
chrchr-github 2543dc97d2
Fix FP bitwiseOnBoolean (#4280) 2022-07-14 20:59:39 +02:00
chrchr-github 2c7d98626a
Fix FP leakNoVarFunctionCall with Qt object (#4272)
* Add missing <leak-ignore/>, test

* Fix qt.cfg, format

* Fix FP leakNoVarFunctionCall

* Format

* Delete memory, rule of five

* Missing include

* Avoid dependency

* explicit

* Fix Qt test case

* Fix typo

* Fix

* Add Q_OBJECT
2022-07-13 21:09:53 +02:00
chrchr-github 6eab3cb8bd
Fix #9788 ctu: false negative array index out of bounds for array arguments (#4277) 2022-07-13 21:08:51 +02:00
chrchr-github 49117f5aeb
Fix #7375 static_assert shouldn't be reported by --check-library (#4276)
* No need to check smart pointers, since they take template arguments

* Fix #7375 static_assert shouldn't be reported by --check-library
2022-07-13 21:08:43 +02:00
chrchr-github b31e40f578
Add tests for #4336, #4739, #8319, #6655 (#4275)
* Add tests for #4336, #4739

* Add test for #8319

* Add test for #6655
2022-07-13 21:08:30 +02:00
Daniel Marjamäki b387ae80f1 Fixed whole program analysis 2022-07-12 22:58:52 +02:00
Daniel Marjamäki fa5fd9cae0 Fixed #11172 (Unmatched suppression for inline suppression even though --suppress=unmatchedSuppression is used) 2022-07-12 22:51:26 +02:00
PKEuS f3565e1056
Improvement: Support member variables in CheckOther::checkIncompleteArrayFill() (#4205)
Merged from LCppC.
2022-07-12 19:43:48 +02:00
chrchr-github 381c38b2f5
Improve check: uselessCallsConstructor (#4270) 2022-07-12 17:40:14 +02:00
Oliver Stöneberg 22be5f29aa
fixed #11183 (checkLibraryFunction with parameter to "std::string()") / added rudimentary tests for `CheckFunctions::checkLibraryMatchFunctions()` / added test for #10105 (#4265) 2022-07-12 17:39:01 +02:00
Oliver Stöneberg aea4fd1068
some `TestSuppressions` improvements and cleanups (#4271) 2022-07-12 17:36:36 +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 c5dcd49dae
Fix #4233 FN: Bitwise operation with bool and int (#4266)
* Fix #4233 FN: Bitwise operation with bool and int

* Format
2022-07-11 22:58:37 +02:00
chrchr-github 8fc75402a1
Fix #11179 FP invalidFunctionArgStr (#4264) 2022-07-11 22:58:19 +02:00
chrchr-github f9337b725b
Fix nullptr deref (#4262)
* Fix some FNs related to c_str()

* Format, fix FP

* Fix nullptr deref

* Fix merge
2022-07-11 22:58:08 +02:00
chrchr-github c218859418
Fix some FNs related to c_str() (#4258) 2022-07-10 11:38:01 +02:00
chrchr-github f5c4a21eae
Fix #10704 FN redundantCopyLocalConst (#4115) 2022-07-10 11:33:24 +02:00
Oliver Stöneberg c36320747f
some `missingInclude`/`missingIncludeSystem` fixes and tests (#4027)
* do not emit `missingInclude` and `missingIncludeSystem` errors when not enabled / fixed and improved TestPreprocessor::inline_suppression_for_missing_include()

* testpreprocessor.cpp: added missing tests for `missingInclude` and `missingIncludeSystem`

* cppcheckexecutor.cpp: `missingIncludeSystem` was not emitted in normal analysis if `missingInclude` existed

* dmake

* added `run-dmake` as `testrunner` dependency
2022-07-09 23:21:11 +02:00
orbitcowboy c117f62926 Fixed zerodiv/moduloofone FNs for more math functions 2022-07-09 22:36:17 +02:00
orbitcowboy 8215521843 Fixed zerodiv/moduloofone FNs for more math functions 2022-07-09 19:59:16 +02:00
orbitcowboy ef47d34e75 Fixed zerodiv/moduloofone FNs for more math functions 2022-07-09 19:21:58 +02:00
orbitcowboy 0282c3a86e Fixed zerodiv/moduloofone FN for '1/std::expm1(0)' 2022-07-09 17:52:58 +02:00
orbitcowboy 07eeee1620 Fixed zerodiv FN for '1/std::exp2(0)' 2022-07-09 17:47:21 +02:00
orbitcowboy 048d31ec56 Fixed zerodiv FN for '1/std::erfc(42)' 2022-07-09 17:43:17 +02:00
orbitcowboy 87c1e6587a Fixed zerodiv FN for '1/std::erf(0)' 2022-07-09 17:38:28 +02:00
orbitcowboy c777cd5060 Fixed zerodiv FN for '1/std::ceil(0)' 2022-07-09 17:32:32 +02:00
orbitcowboy 41b6452604 Fixed zerodiv FN for '1/std::cbrt(0)' and added more test cases for other math functions 2022-07-09 17:28:15 +02:00
orbitcowboy a8816a2d2f std.cfg: Improved configuration of some math functions and added more regression tests 2022-07-09 16:32:21 +02:00
orbitcowboy c2e132b1a3 std.cfg: Improved configuration of asinh(). 2022-07-09 16:14:58 +02:00
orbitcowboy 2f41a8dbdd std.cfg: Improved zerodiv test of math functions and demonstrate that constants from <cmath> can be applied as well. 2022-07-09 10:09:43 +02:00
Paul Fultz II 6b72274c67
Evaluate math library functions in valueflow (#4255)
* Evaluate math library functions in valueflow

* Format
2022-07-09 07:40:32 +02:00
Paul Fultz II edebe746bc
Fix 10361: false negative: uninitvar (std::next(iterator)) (#4256) 2022-07-09 07:39:04 +02:00
Paul Fultz II 0b63e7273d
Fix 11162: FP: knownConditionTrueFalse (#4254)
* Fix 11162: FP: knownConditionTrueFalse

* Format
2022-07-09 00:57:25 +02:00
Oliver Stöneberg b51aea5531
separated process execution code into `ProcessExecutor` (#4249) 2022-07-08 16:42:57 +02:00
Tau c17e2b9826
Correctly interpret boolean literals in `execute()` (#4251)
* Correctly interpret boolean literals in `execute()`

* Add regeression test case for boolean literals
2022-07-08 12:39:29 +02:00
chrchr-github bd92e7411c
Fix #11163 Hang on smart pointer with auto type deduction (#4250)
* Fix #11163 Hang on smart pointer with auto type deduction

* Format

* Format
2022-07-08 12:37:53 +02:00
chrchr-github 89a9e5ecc6
Fix #9944 FP: terminateStrncpy doesn't account for size check (#4252)
* Fix #9944 FP: terminateStrncpy doesn't account for size check

* Fix container size check

* Undo

* Format

* Rebuild

* Rebuild
2022-07-08 12:35:21 +02:00
Daniel Marjamäki d1812c8022 Cppcheck: Write product name if provided in xml output 2022-07-07 17:35:13 +02:00
Daniel Marjamäki d8239b26f1 Tokenizer: Remove simplifyCalculations from simplifyTokenList2 2022-07-04 22:54:43 +02:00
chrchr-github 22aeeb1788
Fix ClangImport crash on Windows paths (#4246)
* Fix crash on Windows paths

* Fix test

* Enable fix

* Cut trailing ':'
2022-07-02 17:43:52 +02:00
orbitcowboy b170a9c61e wxwidgets.cfg: Fixed wrong configuration of wxRegEx::GetMatch(). 2022-07-02 09:24:22 +02:00
chrchr-github 596f75e2af
Fix FP compareValueOutOfTypeRangeError (#4245)
* Fix FP compareValueOutOfTypeRangeError

* Remove suppressions
2022-07-01 10:48:32 +02:00
chrchr-github 27578e9c4c
Fix FP returnStdMoveLocal (#4244) 2022-06-30 13:50:31 +02:00
chrchr-github d8e64b4cbb
Fix FP leakNoVarFunctionCall (#4243)
* Fix #10857 FN: leakNoVarFunctionCall

* Fix TODO

* Fix #10858 FN: leakNoVarFunctionCall (if ( b && malloc ) )

* #11155 FN: leakNoVarFunctionCall (ternary operator)

* Fix #11157 FN: leakNoVarFunctionCall (switch condition)

* Fix FN constStatement

* Fix FP leakNoVarFunctionCall

* Fix FP leakNoVarFunctionCall

* Format

* Fix FP leakNoVarFunctionCall with unknown function

* Fix FP leakNoVarFunctionCall
2022-06-30 13:05:28 +02:00
chrchr-github 06b408ea20
Fix FP leakNoVarFunctionCall with unknown function (#4242)
* Fix #10857 FN: leakNoVarFunctionCall

* Fix TODO

* Fix #10858 FN: leakNoVarFunctionCall (if ( b && malloc ) )

* #11155 FN: leakNoVarFunctionCall (ternary operator)

* Fix #11157 FN: leakNoVarFunctionCall (switch condition)

* Fix FN constStatement

* Fix FP leakNoVarFunctionCall

* Fix FP leakNoVarFunctionCall

* Format

* Fix FP leakNoVarFunctionCall with unknown function
2022-06-29 13:43:17 +02:00
chrchr-github b90a726441
Fix FP leakNoVarFunctionCall (#4241)
* Fix #10857 FN: leakNoVarFunctionCall

* Fix TODO

* Fix #10858 FN: leakNoVarFunctionCall (if ( b && malloc ) )

* #11155 FN: leakNoVarFunctionCall (ternary operator)

* Fix #11157 FN: leakNoVarFunctionCall (switch condition)

* Fix FN constStatement

* Fix FP leakNoVarFunctionCall

* Fix FP leakNoVarFunctionCall

* Format
2022-06-29 07:22:26 +02:00
Paul Fultz II 185294499c
Adjust the severity of the uninitvar (#4234) 2022-06-28 22:52:35 +02:00
chrchr-github f8b796403b
Fix #11146 Crash in expandTemplate() (#4238) 2022-06-28 22:43:34 +02:00
chrchr-github 2223cd24b9
Fix #11157 FN: leakNoVarFunctionCall (switch condition) (#4240)
* Fix #10857 FN: leakNoVarFunctionCall

* Fix TODO

* Fix #10858 FN: leakNoVarFunctionCall (if ( b && malloc ) )

* #11155 FN: leakNoVarFunctionCall (ternary operator)

* Fix #11157 FN: leakNoVarFunctionCall (switch condition)

* Fix FN constStatement

* Fix FP leakNoVarFunctionCall
2022-06-28 14:02:02 +02:00
chrchr-github cdeebc15ea
Fix #11155 FN: leakNoVarFunctionCall (ternary operator) (#4239)
* Fix #10857 FN: leakNoVarFunctionCall

* Fix TODO

* Fix #10858 FN: leakNoVarFunctionCall (if ( b && malloc ) )

* #11155 FN: leakNoVarFunctionCall (ternary operator)
2022-06-27 20:55:09 +02:00
chrchr-github e7e23e87c2
Fix #10858 FN: leakNoVarFunctionCall (if ( b && malloc ) ) (#4237)
* Fix #10857 FN: leakNoVarFunctionCall

* Fix TODO

* Fix #10858 FN: leakNoVarFunctionCall (if ( b && malloc ) )
2022-06-27 19:35:22 +02:00
chrchr-github 88bf11abba
Fix #10857 FN: leakNoVarFunctionCall (#4236)
* Fix #10857 FN: leakNoVarFunctionCall

* Fix TODO
2022-06-27 14:19:19 +02:00
chrchr-github 242afc389d
Fix #11148 Regression: Parameter \'ptr\' can be declared as pointer to const (#4233) 2022-06-25 21:42:55 +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 11860cce4b
Add test for #10463 (#4231)
* Add test for #10643

* Comment

* Fox comment
2022-06-24 13:55:04 +02:00
chrchr-github 60c1eef659
Fix FP containerOutOfBounds with std::map (#4230) 2022-06-23 20:26:47 +02:00
chrchr-github f1212e66f7
Fix FP constVariable with 2D array. (#4228)
Test case #8717 was actually a FP as well.
2022-06-22 21:22:04 +02:00
Daniel Marjamäki 1d5166d70c CheckClass: Fix false negatives for uninitMemberVar 2022-06-21 19:28:08 +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
chrchr-github 0d4b4394bb
Fix FP with embedded zeros (#4226)
* Partial fix for #11137 FN: invalidFunctionArgStr printf argument

* Typo

* Remove <strz>, suppressions

* Add suppresion, remove <strz>

* Add suppressions

* Fix FP with embedded zeros

* Merge
2022-06-21 13:33:45 +02:00
chrchr-github de2509f1ac
Fix FP with complex array size expression (#4225)
* Partial fix for #11137 FN: invalidFunctionArgStr printf argument

* Typo

* Remove <strz>, suppressions

* Add suppresion, remove <strz>

* Add suppressions

* Fix FP with complex array size expression
2022-06-21 00:12:11 +02:00
chrchr-github 5b9fa9657d
Partial fix for #11137 FN: invalidFunctionArgStr printf argument (#4224)
* Partial fix for #11137 FN: invalidFunctionArgStr printf argument

* Typo

* Remove <strz>, suppressions

* Add suppresion, remove <strz>

* Add suppressions
2022-06-20 20:02:22 +02:00
Paul Fultz II 6843bf628b
Use the correct test name for SKIP_TESTS (#4221) 2022-06-19 19:26:49 +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
orbitcowboy 3dcdd5f264 std.cfg: Added a TODO test case 2022-06-19 10:13:22 +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 968d8d153e Fixed #11101 (False positive: derived union members are initialized in constructor) 2022-06-16 20:17:57 +02:00
Paul Fultz II 3e09503561
Fix 11087: false negative: usage of reference to member of temporary object not detected (#4217)
* Fix 11087: false negative: usage of reference to member of temporary object not detected

* Format

* Add another test case

* Fix FP with pointer

* Format
2022-06-16 19:26:36 +02:00
Paul Fultz II 9cecc8468e
Fix 10570: Improve check; condition then pointer dereference, different pointers (#4216)
* Try to use after assign in loop

* Update valueflow forward to handle init tokens

* Fix tests

* Make test TODO

* Format

* Add tests

* Format

* Fix ubsan error

* Use simpleMatch
2022-06-16 19:26:23 +02:00
Paul Fultz II de51ebbcf4
Fix 9135: Access of moved variable not detected in loop (#4215)
* Fix 9135: Access of moved variable not detected in loop

* Format

* Fix issue with pushing back on container

* Format

* Fix null pointer

* Remove yeild for now
2022-06-16 17:40:09 +02:00
Daniel Marjamäki dbb12cb333 Tokenizer: Remove some functions from simplifyTokenList2 2022-06-16 14:06:07 +02:00
chrchr-github 176eefcbf3
Fix #10655 FN bitwiseOnBoolean with unseen function (#4214) 2022-06-14 23:08:17 +02:00
chrchr-github de9b65c737
Add tests for #9194, #10415, #4759, #9876, #10006 (#4213)
* Add test for #10152

* Add test for #9773

* Fix test

* Add test for #7529

* Add test for #6371

* Add test for #6475

* Format

* Format

* Fix test

* Remove duplicate test

* Add valueflow test

* Rebuild

* Add tests for #9194, #10415, #4759, #9876, #10006
2022-06-14 13:05:07 +02:00
chrchr-github 6d22d6a8ae
Fix FP unusedVar with side effects in destructor (#4212) 2022-06-14 09:55:22 +02:00
chrchr-github 6f5a5fd947
Add some tests (#4211)
* Add test for #10152

* Add test for #9773

* Fix test

* Add test for #7529

* Add test for #6371

* Add test for #6475

* Format

* Format

* Fix test

* Remove duplicate test

* Add valueflow test

* Rebuild
2022-06-14 09:54:45 +02:00
Daniel Marjamäki 343d04feb4 Tokenizer: Remove simplifyCharAt from simplifyTokenList2 2022-06-12 15:14:48 +02:00
Daniel Marjamäki 8255e32540 cppcheck build dir: do not produce invalid dump file if code is unchanged and checking is skipped. 2022-06-12 11:08:28 +02:00
Paul Fultz II d4fb5652c0
Fix 10619: Valueflow: Library function in subfunction does not propagate all values (#4209) 2022-06-12 07:17:28 +02:00
Paul Fultz II bd63534a1c
Fix 10740: valueflow; conditional value. incremented value is oob. (#4208) 2022-06-12 07:16:28 +02:00
chrchr-github ecb24e28bc
Fix #10191 FP redundantCopyLocalConst - referenced variable changes (#4202) 2022-06-11 16:58:33 +02:00
PKEuS cb382ac52c
C++20 support: Support consteval and constinit (#4203)
Backported from LCppC.
2022-06-11 15:28:20 +02:00
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
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 898a3a25a1
ValueType: Added additional unit test (#4185)
Removed unnecessary library export

Backported from LCppC.
2022-06-08 15:27:56 +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
Daniel Marjamäki e43d2b8a80 runformat 2022-06-08 09:21:01 +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
orbitcowboy 326d340d76 Added a regression test; A real-world test case like this was found by daca@home: ftp://ftp.de.debian.org/debian/pool/main/o/ogdi-dfsg/ogdi-dfsg_4.1.0+ds.orig.tar.gz head ogdi-ogdi_4_1_0/ogdi/c-api/ecsinfo.c:637:26: error: Invalid strcspn() argument nr 2. A nul-terminated string is required. [invalidFunctionArgStr]. 2022-06-04 19:33:56 +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
chrchr-github e6f2929fac
Fix #11085 FN constVariable with range-based for (#4118) 2022-06-03 19:24:59 +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
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 345411a68c Fixed FP found with daca@home: ftp://ftp.de.debian.org/debian/pool/main/i/imx-usb-loader/imx-usb-loader_0~git20200517.30b43d69.orig.tar.gz; imx_usb_loader/imx_loader_config.c:130:16: error: Invalid strncat() argument nr 2. A nul-terminated string is required. [invalidFunctionArgStr] 2022-06-03 10:20:19 +02:00
orbitcowboy a59e510cdc Fixed FP - invalidFunctionArgStr, found with daca@home: ftp://ftp.de.debian.org/debian/pool/main/i/ion/ion_3.2.1+dfsg.orig.tar.gz; ion-open-source/arch-rtems/pmqlsi.c:146:18: error: Invalid mq_send() argument nr 2. A nul-terminated string is required. [invalidFunctionArgStr] 2022-06-03 10:06:32 +02:00
orbitcowboy 8382ea7692 std.cfg: Improved configuration of strpbrk() and added regression tests. These cases were found in the wild (daca@home: ftp://ftp.de.debian.org/debian/pool/main/i/ion/ion_3.2.1+dfsg.orig.tar.gz, ion-open-source/contrib/dtnperf/dtnperf/src/utils.c:71:32: error: Invalid strpbrk() argument nr 2. A nul-terminated string is required. [invalidFunctionArgStr]). 2022-06-03 08:36:25 +02:00