Commit Graph

12348 Commits

Author SHA1 Message Date
chrchr-github bdbd84ba98
: Fix regression ()
* Fix  FP knownConditionTrueFalse with constexpr?

* Modify isConstVarExpression()

* Use predicate

* Format

* : Fix regression
2022-08-09 13:13:16 +02:00
chrchr-github 974e34490f
Fix FP Unused private function () 2022-08-07 20:06:32 +02:00
chrchr-github 078a6d7804
Fix FP knownConditionTrueFalse with constexpr? () 2022-08-07 19:06:19 +02:00
chrchr-github d5a0dfda00
Fix checkLibraryCheckType with asm goto() (invalid varid), add test for ()
* Add test for , avoid duplicate warning

* Add test for 

* Fix test

* Merge

* Add test for 

* Fix  checkLibraryCheckType with asm goto() (invalid varid)

* Format
2022-08-04 21:35:18 +02:00
Paul Fultz II c0f55a2b85
Fix 11142: FP nullPointer before assignment ()
* Fix 11142: FP nullPointer before assignment

* Format

* Use simpleMatch
2022-08-03 19:05:07 +02:00
Paul Fultz II 6cb3a79a64
Fix 11147: FP invalidContainer with substr() ()
* Fix 11147: FP invalidContainer with substr()

* Format
2022-08-03 19:04:44 +02:00
chrchr-github dd927aab9b
Fix checkLibraryNoReturn with unassigned object ()
* Handle float values

* Fix  checkLibraryNoReturn with unassigned object
2022-08-03 19:04:10 +02:00
chrchr-github a62c3ea90e
Fix Broken AST with auto**, FP constStatement () 2022-08-03 19:03:38 +02:00
chrchr-github 0eabe0505b
Handle float values () 2022-08-02 22:11:31 +02:00
chrchr-github 71f9a7269f
Add test for , , avoid duplicate warning ()
* Add test for , avoid duplicate warning

* Add test for 

* Fix test
2022-08-02 21:43:18 +02:00
chrchr-github bc409776e3
Fix Wrong redundant condition: misleading/wrong message ()
* Fix  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
FP: knownConditionTrueFalse (wrong message text) ()
*  FP: knownConditionTrueFalse (wrong message text)

* Format

* Update testcondition.cpp

* Trigger CI
2022-08-02 18:18:46 +02:00
chrchr-github 38fdbe0890
Fix Syntax error for function-try-block in global scope ()
* Fix  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 , , , () 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 () 2022-07-28 22:53:59 +02:00
chrchr-github 304e448749
Fix --check-library reports missing configuration for static_assert () 2022-07-28 22:47:15 +02:00
chrchr-github c340b6ae6c
Fix FP moduloofone with pow() () 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 () 2022-07-26 11:14:35 +02:00
chrchr-github 58d7185d64
Fix FP functionConst when overloaded operator ++ is used () 2022-07-26 08:30:59 +02:00
chrchr-github 15f8c71ec3
Fix FP: unassignedVariable when operator() is called subsequently () 2022-07-24 17:52:14 +02:00
chrchr-github 479533a80a
Rework fix for () 2022-07-24 12:15:04 +02:00
chrchr-github 1aceded300
Fix FP noExplicitConstructor with variadic template () 2022-07-24 10:18:19 +02:00
chrchr-github 0d72216cca
Fix BufferOverrun TODO ()
* Fix BufferOverrun TODO

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

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

* Fix  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) () 2022-07-19 20:41:18 +02:00
chrchr-github c736fe8787
Fix FP doubleFree with pointer in struct () 2022-07-19 20:41:08 +02:00
chrchr-github 6dc606fd6a
Add tests for , , () 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 FP unreadVariable (incomplete code; missing macro definition) () 2022-07-17 19:40:39 +02:00
orbitcowboy 4de443957c gnu.cfg: Added support for error() function. And a TODO testcase for ticket . 2022-07-17 14:43:52 +02:00
chrchr-github 4894cdab8f
Fix FP unreadVariable with unique_ptr and unknown c'tor ()
* Fix  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 () 2022-07-16 23:46:10 +02:00
chrchr-github 109a031ec7
Fix Add redundantContinue check () 2022-07-16 16:02:58 +02:00
chrchr-github 9e74da6126
Fix FP compare with negated constant () 2022-07-16 07:28:15 +02:00
chrchr-github 71d386819e
Fix FP bufferAccessOutOfBounds is reported on strncmp() ()
* Add test

* Fix  FP bufferAccessOutOfBounds is reported on strncmp()

* Remove suppressions
2022-07-15 17:43:18 +02:00
chrchr-github 53cd3dc665
Fix FP extern function reported as unused () 2022-07-14 20:59:58 +02:00
chrchr-github 2543dc97d2
Fix FP bitwiseOnBoolean () 2022-07-14 20:59:39 +02:00
chrchr-github 2c7d98626a
Fix FP leakNoVarFunctionCall with Qt object ()
* 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 ctu: false negative array index out of bounds for array arguments () 2022-07-13 21:08:51 +02:00
chrchr-github 49117f5aeb
Fix static_assert shouldn't be reported by --check-library ()
* No need to check smart pointers, since they take template arguments

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

* Add test for 

* Add test for 
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 (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() ()
Merged from LCppC.
2022-07-12 19:43:48 +02:00
chrchr-github 381c38b2f5
Improve check: uselessCallsConstructor () 2022-07-12 17:40:14 +02:00
Oliver Stöneberg 22be5f29aa
fixed (checkLibraryFunction with parameter to "std::string()") / added rudimentary tests for `CheckFunctions::checkLibraryMatchFunctions()` / added test for () 2022-07-12 17:39:01 +02:00
Oliver Stöneberg aea4fd1068
some `TestSuppressions` improvements and cleanups () 2022-07-12 17:36:36 +02:00
chrchr-github 47c2a01392
Fix inefficient way to remove last character from std::string ()
* Fix  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 FN: Bitwise operation with bool and int ()
* Fix  FN: Bitwise operation with bool and int

* Format
2022-07-11 22:58:37 +02:00
chrchr-github 8fc75402a1
Fix FP invalidFunctionArgStr () 2022-07-11 22:58:19 +02:00
chrchr-github f9337b725b
Fix nullptr deref ()
* 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() () 2022-07-10 11:38:01 +02:00
chrchr-github f5c4a21eae
Fix FN redundantCopyLocalConst () 2022-07-10 11:33:24 +02:00
Oliver Stöneberg c36320747f
some `missingInclude`/`missingIncludeSystem` fixes and tests ()
* 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 ()
* 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)) () 2022-07-09 07:39:04 +02:00
Paul Fultz II 0b63e7273d
Fix 11162: FP: knownConditionTrueFalse ()
* Fix 11162: FP: knownConditionTrueFalse

* Format
2022-07-09 00:57:25 +02:00
Oliver Stöneberg b51aea5531
separated process execution code into `ProcessExecutor` () 2022-07-08 16:42:57 +02:00
Tau c17e2b9826
Correctly interpret boolean literals in `execute()` ()
* 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 Hang on smart pointer with auto type deduction ()
* Fix  Hang on smart pointer with auto type deduction

* Format

* Format
2022-07-08 12:37:53 +02:00
chrchr-github 89a9e5ecc6
Fix FP: terminateStrncpy doesn't account for size check ()
* Fix  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 ()
* 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 ()
* Fix FP compareValueOutOfTypeRangeError

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

* Fix TODO

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

*  FN: leakNoVarFunctionCall (ternary operator)

* Fix  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 ()
* Fix  FN: leakNoVarFunctionCall

* Fix TODO

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

*  FN: leakNoVarFunctionCall (ternary operator)

* Fix  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 ()
* Fix  FN: leakNoVarFunctionCall

* Fix TODO

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

*  FN: leakNoVarFunctionCall (ternary operator)

* Fix  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 () 2022-06-28 22:52:35 +02:00
chrchr-github f8b796403b
Fix Crash in expandTemplate() () 2022-06-28 22:43:34 +02:00
chrchr-github 2223cd24b9
Fix FN: leakNoVarFunctionCall (switch condition) ()
* Fix  FN: leakNoVarFunctionCall

* Fix TODO

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

*  FN: leakNoVarFunctionCall (ternary operator)

* Fix  FN: leakNoVarFunctionCall (switch condition)

* Fix FN constStatement

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

* Fix TODO

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

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

* Fix TODO

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

* Fix TODO
2022-06-27 14:19:19 +02:00
chrchr-github 242afc389d
Fix Regression: Parameter \'ptr\' can be declared as pointer to const () 2022-06-25 21:42:55 +02:00
chrchr-github 63e567eb50
Remove simplifyKnownVariables() ()
* 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 ()
* Add test for 

* Comment

* Fox comment
2022-06-24 13:55:04 +02:00
chrchr-github 60c1eef659
Fix FP containerOutOfBounds with std::map () 2022-06-23 20:26:47 +02:00
chrchr-github f1212e66f7
Fix FP constVariable with 2D array. ()
Test case  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 FP: unreadVariable (remove simplifyMathExpressions()) ()
* Fix  FP: unreadVariable (remove simplifyMathExpressions())

