Commit Graph

13925 Commits

Author SHA1 Message Date
Oliver Stöneberg c54b3f4de0
removed leftover bughunting GUI related fields from `ErrorMessage` () 2022-08-13 08:27:52 +02:00
Paul Fultz II bfd9470600
Fix 11158: FP zerodiv in loop ()
* Fix 11158: FP zerodiv in loop

* Format

* Add another test

* Format

* Fix FP

* Format
2022-08-13 08:27:20 +02:00
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
Oliver Stöneberg 156323c95e
avoid unnecessary copies with `insert()` () 2022-08-07 19:31:16 +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
umanamente 460f63558d
Fixed typo in checkautovariables.cpp: getPointerDepth() () 2022-08-04 07:52:10 +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
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
Oliver Stöneberg b65b47d3a8
enabled and fixed `modernize-pass-by-value` clang-tidy warnings () 2022-07-28 22:51:45 +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
Oliver Stöneberg d6eb3a8f40
some changes for clang/clang-tidy 15 () 2022-07-26 15:30:53 +02:00
Oliver Stöneberg 887463855b
mitigated most clang-tidy warnings in headers () 2022-07-26 11:10:03 +02:00
chrchr-github 58d7185d64
Fix FP functionConst when overloaded operator ++ is used () 2022-07-26 08:30:59 +02:00
Oliver Stöneberg 0005be1dbf
some cleanups () 2022-07-26 08:28:55 +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
Oliver Stöneberg b2f15fdbb1
reduced padding in some classes/structs () 2022-07-24 10:17:11 +02:00
Daniel Marjamäki 894975f845 SymbolDatabase: Add Function::access info for methods 2022-07-22 10:37:00 +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
Daniel Marjamäki a7afaba21d SymbolDatabase: add BaseInfo::nameTok to dumpfile 2022-07-21 15:57:41 +02:00
chrchr-github 5342e2cd03
Fix FP knownConditionTrueFalse with dynamic_cast () 2022-07-20 20:48:17 +02:00
Oliver Stöneberg 4316884123
valueflow.cpp: avoid some copies related to `ErrorPath` () 2022-07-20 10:57:49 +02:00
Daniel Marjamäki ebe8dc2cf3 SymbolDatabase: Extended dumpfiles. Scope: derivedFrom types. Function: overridden function. 2022-07-20 07:24:27 +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
Oliver Stöneberg f644938eb0
fixed Cppcheck version () 2022-07-19 20:42:19 +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
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
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 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 21d992cc00
Fix crash on Windows with -j option ()
* Fix crash on Windows with -j option

* Disable CI-cygwin workflow

* Update CI-cygwin.yml

* Update CI-cygwin.yml

* Update CI-cygwin.yml

* Try to fix Cygwin build

* Update CI-cygwin.yml

* Update CI-cygwin.yml

* Update CI-cygwin.yml

* Update CI-cygwin.yml

* Update CI-cygwin.yml

* Update CI-cygwin.yml

* Update CI-cygwin.yml

* Update CI-cygwin.yml

* Update CI-cygwin.yml

* Update CI-cygwin.yml

* Update CI-cygwin.yml

* Update CI-cygwin.yml

* Update CI-cygwin.yml

* Update CI-cygwin.yml

* Update CI-cygwin.yml

* Update CI-cygwin.yml

* Update CI-cygwin.yml

* Update CI-cygwin.yml

* Update CI-cygwin.yml

* Update CI-cygwin.yml

* Update CI-cygwin.yml

* Update CI-cygwin.yml

* Update CI-cygwin.yml

* Update CI-cygwin.yml

* Update CI-cygwin.yml

* Update CI-cygwin.yml

* Cygwin uses THREADING_MODEL_FORK

* Restore workflows

* Remove comment

* Fix dmake

* Fix  FP invalidFunctionArgStr

* Revert "Fix  FP invalidFunctionArgStr"

This reverts commit dd5d3e67c6.
2022-07-13 13:46:03 +02:00
Daniel Marjamäki b387ae80f1 Fixed whole program analysis 2022-07-12 22:58:52 +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
Daniel Marjamäki a93c2c5263 cppcheck: keep ctu-info files if there is a cppcheck build dir 2022-07-12 10:14:37 +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
Oliver Stöneberg e8b0f12367
replaced `if(MATCHES)` with `if(STREQUAL)` ()
`MATCHES` does regular expression matching which is not the intended behavior here. `Clang` still requires it since it also needs to match `AppleClang.
2022-07-11 10:46:18 +02:00
Armin Müller 0ae9877766
Typos found by running "codespell" () 2022-07-10 22:40:05 +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 c9c1f83a69
use `emptyString` more consistently () 2022-07-10 10:57:29 +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
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
Jens Yllman b246781da6
Try to stop range overflow in forwardRange() ()
* Try to stop range overflow in forwardRange()

* Use predefinded function for check instead
2022-07-09 00:57:44 +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 a71a647c39 Fix syntax error 2022-07-07 19:45:47 +02:00
Daniel Marjamäki e1d3e6f72e Catch internal error during whole program analysis 2022-07-07 19:14:18 +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 68bb724dcc ErrorLogger: do not allocate huge std::string when column is -1 2022-07-07 15:07:17 +02:00
Daniel Marjamäki b888f9cf92 use hash instead of checksum to check if content is changed 2022-07-07 12:16:01 +02:00
Daniel Marjamäki 29402b4d1a Fix Coverity CID1490221 warning. settings is dereferenced and then checked. 2022-07-05 07:46:39 +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
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