* Remove unused function, tests
2022-06-21 15:42:23 +02:00
chrchr-github 0d4b4394bb
Fix FP with embedded zeros ()
* Partial fix for  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 ()
* Partial fix for  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 FN: invalidFunctionArgStr printf argument ()
* Partial fix for  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 () 2022-06-19 19:26:49 +02:00
PKEuS 9eb16e1002
Replaced check for pipe() buffer size by ordinary CheckBufferOverrun, provide required Library configuration option ()
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 (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 ()
* 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 ()
* 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 ()
* 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 FN bitwiseOnBoolean with unseen function () 2022-06-14 23:08:17 +02:00
chrchr-github de9b65c737
Add tests for , , , , ()
* Add test for 

* Add test for 

* Fix test

* Add test for 

* Add test for 

* Add test for 

* Format

* Format

* Fix test

* Remove duplicate test

* Add valueflow test

* Rebuild

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

* Add test for 

* Fix test

* Add test for 

* Add test for 

* Add test for 

* 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 () 2022-06-12 07:17:28 +02:00
Paul Fultz II bd63534a1c
Fix 10740: valueflow; conditional value. incremented value is oob. () 2022-06-12 07:16:28 +02:00
chrchr-github ecb24e28bc
Fix FP redundantCopyLocalConst - referenced variable changes () 2022-06-11 16:58:33 +02:00
PKEuS cb382ac52c
C++20 support: Support consteval and constinit ()
Backported from LCppC.
2022-06-11 15:28:20 +02:00
Paul Fultz II 8945c151f5
Fix 11124: FP knownConditionTrueFalse with fruit ()
* 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 FP redundantCopyLocalConst with modified object [inconclusive] ()
* Fix   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 ()
* 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 () 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 ()
Merged from LCppC.
2022-06-11 08:11:16 +02:00
Paul Fultz II c9b85010f9
Fix 11096: FP knownConditionTrueFalse in do while loop ()
* 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 FP: compareBoolExpressionWithInt with enum and template parameter () 2022-06-10 20:40:37 +02:00
chrchr-github 51c8630bb3
Fix FP knownConditionTrueFalse with virtual function ()
* Fix  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 () 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 ()
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 () () 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 Infinite recursion in findTypeInBase() () 2022-06-08 09:20:16 +02:00
Oliver Stöneberg 9367be804e
fixed `modernize-use-equals-delete` warnings in headers () 2022-06-07 21:25:23 +02:00
chrchr-github 69834d537b
Fix False negative: variable is not used () 2022-06-07 21:20:33 +02:00
chrchr-github 1d677c57a8
Fix FN: noExplicitConstructor with single default parameter () 2022-06-07 21:15:13 +02:00
chrchr-github b80d06b69e
Don't warn for 'x | MACRO' when MACRO is 0 () 2022-06-07 21:13:31 +02:00
chrchr-github 52453947c8
Don't warn for 'x | 0' in macro ()
* Fix  FN badBitmaskCheck for binary or with 0

* Add test for 

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

* Add test for 
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 FN badBitmaskCheck for binary or with 0 ()
* Fix  FN badBitmaskCheck for binary or with 0

* Add test for 
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 FN constVariable with range-based for () 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 FP nullPointerArithmetic when adding 0 () 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
orbitcowboy 4e9565b4e6 Fixed FP invalidFunctionArgStr, found a daca@home: ftp://ftp.de.debian.org/debian/pool/main/h/haskell-hs-bibutils/haskell-hs-bibutils_6.10.0.0.orig.tar.gz 2022-06-02 23:39:04 +02:00
Paul Fultz II 72342de0da
Fix 11114: FP knownConditionTrueFalse across functions ()
* Fix 11114: FP knownConditionTrueFalse across functions

* Format
2022-06-02 23:24:11 +02:00
Oliver Stöneberg 133b9c2790
some `test/CMakeLists.txt` cleanups ()
* test/CMakeLists.txt: removed unnecessary `CTest` include - gets rid of additional CTest/CDash targets

* test/CMakeLists.txt: adjusted CMake version - `CMAKE_MATCH_<n>` requires 3.9`

* test/CMakeLists.txt: sorted `add_cfg()` calls

* test/CMakeLists.txt: extract test fixtures based on `REGISTER_TEST` macro

* test/CmakeLists.txt: added TODO
2022-06-02 22:26:01 +02:00
orbitcowboy 67795cdfcf
Fixed FPs from Ticket 11119 - invalidFunctionArgStr with null-terminated strings ()
* Fixed first FP from  - invalidFunctionArgStr with null-terminated strings

* Fixed second test case from .

* 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 0eae0023a3 posix.cfg: Added missing '<strz/>'-flags 2022-06-02 09:41:10 +02:00
orbitcowboy 63a8eac4d3 std.cfg: Added missing '<strz/>'-flags 2022-06-02 09:23:22 +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 ()
* Fix  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 FP: variableScope when using range constructor to vector ()
* Fix  FP: variableScope when using range constructor to vector

* Format
2022-06-01 21:15:41 +02:00
chrchr-github 423e67bd6a
Fix FP memleak () 2022-05-30 06:55:15 +02:00
Paul Fultz II d7c914bd3e
Handle subfunction values in valueflow conditions () 2022-05-29 19:57:10 +02:00
chrchr-github 7fbb9c7c13
Fix FN constVariable with range-based for loop ()
* Fix  FN constVariable with range-based for loop

* Format

* nullptr check

* Restrict scopes

* Add const

* Undo

* Add more const
2022-05-29 17:06:33 +02:00
chrchr-github e1c51940a2
Fix FP constParameter with decremented pointer () 2022-05-28 08:32:58 +02:00
chrchr-github 16a4449901
Fix crash with statement expression () 2022-05-28 00:11:23 +02:00
chrchr-github 16af6561c2
Fix FP memleak with unknown ptr typedef ()
* Fix  FN memleak with redundant pointer op

* Style

* Fix  FN: Memory leak not detected on struct member

* Fix FP memleak with function call, fix cppcheckError

* Fix FP memleak with array

* Fix FPs memleak with array and ptr to ptr

* Fix FP memleak with unknown ptr typedef

* Format
2022-05-27 23:52:56 +02:00
chrchr-github d5d6da0dd4
Fix FP unreadVariable with unique_ptr and unknown type () 2022-05-27 17:17:50 +02:00
orbitcowboy 558e00272d windows.cfg: Improved configuration of _mbscmp() and _mbscmp_l(). 2022-05-27 12:28:30 +02:00
Rikard Falkeborn 068e5bad27
Fix : FP memleak with multiple assignments in if-statement ()
Similar to how we do for assignments outside if-statements, bail out
since we do not track multiple variables.
2022-05-27 07:57:43 +02:00
chrchr-github 19dd59eae6
Fix FPs memleak with array and ptr to ptr ()
* Fix  FN memleak with redundant pointer op

* Style

* Fix  FN: Memory leak not detected on struct member

* Fix FP memleak with function call, fix cppcheckError

* Fix FP memleak with array

* Fix FPs memleak with array and ptr to ptr
2022-05-26 15:27:36 +02:00
chrchr-github 86763b7b0a
Fix FP memleak with array ()
* Fix  FN memleak with redundant pointer op

* Style

* Fix  FN: Memory leak not detected on struct member

* Fix FP memleak with function call, fix cppcheckError

* Fix FP memleak with array
2022-05-26 00:03:30 +02:00
chrchr-github 2b611709e2
Add test for () 2022-05-25 23:28:54 +02:00
chrchr-github 1ed280fe63
Fix FP memleak with function call, fix cppcheckError ()
* Fix  FN memleak with redundant pointer op

* Style

* Fix  FN: Memory leak not detected on struct member

* Fix FP memleak with function call, fix cppcheckError
2022-05-24 14:02:06 +02:00
chrchr-github 2ceaf308de
Fix : ValueType for pointer typedef, don't warn for typedef'd pointers, improve error message ()
* 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
orbitcowboy c30333425b Added a regression test for ticket - FN: knownConditionTrueFalse 2022-05-24 09:21:21 +02:00
Paul Fultz II 5999b35130
Fix 10944: FN: knownConditionTrueFalse ()
* Fix 10944: FN: knownConditionTrueFalse

* Use or

* Format
2022-05-23 23:22:08 +02:00
chrchr-github 1ced94be43
Fix FN memleak with redundant pointer op / FN: Memory leak not detected on struct member ()
* Fix  FN memleak with redundant pointer op

* Style

* Fix  FN: Memory leak not detected on struct member
2022-05-23 23:21:36 +02:00
Paul Fultz II e2c35abde5
Fix 11050: False positive: unreadVariable for class variable when another function uses the same variable name () 2022-05-22 09:20:32 +02:00
chrchr-github 22a4fdb6c4
Fix crash in checkPassByReference() () 2022-05-21 16:02:35 +02:00
Daniel Marjamäki 1f6554e2e8 Update copyright year 2022-05-21 12:18:27 +02:00
chrchr-github 2a7f00cf9a
Fix FN Condition '...' is always true ' uint16_t i; ( i <= 0xFFFF)' () 2022-05-21 08:33:42 +02:00
Paul Fultz II feaef46436
Fix 11076: Assert failure / crash with loop over init list () 2022-05-21 08:25:09 +02:00
Paul Fultz II a62fb986a5
Fix 11090: Infinite recursion in findTypeInBase() () 2022-05-21 08:24:29 +02:00
chrchr-github 2b723eafcb
Fix ValueType for references in range-based for loop ()
* Fix ValueType for references in range-based for loop

* Format
2022-05-20 08:48:01 +02:00
chrchr-github 112b1573c5
Fix FN constructing string from nullptr / FN unread variables ()
* Fix  FN constructing string from nullptr /  FN unread variables

* Format
2022-05-18 13:52:44 +02:00
Paul Fultz II 90e6c10c12
Fix 11072: FP arrayIndexOutOfBounds, nullPointer with nested loops ()
* Fix 11072: FP arrayIndexOutOfBounds, nullPointer with nested loops

* Format

* Remove print statement
2022-05-18 08:29:30 +02:00
orbitcowboy 06216b06fc Fixed failing CI. 2022-05-15 08:53:21 +02:00
orbitcowboy 4f410ffb79
library: Improved argument <valid>-interface to defined values that are explicitly excluded. ()
* library: Improved <valid>-interface to defined values that are explicitly excluded.

* std.cfg: Improved configuration of remainder[fl]().

* Fixed failing self check

* Fixed failing self check

* std.cfg: Added support for std::remquo().
2022-05-14 16:05:18 +02:00
chrchr-github 52f507d1fb
Fix unintentional semicolon in expression '.. ; +dostuff();' ()
* Fix  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
Paul Fultz II fbba72ab5a
Fix 11057: FP danglingTemporaryLifetime with reference member ()
* Fix 11057: FP danglingTemporaryLifetime with reference member

* Add test

* Format

* Use ast for number of arguments

* Get number of arguments using ast

* Skip aggregate constructor when there are too many arguments

* Format
2022-05-13 06:51:07 +02:00
Paul Fultz II 5f9bee9b91
Fix 11056: FP uninitvar with known condition in loop ()
* Fix 11056: FP uninitvar with known condition in loop

* Format
2022-05-12 06:37:48 +02:00
Paul Fultz II 6d3208ecb0
Fix 11062: false positive: knownEmptyContainer (regression) ()
* Fix 11062: false positive: knownEmptyContainer (regression)

* Format
2022-05-12 06:24:16 +02:00
Paul Fultz II 5d8da2b83c
Fix 11035: FP arrayIndexOutOfBoundsCond with array and vector ()
* Fix 11035: FP arrayIndexOutOfBoundsCond with array and vector

* Format

* Move comment
2022-05-12 06:21:33 +02:00
chrchr-github e7e8b1baf9
Fix FN: "static" not suggested for non-const method ()
* Fix  FN: "static" not suggested for non-const method

* Format

* Make functions static

* static
2022-05-11 20:01:22 +02:00
chrchr-github 63a1698335
Fix FP multiCondition when variable is assigned in if/else () 2022-05-11 20:01:13 +02:00
orbitcowboy d0b7fe887a Added a regression test for - Comparing Boolean variables (> or <) 2022-05-11 11:30:02 +02:00
chrchr-github 942dbad11c
Fix not getting expected warning in relational comparison of booleans ()
* Fix  not getting expected warning in relational comparison of booleans

* return nullptr
2022-05-11 08:09:32 +02:00
orbitcowboy e9641e6de5 std.cfg: Attempt to fix failing CI 2022-05-10 23:09:10 +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 inline static global struct declaration interferes with checks () 2022-05-10 20:43:11 +02:00
orbitcowboy f23111d610 std.cfg: Improved configuration of some <thread.h> (since C11) functions. 2022-05-10 19:21:41 +02:00
chrchr-github e2bb77f990
Remove severity 'experimental' from checkComparisonOfBoolWithBool() ()
* Enable experimental check

* Remove experimental

* Don't compare Booleans using relational operators
2022-05-10 18:25:13 +02:00
chrchr-github ad547af6f9
Add tests for , , ()
* Add tests for , 

* Add test for 

* Add tests for , 

* Add test for 

* Comment
2022-05-10 18:25:01 +02:00
orbitcowboy 57e35513b9 std.cfg: Improved testing of std::system() 2022-05-10 13:53:16 +02:00
chrchr-github 52cbbb0229
Fix FP uninitMemberVar with defaulted special member functions ()
* Fix  FN: duplicateExpression with multiple strings compared

* Fix compiler warning

* TODO -> ASSERT

* Update testautovariables.cpp

* Improve error message

* Format

* Improve message

* Fix FP with defaulted operator=

* Fix condition
2022-05-10 13:04:45 +02:00
Oliver Stöneberg 56ac230e97
added strict cfg check ()
* runtests.sh: added strict mode - enabled via `STRICT=1`

* CI-unixish.yml: added strict cfg check

* runtests.sh: disabled syntax check for kde.cpp since `kde-4config` is no longer commonly available in recent distros

* runtests.sh: disabled syntax check for opencv2.cpp since `opencv.pc` is not commonly available in distros

* runtests.sh: added missing trailing slash to `CFG` - fixes define checks
2022-05-10 13:03:58 +02:00
orbitcowboy 6152e5712a std.cfg: Improved configuration of std::filebuf::open(). 2022-05-10 10:17:27 +02:00
orbitcowboy 1382cd837e std.cfg: Improved configuration of std::*stream::open(). 2022-05-10 10:07:55 +02:00
orbitcowboy 6a3520164a std.cfg: Improved configuration of std::ifstream::open() and std::ios_base::open(). 2022-05-10 09:50:02 +02:00
orbitcowboy 440e8f9c22 std.cfg: Improved configuration of std::ofstream::write(), std::ostringstream::write(), std::ostream::write() and std::fstream(). 2022-05-10 09:30:13 +02:00
chrchr-github 54f832a2fe
Fix FN: duplicateExpression with multiple strings compared () 2022-05-09 21:05:35 +02:00
chrchr-github 38bdece3fe
Fix False negative: Uninitialized struct member (default constructor) ()
* Fix  False negative: Uninitialized struct member (default constructor)

* Format

* Initialize variables

* Init
2022-05-09 20:28:21 +02:00
Paul Fultz II be6daa94bb
Fix 11053: Integer division by zero in calculate.h ()
* Fix 11053: Integer division by zero in calculate.h

* Format
2022-05-09 20:27:32 +02:00
Paul Fultz II 69f09da63e
Fix 11044: FP knownConditionTrueFalse after early return ()
* Fix 11044: FP knownConditionTrueFalse after early return

* Format
2022-05-09 20:26:52 +02:00
chrchr-github 16ef2c1838
Add test for ()
* Add tests for , 

* Add test for 
2022-05-09 20:26:15 +02:00
chrchr-github 8c0561a78b
Add tests for , () 2022-05-09 14:52:31 +02:00
Daniel Marjamäki eb9c4b4aed Tokenizer: Fix handling of __attribute__ for overloaded operator function 2022-05-08 18:19:52 +02:00
orbitcowboy b847882994 std.cfg: Improved configuration of vfwprintf(). 2022-05-08 18:15:22 +02:00
orbitcowboy 0db793fc51 std.cfg: Improved configuration of vfprintf() 2022-05-08 18:06:30 +02:00
orbitcowboy 1942bd5679 std.cfg: Improved configuration of fprintf() and added TODO tests for wcsftime() when array count value exceeds bounds. 2022-05-08 18:02:10 +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 syntaxError with unknown macros and using namespace () 2022-05-05 19:47:56 +02:00
orbitcowboy f3ae729f89 std.cfg: Improved configuration of fesetexceptflag() and fetestexcept(). 2022-05-05 15:07:06 +02:00
Paul Fultz II 843f7893d6
Fix 11040: FP nullPointer after loop () 2022-05-05 06:55:02 +02:00
Paul Fultz II 8d16ee946c
Fix 11027: False positive: containerOutOfBounds from condition in assert ()
* Fix 11027: False positive: containerOutOfBounds from condition in assert

* Format
2022-05-05 06:54:44 +02:00
Paul Fultz II 5afd6880c3
Fix 11028: False positive: invalidContainer ()
* Fix 11028: False positive: invalidContainer

* Format
2022-05-05 06:54:36 +02:00
chrchr-github adba751217
Fix FP uninitvar with redundant pointer op ()
* Skip redundant pointer op

* Fix   FP uninitvar with redundant pointer op

* Format
2022-05-05 06:54:27 +02:00
chrchr-github aebc080c0f
Fix FN constVariable with array of pointers [regression] ()
* Fix  FN constVariable with array of pointers [regression]

* Use std::vector for deterministic order of results, use helper variables
2022-05-05 06:54:03 +02:00
orbitcowboy 7c816425b9 gnu.cfg: Fixed compiler warning from GCC: warning: ‘struct servent’ declared inside parameter list will not be visible 2022-05-04 20:29:12 +02:00
chrchr-github 9a379925cd
FIx FN shadowVariable in static function ()
* FIx FN shadowVariable in static function

* Use functionOf
2022-05-04 17:56:16 +02:00
chrchr-github e2069dd1b9
Fix FN knownConditionTrueFalse with const int value () 2022-05-04 14:25:00 +02:00
Paul Fultz II 496b45f27b
Fix 11009: FP uninitvar ()
* Fix 11009: FP uninitvar

* Format
2022-05-04 05:59:01 +02:00
chrchr-github 1e40a2e73e
Fix C-style pointer casting not detected for casts to ** () 2022-05-03 20:15:42 +02:00
chrchr-github 509e42afd4
Fix FN duplicateCondition with struct member ()
* Fix  FN duplicateCondition with struct member

* Update testcondition.cpp
2022-05-03 19:57:30 +02:00
chrchr-github 51b4cf592b
Fix unknownMacro reported with noexcept (regression) () 2022-05-03 13:37:14 +02:00
orbitcowboy e293b66ac6 gnu.cfg: Added support for getservent_r(). 2022-05-03 11:54:28 +02:00
Paul Fultz II 3edb10a006
Fix 11024: FP returnDanglingLifetime with c_str() passed to constructor () 2022-05-03 11:42:32 +02:00
orbitcowboy 9f7c34272d Added a regression test for ticket - No UnreadVariable for simple class 2022-05-03 06:58:03 +02:00
chrchr-github 8ce0faf723
Fix Regression: selfInitialization () 2022-05-02 16:49:13 +02:00
orbitcowboy 5a7c998a79 posix.cfg: Improved configuration of getpwuid_r(). 2022-05-02 16:48:22 +02:00
orbitcowboy 8cc16f1adb posix.cfg: Improved configuration of getpwnam_r(). 2022-05-02 16:41:33 +02:00
chrchr-github 67f4fe575f
Fix syntaxError with attribute for function pointer () 2022-05-02 15:05:48 +02:00
orbitcowboy 6c54e7363d posix.cfg: Added support for fgetpwent_r(). 2022-05-02 12:56:47 +02:00
orbitcowboy 86cc410dc2 posix.cfg: Added support for getpwent_r(). 2022-05-02 12:51:58 +02:00
orbitcowboy ba57f33f81 posix.cfg: Added support for getgrnam_r() and getgrgid_r(). 2022-05-02 12:28:54 +02:00
orbitcowboy 0ec2d5f40d std.cfg: Improved configuration of qsort(). 2022-05-02 11:58:31 +02:00
orbitcowboy 6a657865eb posix.cfg: Improved test cases for ffs(). 2022-05-01 18:15:32 +02:00
orbitcowboy 6ad5a94acf gnu.cfg: Improved configuration for memrchr(). 2022-05-01 18:10:19 +02:00
orbitcowboy 6f6ddb99b2 std.cfg: Improved tests for memchr(). 2022-05-01 18:09:54 +02:00
chrchr-github e9a0d7979e
Fix FN redundantPointerOp / remove simplifyMulAndParens() () 2022-05-01 15:46:07 +02:00
orbitcowboy e0ccfea027 gnu.cfg: Improved configuration of ffsl() and ffsll() 2022-05-01 15:29:35 +02:00
orbitcowboy 178efb7058 posix.cfg: Improved configuration for ffs(). 2022-05-01 15:24:57 +02:00
orbitcowboy cbcbff7d12 posix.cfg: Improved tests for readlink(). 2022-05-01 14:17:49 +02:00
orbitcowboy 0e4a17e2ab posix.cfg: Improved configuration of readlinkat(). 2022-05-01 14:08:08 +02:00
orbitcowboy 5db6fc1f54 std.cfg: Improved configuration of localtime_s() 2022-05-01 12:47:13 +02:00
orbitcowboy 01a24d2ce0 posix.cfg: Improved configuration of recv(). 2022-05-01 12:27:14 +02:00
orbitcowboy d6af9da83d posix.cfg: Improved configuration of recvfrom(). 2022-05-01 12:24:15 +02:00
orbitcowboy 85f44d36dd gnu.cfg: Added support for semtimedop(). 2022-05-01 11:41:51 +02:00
orbitcowboy 63e58b9051 posix.cfg: Added support for semop(). 2022-05-01 11:41:31 +02:00
Paul Fultz II 3e686103ae
Fix 10984: False positive: invalidContainer when explictly capturing vector by reference () 2022-04-30 09:36:28 +02:00
Paul Fultz II 4e7125554f
Fix 8358: FP: Condition '(number*0)!=0' is always false () 2022-04-30 09:35:51 +02:00
Paul Fultz II 9fa5c4e201
Fix 11011: FP returnDanglingLifetime with non-const reference argument [inconclusive] ()
* Fix 11011: FP returnDanglingLifetime with non-const reference argument [inconclusive]

* Format
2022-04-30 08:23:58 +02:00
chrchr-github 6a914dc435
Add tests for # 10773, , ()
* Add test for 

* Add test for 

* Add test for 
2022-04-30 08:20:00 +02:00
chrchr-github e7afb3045b
Fix FP redundantPointerOp with macro ()
* Fix  FN: Redundant pointer operation

* Fix FP redundantPointerOp

* Check for LValue

* Fix FP redundantPointerOp with macro

* Format
2022-04-29 13:23:50 +02:00
chrchr-github 0467ab1339
Fix FN memleak with cfg () 2022-04-28 19:50:16 +02:00
chrchr-github 8dbe6994a2
Fix FP redundantPointerOp ()
* Fix  FN: Redundant pointer operation

* Fix FP redundantPointerOp

* Check for LValue
2022-04-28 15:25:31 +02:00
chrchr-github 3d3885d151
Add test for / Remove noisy assert ()
* Add test for 

* Remove noisy assert
2022-04-28 15:24:54 +02:00
Paul Fultz II aafd1e10be
Fix 11006: FP uninitvar with unknown constant () 2022-04-28 10:48:37 +02:00
chrchr-github 7cedf3e0e5
Partial fix for False positive: returnTempReference with trailing return type () 2022-04-27 20:11:32 +02:00
chrchr-github 034140e7e1
Fix FN: Redundant pointer operation () 2022-04-27 19:52:56 +02:00
chrchr-github bcbc29affb
Fix FP: negativeIndex if function call is made after index check ()
* Fix  FP: negativeIndex if function call is made after index check

* Improve container check

* Format
2022-04-27 14:08:44 +02:00
chrchr-github 6df0f9b3e3
Add tests for , , () 2022-04-27 12:43:21 +02:00
orbitcowboy 6796f9daa2 std.cfg: Moved strdup() from posix.cfg to std.cfg since its now part of C23. 2022-04-27 12:41:40 +02:00
orbitcowboy b2c3a9e9a3 posix.cfg: Improved configuration for send(). 2022-04-27 10:41:57 +02:00
orbitcowboy 9726dc8174 posix.cfg: Improved support for sendto(). 2022-04-27 10:35:43 +02:00
orbitcowboy fa1182c0f1 bsd.cfg: Added support for setbuffer() and setlinebuf(). 2022-04-27 10:22:38 +02:00
orbitcowboy 53ebb55e1f std.cfg: Improved configuration of setvbuf(). 2022-04-27 10:09:23 +02:00
orbitcowboy 561e21e2aa std.cfg: Improved tests for setbuf(). 2022-04-27 09:21:09 +02:00
orbitcowboy fa351e010b posix.cfg: Improved tests for socketpair() 2022-04-26 18:13:24 +02:00
orbitcowboy 17189e1d6e std.cfg: Improved configuration of strftime(). 2022-04-26 18:03:39 +02:00
Paul Fultz II 474c7fe5cc
Fix 10953: False positive: Possible null pointer dereference when calling derived function () 2022-04-26 17:57:06 +02:00
orbitcowboy 7d723a7a60 Merge branch 'main' of https://github.com/danmar/cppcheck into main 2022-04-26 17:51:24 +02:00
orbitcowboy 7e3ac96ebc std.cfg: Improved tests of vswprintf(). 2022-04-26 17:50:59 +02:00
chrchr-github 0dc3cb6eba
Fix FP nullPointerRedundantCheck with static function pointer () 2022-04-26 17:25:56 +02:00
orbitcowboy 0d35a60954 posix.cfg: Added support for drand48, erand48, lrand48, nrand48, mrand48, jrand48, srand48, seed48 and lcong48 - generate uniformly distributed pseudo-random numbers. 2022-04-26 17:24:39 +02:00
orbitcowboy bfbc7e1549 posix.cfg: Added support for getlogin_r(). 2022-04-26 10:04:15 +02:00
orbitcowboy bd1104d786 posix.cfg: Added support for pread(). 2022-04-26 09:37:08 +02:00
orbitcowboy 942375741b posix.cfg: Added support for pwrite(). 2022-04-26 09:26:39 +02:00
orbitcowboy bb98ccf7d4 Ticket - Added a regression test 2022-04-26 07:45:08 +02:00
chrchr-github 6b5df68677
Fix syntaxError for valid C code sizeof(enum ...) () 2022-04-26 07:22:53 +02:00
chrchr-github 961ecfbe33
Fix cppcheckError with nested template arguments () 2022-04-25 22:23:06 +02:00
chrchr-github 1bc0317719
Fix FP uninitStructMember with extra parentheses () 2022-04-25 22:22:35 +02:00
chrchr-github b4df064875
Fix FP AssignmentIntegerToAddress with volatile () 2022-04-25 22:00:37 +02:00
chrchr-github 81f9b9b2b7
Fix FP with ptr to ptr const () 2022-04-25 21:45:11 +02:00
orbitcowboy d7063806d1 posix.cfg: Improved configuration for swab(). 2022-04-25 18:34:31 +02:00
orbitcowboy d1b6954dd8 std.cfg: Improved configuration for wcsrtombs(). 2022-04-25 18:25:52 +02:00
orbitcowboy 31d0b0b73b posix.cfg: Improved configuration for wcsnrtombs(). 2022-04-25 15:54:44 +02:00
orbitcowboy 89ae22c0e1 posix.cfg: Improved configuration for wcsnrtombs(). 2022-04-25 15:49:37 +02:00
orbitcowboy dd2e218bb4 posix.cfg: Added some tests for ttyname_r(). 2022-04-25 12:46:27 +02:00
orbitcowboy d42bab47ae posix.cfg: Added support for wcsnrtombs(). 2022-04-25 12:26:02 +02:00
Paul Fultz II 6b9ac6f7a8
Warn when incrementing uninitialized value ()
* Warn when incrementing uninitialized value

* Format
2022-04-24 09:56:58 +02:00
Paul Fultz II 5d5562266d
ValueFlow: Assume constant is nonzero when its negated ()
* ValueFlow: Assume constant is nonzero when its negated

* Format

* Format
2022-04-23 06:19:07 +02:00
Paul Fultz II 4eed29502c
ValueFlow: Set values to parameters to longjmp and setjmp ()
* ValueFlow: Set values to parameters to longjmp and setjmp

* Format
2022-04-23 06:18:55 +02:00
Paul Fultz II 4fa2e3ac87
Use default template in the cfg tests () 2022-04-23 06:18:44 +02:00
orbitcowboy a75ecbca0e std.cfg: Improved tests for wcsftime(). 2022-04-22 08:29:20 +02:00
orbitcowboy 5d26d62698 posix.cfg: Added more test for wcpncpy(). 2022-04-22 08:23:17 +02:00
orbitcowboy 097438f308 posix.cfg: utimes() is a wrapper for utime(), which is obsolescent. Set utimes() as obsolescent as well. 2022-04-22 08:18:21 +02:00
orbitcowboy 478aa6754b posix.cfg: Added support for wcsncasecmp(). 2022-04-22 08:07:20 +02:00
orbitcowboy 0560a946a8 std.cfg: Added more tests 2022-04-22 08:00:45 +02:00
orbitcowboy 051512dd48 bsd.cfg: Added support for pwritev(), preadv(), writev() and writev(). 2022-04-22 07:41:03 +02:00
orbitcowboy b315e8a115 std.cfg: Added more tests for wmemmove() and wmemset(). 2022-04-22 07:25:27 +02:00
Oliver Stöneberg fdca61add9
aligned build options of Visual Studio project configurations and added them to CMake () 2022-04-21 21:28:29 +02:00
orbitcowboy 1bf7b3b7dd std.cfg: Added more tests for memcmp(), memcpy() and memmove(). 2022-04-21 21:01:38 +02:00
Paul Fultz II 3feecc51d6
Fix 10988: FP: Regression, uninitvar () 2022-04-21 19:29:38 +02:00
orbitcowboy ce35a6c975 std.cfg: Added more tests for strcat() and strcpy(). 2022-04-21 16:59:25 +02:00
orbitcowboy e683f3ce28 std.cfg: Added more test for strncpy(). 2022-04-21 16:47:19 +02:00
orbitcowboy 7f48127c0b std.cfg: Added more test for strncat(). 2022-04-21 16:43:52 +02:00
orbitcowboy a6f87e6b8a std.cfg: Added more test for strcmp(). 2022-04-21 16:13:48 +02:00
orbitcowboy e06169cf8d std.cfg: Added more test for strncmp() and wmemcmp(). 2022-04-21 16:09:36 +02:00
Oliver Stöneberg f53ad2391a
CMakeLists.txt: removed left-over Z3 code () 2022-04-21 12:54:16 +02:00
orbitcowboy 7c766a9696 gnu.cfg: Ensure a nullPointer warning is shown for invalid input to mempcpy() and wmempcpy(). 2022-04-21 09:19:32 +02:00
orbitcowboy c7ab35613e posix.cfg: Cleanup test case. 2022-04-21 09:10:13 +02:00
orbitcowboy 49057543a1 std.cfg: Ensure a warning is issued for null pointer input for strlen(). 2022-04-21 09:09:46 +02:00
orbitcowboy 3bd65d42cd posix.cfg: Fixed bufferAccessOutOfBounds falsen negative for strnlen() and added a TODO for wcsnlen() 2022-04-21 09:02:02 +02:00
orbitcowboy dad1a68e51 posix.cfg: Fixed FP bufferOverlap-warning of bcopy() and added more tests. 2022-04-21 08:31:22 +02:00
orbitcowboy 1fb1b22bae posix.cfg: Improved configuration for bzero() and added tests. 2022-04-20 20:57:58 +02:00
orbitcowboy fe1c1ddcc1 test/posix.c: Formatted code [ci skip]. 2022-04-20 18:21:24 +02:00
orbitcowboy d075cba535 posix.cfg: Ensure null pointer input is correctly handled for bcmp(). 2022-04-20 18:18:38 +02:00
orbitcowboy 7cbdea9b81 posix.cfg: Ensure null pointer input is correctly handled for strcasecmp(). 2022-04-20 18:15:54 +02:00
orbitcowboy a8a821a9c7 posix.cfg: Ensure null pointer input is correctly handled for strncasecmp(). 2022-04-20 18:13:49 +02:00
orbitcowboy f3fc5892e1 posix.cfg: Ensure null pointer input is correctly handled for strsep(). 2022-04-20 17:58:50 +02:00
orbitcowboy c17d3a1022 posix.cfg: Ensure null pointer input is correctly handled for stpcpy(). 2022-04-20 17:52:38 +02:00
orbitcowboy 1055b118a4 posix.cfg: Ensure null pointer input is correctly handled for gethostname(). 2022-04-20 17:40:03 +02:00
orbitcowboy d0ff2a022a posix.cfg: Added support for wcwidth(). 2022-04-20 17:32:26 +02:00
Oliver Stöneberg 4ddd7e562d
runtests.sh: refactoring and cleanups ()
* runtests.sh: avoid redundant `pkg-config` checks and simplified the check

* runtests.sh: write a message when something is completely missing

* runtests.sh: derive paths from script location

* runtests.sh: improved readability by using individual functions for each file

* runtests.sh: added helper function `get_pkg_config_cflags()` to clean up cflag lookup from `pkg-config`

* runtests.sh: simplified `xmlstarlet` calls
2022-04-20 17:27:12 +02:00
orbitcowboy 8b90b2d0fd posix.cfg: Added more tests. 2022-04-20 15:27:14 +02:00
orbitcowboy 1067cb6e5d posix.cfg: Added support for wcswidth(). 2022-04-20 15:23:46 +02:00
orbitcowboy 5be16c3113 std.cfg: Ensure null pointer input is correctly handled for fgets() and fgetws(). 2022-04-20 08:50:45 +02:00
orbitcowboy df84bed889 posix.cfg: Added support for more interfaces. 2022-04-20 07:45:38 +02:00
orbitcowboy 5a3d84d84d posix.cfg: Added support for aio_read() 2022-04-20 07:27:28 +02:00
orbitcowboy e0942c1bb4 std.cfg: Ensure warnings are issued for passing null pointer to bsearch(). 2022-04-19 21:21:35 +02:00
orbitcowboy b7bffaa1a7 Formatted code 2022-04-19 21:13:22 +02:00
orbitcowboy f3907e4c9e posix.cfg: Added support for aio_suspend(). 2022-04-19 21:13:09 +02:00
orbitcowboy 24303bfdd3 wxwidgets.cfg: Fixed FPs due to wrong direction attribute set for wxString::ToDouble and wxString::ToCDouble(). 2022-04-19 06:53:34 +02:00
orbitcowboy 6746da5e53 wxwidgets.cfg: Fixed some FPs for wxTextCtrl::GetSelection(), where the argument direction was wrongly set as input. 2022-04-18 15:41:50 +02:00
Oliver Stöneberg 8f728cb4b6
added (partial) support for specifying C++23 and support more "-std" options () 2022-04-15 16:17:36 +02:00
Paul Fultz II 28cf14f110
Fix 10975: false negative: dangling reference in class ()
* Fix 10975: false negative: dangling reference in class

* Format
2022-04-14 18:59:12 +02:00
chrchr-github 6450d5701c
Fix FP arrayIndexOutOfBoundsCond with sizeof ()
* Fix  FP constVariable with pointer typedef

* Fix flag check

* Use isStatic()

* Fix  FP arrayIndexOutOfBoundsCond with sizeof and extra parentheses
2022-04-14 18:13:29 +02:00
Paul Fultz II 6deb8068fa
Fix 10981: ValueFlow: multiplication with 0 should have known value 0 () 2022-04-14 18:13:04 +02:00
Paul Fultz II 09597bc7e8
Fix 10956: ValueFlow: Incorrect value when assigned to two variables ()
* Fix 10956: ValueFlow: Incorrect value when assigned to two variables

* Format
2022-04-14 07:35:07 +02:00
chrchr-github 7721cd14b6
Fix FP constVariable with pointer typedef ()
* Fix  FP constVariable with pointer typedef

* Fix flag check

* Use isStatic()
2022-04-13 21:56:45 +02:00
chrchr-github 8203c74c40
Fix FP sizeofDivisionMemfunc ()
* Fix  FP sizeofDivisionMemfunc when result is multiplied again with sizeof later

* Format
2022-04-13 18:21:56 +02:00
chrchr-github 938517b80a
Fix FP unused private method () 2022-04-13 14:49:28 +02:00
chrchr-github da1e2b22be
Add some tests ()
* Test for 

* Test for 

* Test for 

* Test for 

* Fix test case
2022-04-13 12:25:53 +02:00
chrchr-github f323e8a6c6
Fix FP functionConst ()
* Fix  FP functionConst

* Format

* Format
2022-04-13 12:25:36 +02:00
chrchr-github 55cb396d18
Fix Same template name confuses check () 2022-04-13 12:25:21 +02:00
chrchr-github ea65fe2b63
Fix another FP divideSizeof ()
* Fix FP divideSizeof

* Format

* Undo

* simpleMatch

* Fix another FP divideSizeof
2022-04-13 12:24:35 +02:00
Oliver Stöneberg 32978933b5
removed leftovers of generated cfg tests () 2022-04-13 12:24:17 +02:00
Oliver Stöneberg 45158ec064
cleaned up includes based on include-what-you-use ()
* cleaned up includes based on include-what-you-use

* updated translations
2022-04-13 12:24:00 +02:00
chrchr-github 5ac4afa5b8
Fix cppcheckError with spaceship operator () ()
* Fix cppcheckError with starship operator ()

* Fix test case

* Return result
2022-04-13 12:23:38 +02:00
Paul Fultz II 6c82fb05a4
Fix 10954: False positive: returnDanglingLifetime when using c_str() () 2022-04-12 08:09:13 +02:00
Paul Fultz II 61b87bcc60
Fix 10955: False positive: containerOutOfBounds when using a const reference member () 2022-04-12 08:07:55 +02:00
chrchr-github 00badff622
Fix FP functionConst ()
* Fix  FP functionConst

* Update releasenotes.txt
2022-04-11 22:55:16 +02:00
chrchr-github 28a024ac4a
Fix incorrectLogicOperator/knownConditionTrueFalse for constexpr () 2022-04-11 20:42:54 +02:00
chrchr-github bf6bcafc56
Fix FP divideSizeof () 2022-04-11 20:41:59 +02:00
Oliver Stöneberg a98346bbe0
generate a program database in all Visual Studio configurations () 2022-04-11 11:28:07 +02:00
Daniel Marjamäki 8f386e15fd Remove bug hunting. This feature will be provided in Cppcheck premium. 2022-04-11 07:31:33 +02:00
Paul Fultz II 99757c6d06
ValueFlow: Set values to parameters to escape functions ()
* ValueFlow: Set values to parameters to escape functions

* Format
2022-04-11 07:23:58 +02:00
Paul Fultz II d97942d3c6
Fix 6577: Detect pointer to uninitialised memory with clock_settime() ()
* Fix 6577: Detect pointer to uninitialised memory with clock_settime()

* Format
2022-04-11 07:23:44 +02:00
Paul Fultz II 45b4580554
Fix 10957: Crash on valid code () 2022-04-10 22:47:58 +02:00
chrchr-github bd9f5231b8
Fix FP divideSizeof with dereferenced pointer-to-pointer () 2022-04-10 22:47:27 +02:00
orbitcowboy aa7a1f25c1 Added regression test from Ticket #3929:comment18 2022-04-10 08:10:11 +02:00
chrchr-github c8936d04f6
Fix New Check : Return value of "new" ignored () 2022-04-09 19:06:32 +02:00
Oliver Stöneberg 25ef9eeb26
use std::string::empty() () 2022-04-09 19:02:37 +02:00
chrchr-github 0636018df3
Fix FP: unassignedVariable with structured binding () 2022-04-09 14:50:30 +02:00
chrchr-github 2bccde0e3b
Fix FP Logical condition considered always false () 2022-04-09 14:09:10 +02:00
chrchr-github 38bc0ad4c3
Fix regression: wrong member variable () 2022-04-08 08:23:10 +02:00
Paul Fultz II d2a0b0f78e
Fix 10951: FP knownEmptyContainer with east-const ()
* Fix 10951: FP knownEmptyContainer with east-const

* Format

* Use simpleMatch
2022-04-08 08:22:39 +02:00
chrchr-github ceb86afc22
Fix FP constStatement with cast in return () 2022-04-07 14:11:14 +02:00
Paul Fultz II 4c1aeb0cb1
Remove old pointer alias check () 2022-04-07 11:36:15 +02:00
chrchr-github 52b4aeb279
Fix FP knownConditionTrueFalse with double to int cast () 2022-04-07 10:42:57 +02:00
Paul Fultz II dad10f2ab7
Fix 7684: ValueFlow: function call 'X::GetSize()' ()
* Improve getting function to calculate the return

* Add test

* Format

* Move to cpp to avoid FP

* Format
2022-04-07 06:49:25 +02:00
Paul Fultz II 8986cf018f
Fix todo test that was using wrong function ()
* Fix todo test that was using wrong function

* Format
2022-04-07 06:48:51 +02:00
Paul Fultz II 74667d1e2a
Fix 10418: false negative: knownConditionTrueFalse ()
* Improve handling inverted condition

* Fix tests

* Rename variables for clarity

* Add initial test

* Add another test

* Format

* Fix FP
2022-04-07 06:48:13 +02:00
Paul Fultz II 09c8cfb2ae
Fix 6624: false negative: std::vector out of bounds access not detected ()
* Fix 6624: false negative: std::vector out of bounds access not detected

* Format

* Add test for auto

* Fix tests

* Format
2022-04-07 06:47:15 +02:00
Paul Fultz II bb640c4879
Fix 10950: Crash on function declaration ()
* Fix 10950: Crash on function declaration

* Format
2022-04-06 19:00:05 +02:00
chrchr-github b73aeeda0e
Fix FP constStatement with comma operator ()
* Fix FP constStatement with comma operator

* Format
2022-04-06 16:58:17 +02:00
orbitcowboy 64a7ba3c4c Added regression test for . 2022-04-06 08:12:41 +02:00
Paul Fultz II 4fde7f8b18
Fix 10449: Regression: knownConditionTrueFalse (strlen/wcslen) ()
* Refactor library function usage

* Evaluate library function in program memory

* Fix and add tests

* Format
2022-04-06 06:35:38 +02:00
Paul Fultz II 1d92665ad2
Fix 10867: false negative: containerOutOfBounds with std::array (regression) ()
* Fix 10867: false negative: containerOutOfBounds with std::array (regression)

* Format
2022-04-06 06:25:28 +02:00
chrchr-github 4c375e7224
Fix FP redundantInitialization with lambda / debug: valueFlowConditionExpressions bailout ()
* Fix  FP redundantInitialization with lambda

* Fix  debug: valueFlowConditionExpressions bailout

* Format
2022-04-05 23:19:17 +02:00
chrchr-github f5313dc519
Fix crash with defaulted destructor () 2022-04-05 23:18:08 +02:00
chrchr-github c4dcfef385
Fix debug: Executable scope 'x' with unknown function. ()
* Fix  debug: Executable scope 'x' with unknown function

* Format

* Add test for 

* Fix  debug: Executable scope 'x' with unknown function.
2022-04-05 15:52:16 +02:00
chrchr-github 3ba6914563
Add test for ()
* Fix  debug: Executable scope 'x' with unknown function

* Format

* Add test for 
2022-04-05 13:04:20 +02:00
chrchr-github cfbbeb4b1b
Partial fix for FN containerOutOfBounds with std::array ()
* Partial fix for  FN containerOutOfBounds with std::array

* Format

* Format

* Optimize
2022-04-05 07:34:20 +02:00
chrchr-github b79885c6af
Fix debug: Executable scope 'x' with unknown function ()
* Fix  debug: Executable scope 'x' with unknown function

* Format
2022-04-05 07:34:06 +02:00
chrchr-github aae810dd2c
Fix FP: duplicateValueTenary () 2022-04-04 06:33:54 +02:00
chrchr-github 955d6d8fc6
Fix internalAstError with brace-init in ternary ()
* Fix  internalAstError with brace-init in ternary

* Undo
2022-04-03 20:05:03 +02:00
Paul Fultz II 39265f8ce0
Fix 10931: Assert failure in setSymbolic() ()
* Fix 10931: Assert failure in setSymbolic()

* Format
2022-04-03 20:04:18 +02:00
Paul Fultz II 0547cbcd26
Fix 10647: FN knownConditionTrueFalse for impossible Boolean value ()
* Add impossible values for bool

* Fix valueflow tests

* Fix assertion failure

* Add test

* Format
2022-04-03 20:04:05 +02:00
chrchr-github 7a7b3e40eb
Fix regression FN constVariable with static arrays ()
* Fix regression FN constVariable with static arrays

* Fix test case
2022-04-02 20:39:45 +02:00
chrchr-github a9f29fbc09
Fix FP functionStatic with class template and east-const / FP constParameter with std::array and east-const () 2022-04-01 23:26:44 +02:00
chrchr-github 4bf8718dcb
Fix FP constStatement with pointers in lambda () 2022-04-01 19:50:40 +02:00
Paul Fultz II 5bea50cd36
Fix 10908: FP: uninitvar after for-loop () 2022-03-31 21:24:20 +02:00
chrchr-github 183969cd4b
Fix FP constStatement with extern declaration () 2022-03-31 21:08:04 +02:00
chrchr-github c85e7e7d2f
Fix FP constStatement with more complex expression () 2022-03-30 22:00:57 +02:00
Jens Yllman 34a11c1673
Fix unmatched suppression () () 2022-03-30 19:24:53 +02:00
chrchr-github 343a23135d
Fix FP constStatement with reference and direct initialization () 2022-03-30 19:22:01 +02:00
chrchr-github 47ba053054
Fix FP constVariable with static pointer () 2022-03-30 19:21:09 +02:00
chrchr-github 948bb8df94
Add test for , () 2022-03-30 15:49:45 +02:00
chrchr-github 86ff360946
Fix FP constStatement with immediately evaluated lambda () 2022-03-29 06:10:57 +02:00
chrchr-github 81bcbfa7fe
Fix FP missingOverride with friend () 2022-03-28 22:44:04 +02:00
chrchr-github 49147f95fe
Fix FP constStatement with dynamic_cast () 2022-03-28 22:15:40 +02:00
chrchr-github 8d49fc252c
Fix FP constStatement ',' with Eigen, OpenCV etc. () 2022-03-28 22:06:44 +02:00
chrchr-github 11cbb2eb00
Fix AST cyclic dependency [cppcheckError] 3 () 2022-03-28 22:05:41 +02:00
chrchr-github d57d536f01
Fix FP constStatement with negation and cast () 2022-03-28 21:52:08 +02:00
chrchr-github 7b97230dd2
Fix FP unreadVariable for lock_guard variable () 2022-03-28 21:45:49 +02:00
Paul Fultz II 54fbfd7c0f
Fix 10895: FP danglingTempReference with emplace() ()
* Fix 10895: FP danglingTempReference with emplace()

* Format
2022-03-27 10:02:30 +02:00
Paul Fultz II 21b8c36eb1
Fix 10916: FP: uninitvar () 2022-03-27 10:01:58 +02:00
chrchr-github 63d96e49fc
Fix , FP constStatement ()
* Fix ,  FP constStatement

* Fix test cases (first one did not compile)
2022-03-27 07:59:29 +02:00
chrchr-github 401f0de18b
Fix FP constStatement with new () 2022-03-27 07:59:19 +02:00
chrchr-github 1dd19dcaef
Fix AST cyclic dependency [cppcheckError] () 2022-03-26 22:39:14 +01:00
chrchr-github 5ed521622f
Fix FP constStatement with ptr to ptr to ptr ()
* Fix  FP constStatement with ptr to ptr to ptr

* simpleMatch
2022-03-26 06:12:26 +01:00
amai2012 a143fa37dd
use-retval for localtime() ()
* use-retval for localtime()

* Adjust test to avoid new warning
2022-03-25 17:32:54 +01:00
chrchr-github fe7d0eeffc
Fix FP: constStatement with template type () 2022-03-25 17:03:54 +01:00
orbitcowboy 8d7fe702e0 Ticket - Adde a regression test 2022-03-25 17:01:57 +01:00
chrchr-github 12cb19bdf2
Fix AST cyclic dependency [cppcheckError] () 2022-03-25 14:03:32 +01:00
chrchr-github e54ad24d2c
Fix FN constStatement with arrays () 2022-03-25 11:32:16 +01:00
chrchr-github 796ad6c008
Fix FP variableScope - vector referenced via iterator () 2022-03-25 09:21:17 +01:00
Daniel Marjamäki 212ac6c214 compile_commands.json: ensure that order of include paths are kept 2022-03-24 22:50:04 +01:00
chrchr-github 3630e9c49d
Fix FP constStatement with extra parentheses in declaration () 2022-03-24 22:07:21 +01:00
chrchr-github 479af21405
Fix FP uninitvar with new and braced initializer () 2022-03-24 20:08:51 +01:00
Paul Fultz II 4b4037540a
valueFlowUninit: Handle arrays and pod types ()
* valueFlowUninit: Handle arrays and pod types

* Format

* Catch another array case
2022-03-24 06:35:44 +01:00
Daniel Marjamäki 3bcbba598d Fixed (compile database: include path with space is not handled) 2022-03-23 21:13:51 +01:00
chrchr-github 0d2af9a5b7
Fix FP constStatement with init list in function call () 2022-03-23 18:10:33 +01:00
orbitcowboy d376201cb4 gnu.cfg: Added support for getpw(). Ref.: https://man7.org/linux/man-pages/man3/getpw.3.html 2022-03-23 17:14:26 +01:00
chrchr-github e0830693c3
Fix FP uninitMemberVarPrivate with anonymous union () 2022-03-23 07:35:41 +01:00
chrchr-github 39567ea8c8
Fix FP variableScope (std::for_each with lambda) () 2022-03-22 21:50:46 +01:00
chrchr-github 40c2687ac4
Fix FP constStatement with delete () 2022-03-22 18:39:02 +01:00
chrchr-github 3faff5e9fc
Fix FP knownConditionTrueFalse static variable with direct initialization () 2022-03-22 07:24:40 +01:00
chrchr-github 18a7a805df
Fix FP doubleFree () 2022-03-21 22:17:50 +01:00
Daniel Marjamäki 1fe7cd348a exename: Set proper exename when cppcheck is executed from PATH and argv[0] does not contain path information 2022-03-21 18:35:53 +01:00
chrchr-github 0e147502cc
Fix FN variableScope with enum and struct ()
* Fix  FN variableScope with enum and struct

* Scope reduction

* Scope reduction
2022-03-21 16:05:38 +01:00
chrchr-github 2baf8f6cd4
Fix FP virtualCallInConstructor with function pointer () 2022-03-19 20:00:06 +01:00
chrchr-github 297b0b5c60
Fix FP: Label 'enum' is not used. [unusedLabel] () 2022-03-17 17:38:23 +01:00
chrchr-github 97ce569859
Fix FP constStatement with extra parentheses in function call ()
* Fix  FP constStatement with extra parentheses in function call

* Format
2022-03-17 12:47:27 +01:00
chrchr-github e073860e62
Fix FN uninitMemberVar when member is being used in constructor (regression) () 2022-03-16 20:35:55 +01:00
Paul Fultz II 40ff9edad6
Fix 10843: FP: danglingTemporaryLifetime ()
* Fix 10843: FP: danglingTemporaryLifetime

* Format
2022-03-16 17:11:49 +01:00
chrchr-github fb1170b10b
Fix FP constStatement with variable called std () 2022-03-16 15:29:34 +01:00
chrchr-github b8ba0ae00e
Fix FP constStatement with ternary and comma operator () 2022-03-16 15:28:59 +01:00
Georgi D. Sotirov 33315b0ae5
Replace tinyxml2_LIBRARY with tinyxml2_LIBRARIES () 2022-03-15 21:17:03 +01:00
chrchr-github 1aff160411
Fix FP uninitvar after lambda expression ()
* Fix  FP uninitvar after lambda expression

* Format
2022-03-15 14:32:33 +01:00
chrchr-github f90a93591f
Add tests for , ()
* Add test for 

* Add test for 

* Format
2022-03-15 12:54:19 +01:00
chrchr-github 200b098471
Fix FP for unused private function if address of function is taken () 2022-03-14 19:15:48 +01:00
chrchr-github 6376bac5bb
Fix syntaxError with typedef and lambda ()
* Fix  syntaxError with typedef and lambda

* Don't insert union into template argument list, add test

* Format

* Revert "Format"

This reverts commit 8c52d49c8b.

* Format
2022-03-14 17:59:29 +01:00
chrchr-github d3d40fd599
Fix #10868/#10869 FN: constStatement, handle unused character constants ()
* Fix  FN: constStatement, handle unused character constants

* simpleMatch

* Fix  FN: constStatement

* Format
2022-03-14 14:14:32 +01:00
chrchr-github 2eed660b32
Fix Clarify warnings for uninitMemberVar () 2022-03-13 17:33:31 +01:00
chrchr-github 190506db40
Fix Regression: unusedStructMember ()
* Fix  Regression: unusedStructMember

* Add test for 

* simpleMatch
2022-03-13 06:27:17 +01:00
chrchr-github c3506b5186
Fix regressions with static variables and multiple assignments ()
* Fix regressions with static variables and multiple assignments

* Fix test

* Fix test cases
2022-03-13 06:26:21 +01:00
chrchr-github 3df170c191
Fix FN: constStatementError, streamline error messages () 2022-03-12 14:52:18 +01:00
chrchr-github d1f740a289
Partial fix for varid 0 with lambda (II) ()
* Partial fix for  varid 0 with lamba

* Format

* Undo

* Undo

* Partial fix for  varid 0 with lambda (II)
2022-03-12 06:17:37 +01:00
chrchr-github 4c85ac0d7b
Fix FP unused struct member (inner struct in C code) ()
* Fix  FP unused struct member (inner struct in C code)

* Redundant findType() call, add test
2022-03-12 06:16:29 +01:00
Paul Fultz II ff902369e0
Fix 10851: False positive: known variable value below for loop ()
* Fix 10851: False positive: known variable value below for loop

* Format

* Add test for 10863

* Format
2022-03-12 06:15:35 +01:00
chrchr-github 705931266c
constStatementError: don't warn for casts with possible side effects,… ()
* constStatementError: don't warn for casts with possible side effects, handle bool constants

* Recursive call, add tests

* Restore test

* Don't warn for C++ casts to void

* Don't warn for cast to void*
2022-03-11 21:45:51 +01:00
chrchr-github ffd9f9a93f
Fix FP missingOverride with unnamed parameters () 2022-03-11 21:44:13 +01:00
Binho 8b3647edd7 Fix false positive in memory leak 2022-03-10 08:29:05 +01:00
chrchr-github 2616046461
Partial fix for FP: unusedStructMember () 2022-03-09 20:25:58 +01:00
chrchr-github 557263acde
Partial fix for FP: unusedStructMember (II) ()
* Preliminary

* Fix member search, add tests
2022-03-09 18:22:30 +01:00
chrchr-github 850ad0fed9
: Add error message for unused casts, log unhandled errors ()
* : Add error message for unused casts, log unhandled errors

* Fix TODO

* Fix TODO
2022-03-09 18:21:47 +01:00
chrchr-github c9f47dec8b
Partial fix for varid 0 with lambda () 2022-03-08 20:10:51 +01:00
chrchr-github fbdfb60809
Warn about buffer overruns when allocating memory with new ()
* Warn about buffer overruns when allocating memory with new

* Format

* Avoid FP
2022-03-07 19:43:40 +01:00
chrchr-github 25360d5e4c
Add test for ()
* Add test for 

* Format
2022-03-07 15:32:14 +01:00
chrchr-github 461d797094
Add test for () 2022-03-07 10:44:46 +01:00
orbitcowboy 1d2beb0431 Added a regression test for ticket 6928 - Improve check: unused variables, goto 2022-03-07 10:12:57 +01:00
chrchr-github 3a5931b417
Fix C++11 default values not for all class fields and missing constructor () 2022-03-07 08:39:19 +01:00
chrchr-github 7f682d544e
Partial fix for FN buffer access out of bounds: std::vector ()
* Fix  FN: stlOutOfBounds (off by one)

* Format

* Simplify

* Partial fix for  FN buffer access out of bounds: std::vector

* Undo

* Format

* Fix test case
2022-03-06 07:41:09 +01:00
chrchr-github 0b0a8cad39
Fix FP unreadVariable within a macro (regression) ()
* Fix  FP unreadVariable within a macro (regression)

* Format

* Format
2022-03-05 08:14:57 +01:00
chrchr-github 27baa20f38
Fix FN: stlOutOfBounds (off by one) ()
* Fix  FN: stlOutOfBounds (off by one)

* Format

* Simplify
2022-03-04 17:13:13 +01:00
chrchr-github 2dd6c75b35
Fix Crash/nullptr deref in getEndOfExprScope() ()
* Fix  Crash/nullptr deref in getEndOfExprScope()

* Format
2022-03-03 17:08:23 +01:00
chrchr-github 78dd29ada3
Fix FP noConstructor with function pointer member () 2022-03-03 13:56:24 +01:00
chrchr-github 8a7992c6ac
Suppress operatorEqVarError for known non-copyable types ()
* Fix FP operatorEqVarError with class hierarchy

* Suppress operatorEqVarError for std::mutex

* Add test, non-copyable Qt types

* Update cppcheck-cfg.rng
2022-03-03 09:41:26 +01:00
Daniel Marjamäki 915ae4b845 ValueFlow: Fix crash 2022-03-02 21:12:37 +01:00
chrchr-github 9c50136571
Fix FN unreadVariable for pointer assignment when destructor exists (regression) ()
* Fix  FN unreadVariable for pointer assignment when destructor exists (regression)

* unused variable

* Issue warning for missing cfg

* Format
2022-03-02 11:11:44 +01:00
Oliver Stöneberg de728f472c
removed ThreadExecutor::addFileContent() () 2022-03-02 11:10:29 +01:00
Oliver Stöneberg 4a63af02ed
enabled functionConst and functionStatic in selfcheck ()
* fixed functionConst findings and enabled it in selfcheck

* fixed functionStatic findings and enabled it in selfcheck

* .travis_suppressions: adjusted comment

* testimportproject.cpp: added missing asserts
2022-03-02 07:46:47 +01:00
chrchr-github 8e8e6b1170
Fix FP operatorEqVarError with class hierarchy () 2022-03-02 07:46:23 +01:00
chrchr-github 01de8256ea
Fix cppcheckError with enum class and typedefs ()
* Fix  cppcheckError with enum class and typedefs

* Format

* Format

* Leave enum class scope

* Remove comment
2022-03-02 07:46:15 +01:00
chrchr-github 43fb3dd047
Fix regression: wrong varid with using namespace ()
* Fix  missing varId with using namespace

* Undo

* Fix test

* Limit namespace candidates, duplicateBranch

* rvalue ref

* Undo

* Undo

* Undo

* Format

* Fix condition

* Fix regression: wrong varid with using namespace
2022-03-02 07:46:04 +01:00
Paul Fultz II 0b310b9d07
Fix 10702: FP knownConditionTrueFalse - Member variable modified ()
* Fix 10702: FP knownConditionTrueFalse - Member variable modified

* Format

* Make parameter const

* Fix FP

* Fix FP

* Update

* Format
2022-02-28 18:54:55 +01:00
chrchr-github 6a8bd981b5
Fix CheckClass::isMemberVar found used member variable with varid 0 ()
* Fix  CheckClass::isMemberVar found used member variable with varid 0

* Restore call to simpleMatch()
2022-02-28 18:28:23 +01:00
chrchr-github 05a6d09c5f
Fix FP uninitMemberVar from copy constructor [inconclusive] () 2022-02-27 19:15:19 +01:00
chrchr-github ddb0a8bb0b
Fix missing varId with using namespace ()
* Fix  missing varId with using namespace

* Undo

* Fix test

* Limit namespace candidates, duplicateBranch

* rvalue ref

* Undo

* Undo

* Undo

* Format

* Fix condition
2022-02-27 09:03:24 +01:00
chrchr-github d79d6e60db
Fix Internal error. Token::Match called with varid 0 ()
* Fix  Internal error. Token::Match called with varid 0

* Fix test
2022-02-26 23:48:29 +01:00
chrchr-github 441b437cea
Fix FN: unusedStructMember () 2022-02-26 18:53:00 +01:00
Paul Fultz II dbc80787e1
Fix 10821: FN: containerOutOfBounds ()
* Fix 10821: FN: containerOutOfBounds

* Format

* Fix cppcheck warning

* Add valueflow tests

* Format

* Fix some bugs

* Format
2022-02-25 05:53:51 +01:00
chrchr-github f53793c413
Fix FP cstyleCast with function pointer and calling convention () 2022-02-23 09:12:14 +01:00
Oliver Stöneberg 51371f7929
added CMake option USE_THREADS to be able to use threads instead of fork() / cleanups () 2022-02-23 09:04:35 +01:00
chrchr-github 172aafdeb8
Fix FN: redundant assignment in loop () 2022-02-22 09:51:44 +01:00
Paul Fultz II 1ac16413ea
Another fix for 10800: Hang / memory exhaustion on numerical code ()
* Another fix for 10800: Hang / memory exhaustion on numerical code

* Format
2022-02-22 07:21:26 +01:00
Paul Fultz II 72d0f3e444
Fix 10808: cppcheckError AST cyclic dependency with decltype ()
* Fix 10808: cppcheckError AST cyclic dependency with decltype

* Format
2022-02-22 06:30:17 +01:00
chrchr-github 734e3ac6da
Fix cppcheckError with for loop () 2022-02-21 18:14:20 +01:00
chrchr-github bedde0a1df
Fix bug hunting; crash for small C-code () 2022-02-21 18:09:46 +01:00
chrchr-github d77fa64051
Fix Function::addArguments found argument 'x' with varid 0 () 2022-02-21 18:06:26 +01:00
chrchr-github 5574e41b86
Fix CheckClass::isMemberVar found used member variable with varid 0 () 2022-02-20 18:17:47 +01:00
chrchr-github 18e00bb4fd
Fix Crash in checkPassByReference() / Stack overflow with decltype / Crash on invalid code ()
* Fix  Crash in checkPassByReference()

* Format

* Fix  Stack overflow with decltype

* Fix  Crash on invalid code in TemplateSimplifier::templateParameters
2022-02-18 12:59:21 +01:00
chrchr-github 6635e6cc07
Fix cppcheckError with for loop () 2022-02-17 22:12:19 +01:00
chrchr-github 2f46e57311
Add leak-ignore for fopen_s(), test cases ()
* Add leak-ignore for fopen_s(), test cases

* Format
2022-02-17 16:22:30 +01:00
chrchr-github a1adbff683
Fix FN Memory leak not detected when variable is 'used' by allocation function in condition () 2022-02-16 21:31:24 +01:00
chrchr-github b07814f329
Fix FN missed class members in copy operator of derived class () 2022-02-16 21:30:19 +01:00
chrchr-github 6488cb6e76
Add test for () 2022-02-16 16:43:06 +01:00
Daniel Marjamäki c968aeaf73 Import project: do not crash when importing compile database generated by IAR workbench 2022-02-16 08:35:47 +01:00
chrchr-github 9582032906
Fix FP uninitMemberVar - ctor calls function with smart pointer argument () 2022-02-16 07:02:26 +01:00
chrchr-github 52f549fa87
Fix crash on garbage code () 2022-02-15 20:19:03 +01:00
chrchr-github 907218254e
Fix previous commit ()
* Fix  unsafeClassCanLeak missing for array of pointers

*  Fix previous commit

* Format

* Format
2022-02-15 20:03:02 +01:00
chrchr-github e7e2439347
Fix unsafeClassCanLeak missing for array of pointers () 2022-02-15 14:28:19 +01:00
chrchr-github a5674182bb
Add test for () 2022-02-15 12:52:10 +01:00
orbitcowboy d131235a53 test windows.cfg: Added regression test for _wtoi_l and _atoi_l. 2022-02-15 11:37:10 +01:00
Daniel Marjamäki f2420509c9 Revert "constPointer: Fix false positives when pointer is not read"
This reverts commit 6427b4888b.

If variable/parameter is unused it is better to warn about that.
2022-02-13 08:40:45 +01:00
Daniel Marjamäki 6427b4888b constPointer: Fix false positives when pointer is not read 2022-02-12 22:23:25 +01:00
chrchr-github 0a99e3b6fc
Partial fix for FN redundant assignment/unreadVariable () 2022-02-12 15:32:08 +01:00
Daniel Marjamäki 30cec97cc8 Tokenizer: Support C++20 default bit-field member initializer 2022-02-12 12:19:08 +01:00
chrchr-github edc5106237
Fix FN missingOverride - subclass in namespace () 2022-02-12 08:19:07 +01:00
chrchr-github c5ab936088
Fix FN shadowVariable in range-based for loop () 2022-02-12 08:10:53 +01:00
Rikard Falkeborn d4cd249c21
10671 fix const iterator function const take two ()
* Revert "Revert "Fix : functionConst FN with begin/end and const_iterator ()""

This reverts commit 9f6a36c1a8.

* Fix crash by adding missing null check
2022-02-11 21:23:23 +01:00
chrchr-github 5f3ddabd56
Fix FP constParameter with std::map () 2022-02-11 19:40:11 +01:00
Paul Fultz II 78228599da
Fix 10800: Hang / memory exhaustion on numerical code ()
* Fix 10800: Hang / memory exhaustion on numerical code

* Format

* Add another test

* Format
2022-02-11 06:52:28 +01:00
Oliver Stöneberg f32583e097
removed OVERRIDE and FINAL defines and use the keywords directly () 2022-02-10 23:02:24 +01:00
Julien Marrec 2535bf984b
Allow passing std::string_view by value () 2022-02-10 21:01:12 +01:00
chrchr-github cd7532df21
Fix FN C-style pointer casting with built-in or typedef types /… () 2022-02-10 20:48:51 +01:00
Paul Fultz II 5d25050b06
Fix 10788: False positive: zerodivcond when using an assert () 2022-02-10 20:22:14 +01:00
chrchr-github ddd84f9b98
Add tests/TODO for , ()
* Add tests/TODO for , 

* Comment
2022-02-10 20:05:14 +01:00
orbitcowboy 65c0ef8eb0 Added a regression test for ticket . 2022-02-10 14:13:50 +01:00
chrchr-github 24e9859158
Fix FP stlcstrParam due to incorrect overload resolution ()
* Fix  FP stlcstrParam due to incorrect overload resolution

* Variable shadowing
2022-02-10 11:17:06 +01:00
Paul Fultz II a50452517d
Fix 10794: Crash in MultiValueFlowAnalyzer::getProgramState() ()
* Fix 10794: Crash in MultiValueFlowAnalyzer::getProgramState()

* Format
2022-02-10 07:43:27 +01:00
orbitcowboy 09da69b1c7 posix.cfg: Added support for 'llseek()', which is obsolescent since glibc version 2.28 2022-02-09 08:34:35 +01:00
chrchr-github 2c7948102a
Fix FP AssignmentAddressToInteger with enum class () 2022-02-08 16:12:35 +01:00
chrchr-github e64ea20089
Fix FP variableScope for if with init-statement () 2022-02-08 16:12:09 +01:00
chrchr-github 966dbb1990
Windows.cfg: add UNREFERENCED_PARAMETER() macro () 2022-02-08 11:50:28 +01:00
Paul Fultz II 20a5224d7e
Fix 10784: False positive: returnDanglingLifetime using std::tie with variadic template parameters () 2022-02-08 09:03:51 +01:00
Paul Fultz II 260d155bb6
Fix 10785: False positive: constParameter when using member pointer () 2022-02-07 18:45:32 +01:00