Daniel Marjamäki
2e8d855b35
Tokenizer: Skip qt simplification if qt library is not loaded
2022-09-08 07:47:58 +02:00
Daniel Marjamäki
b99474fe13
Tokenizer: Remove redundant setVarId call
2022-09-08 07:46:19 +02:00
Oliver Stöneberg
847391ea2d
some minor optimizations ( #4449 )
...
* cppcheck.cpp: reduced scope of a variable
* cppcheck.cpp: removed unnecessary severity checks
* cppcheck.cpp: avoid unnecessary copy
* templatesimplifier.cpp: perform early exit in loop in `expandTemplate()`
2022-09-07 19:19:04 +02:00
Paul Fultz II
32d96104d6
Fix 6370: ValueFlow: array element with known value ( #4447 )
...
* Fix 6370: ValueFlow: array element with known value
* Format
* Move comment
2022-09-07 19:16:07 +02:00
Paul Fultz II
6543b429c5
Fix 11285: FN: zerodiv ( #4448 )
...
* Fix 11285: FN: zerodiv
* Format
2022-09-07 19:15:37 +02:00
chrchr-github
6960332f8a
Fix #11294 FP arrayIndexOutOfBoundsCond with extra parentheses ( #4442 )
2022-09-06 21:21:06 +02:00
Oliver Stöneberg
b3762cd76a
actually perform system tinyxml2 build on macos / fixed system tinyxml2 include ( #4445 )
...
* lib/CMakeLists.txt: removed unnecessary external include
* look up tinyxml2 include dir when using system one and specify it
* lib/CMakeLists.txt: do not treat bundled headers as system ones
* CI-unixish.yml: actually perform system tinyxml2 build on macos
2022-09-06 18:30:59 +02:00
Paul Fultz II
2d37a77281
Fix 11296: FN: knownConditionTrueFalse ( a !=0 && b != 0 && a == 0) ( #4444 )
2022-09-06 07:31:48 +02:00
Paul Fultz II
016793f258
Fix 11295: Regression FP: knownConditionTrueFalse ( #4443 )
2022-09-06 07:31:38 +02:00
Oliver Stöneberg
436b8bd3f1
optimized `isSameConstantValue()` a bit ( #4441 )
2022-09-05 21:36:26 +02:00
chrchr-github
31118fdce5
Fix noreturn FP with while() ( #4429 )
...
* Fix checkLibraryFunction FPs
* Fix FP with fclose()
* Format
* Fix FP with reinterpret_cast
* Fix noreturn FP with while()
2022-09-04 10:26:31 +02:00
Paul Fultz II
6ce5c24f21
Refactor knownConditionTrueFalse check and isUsedAsBool function ( #4432 )
...
* Refactor knownConditionTrueFalse check and isUsedAsBool function
* Format1
* Format
* Skip assign
2022-09-04 10:24:45 +02:00
Maksim Derbasov
f93b588603
New check: use memcpy/memset instead of loop ( #4257 )
2022-09-03 23:29:06 +02:00
Daniel Marjamäki
9306c6f329
dump: Add Function::isAttributeNoreturn info
2022-09-03 12:09:20 +02:00
chrchr-github
cf52ee098a
Fix checkLibraryFunction FPs ( #4423 )
...
* Fix checkLibraryFunction FPs
* Fix FP with fclose()
* Format
* Fix FP with reinterpret_cast
2022-09-02 07:51:10 +02:00
chrchr-github
79daad8ff4
Fix #11020 FP arrayIndexOutOfBounds if string literals are assigned conditionally ( #4428 )
2022-09-01 22:59:46 +02:00
Daniel Marjamäki
4779f0e172
TemplateSimplifier: Fixed instantiation when template parameters are A<..>, B<..>
2022-09-01 20:24:01 +02:00
chrchr-github
5804cc44e7
Fix FP bufferAccessOutOfBounds ( #4427 )
...
* Fix FN with buffer size 1
* Fix FP bufferAccessOutOfBounds
2022-08-31 19:31:37 +02:00
chrchr-github
3925a27182
Fix FP knowConditionTrueFalse ( #4419 )
...
* Fix #10426 FN (style) Condition 's.empty()' is always false
* Fix test
* Fix FP knowConditionTrueFalse
* Check for casts
* Fix FP for user-defined functions
* Adjust condition detection
* Tweaks
2022-08-30 18:08:24 +02:00
chrchr-github
9ab4f9976d
Fix #10426 FN (style) Condition 's.empty()' is always false ( #4414 )
...
* Fix #10426 FN (style) Condition 's.empty()' is always false
* Fix test
2022-08-29 12:25:10 +02:00
chrchr-github
1e14e360cb
Fix #8295 FN (error) Buffer is accessed out of bounds (wcpncpy, wcsncpy) ( #4412 )
...
* Fix #8295 FN (error) Buffer is accessed out of bounds (wcpncpy, wcsncpy)
* Fix cfg, validation
* Fix validation
2022-08-29 12:24:58 +02:00
chrchr-github
df704361f6
Fix FN with buffer size 1 ( #4410 )
2022-08-29 12:24:44 +02:00
Daniel Marjamäki
a400c94230
Update Copyrights
2022-08-28 14:22:12 +02:00
Daniel Marjamäki
5e0fc24bb7
Fixed #11232 (Syntax Error: AST broken, binary operator '!=' doesn't have two operands)
2022-08-27 18:02:19 +02:00
chrchr-github
7156afe003
Fix #5140 FN (error) buffer access out of bounds - known argument ( #4402 )
...
* Fix #5140 FN (error) buffer access out of bounds - known argument const char* argv[]
* Format
2022-08-26 17:27:54 +02:00
chrchr-github
917496a844
Fix #5678 FN destructor with no definition hide mismatching alloc/dealloc ( #4401 )
...
* Fix #5678 FN destructor with no definition hide mismatching allocation / deallocation
* Format
* Fix test
* Format
2022-08-25 22:52:51 +02:00
chrchr-github
456c6b410e
Fix #2304 FN known strcpy parameter ( #4396 )
...
* Fix #2304 FN known strcpy parameter
* Parentheses
* Format
2022-08-24 21:23:45 +02:00
Oliver Stöneberg
467648bec6
fixed #11249 (potential hang with -j and --showtime= when using threads) - synchronized access to `TimerResults::mResults` / added TSAN to CI ( #4355 )
2022-08-23 20:30:45 +02:00
chrchr-github
13e8d5220c
Fix another c_strParam regression ( #4394 )
2022-08-23 20:26:36 +02:00
Daniel Marjamäki
a2454ecbca
cli import cppcheck project with premium options
2022-08-23 20:13:03 +02:00
chrchr-github
4be7f689d7
Fix c_strParam regression ( #4393 )
...
* Fix #7515 New check: Not needed c_str() operation
* Comment
* Detect more instances of c_str() misuse
* Fix bad merge
* Check for data() also
* Fix
* Format
* Format
* Fix c_strParam regression
2022-08-23 15:00:27 +02:00
Daniel Marjamäki
5d267000e2
GUI: configuration of premium features
2022-08-22 21:11:28 +02:00
chrchr-github
66fca7ba91
Detect more instances of c_str() misuse ( #4392 )
...
* Fix #7515 New check: Not needed c_str() operation
* Comment
* Detect more instances of c_str() misuse
* Fix bad merge
* Check for data() also
* Fix
* Format
* Format
2022-08-22 14:06:10 +02:00
Oliver Stöneberg
9b4973d711
astutils.cpp: some small optimizations ( #4378 )
2022-08-21 17:39:21 +02:00
Daniel Marjamäki
c820d2ba97
refactoring
2022-08-21 17:33:43 +02:00
PKEuS
d81a758850
LCppC backports: Refactorizations/Optimizations ( #4204 )
2022-08-21 17:21:02 +02:00
Oliver Stöneberg
0e1cd8b2ac
do not do C++ processing for C code in `parsedecl()` ( #4304 )
2022-08-21 17:11:22 +02:00
Oliver Stöneberg
670b872f30
implemented move constructor for `TemplateSimplifier::TokenAndName` ( #4390 )
2022-08-21 17:02:03 +02:00
chrchr-github
d351a97a0f
Fix #8336 FN stlcstrParam ( #4389 )
...
* Fix #7515 New check: Not needed c_str() operation
* Comment
* Fix error messages
* Handle more complex string expressions
* Fix #8336 FN stlcstrParam
* Handle iterators
* Format
* Format
* Parentheses
2022-08-21 13:04:43 +02:00
Oliver Stöneberg
1202efb438
some `--exception-handling` related improvements ( #4368 )
2022-08-20 20:54:31 +02:00
chrchr-github
b04bf7396f
Fix #7515 New check: Not needed c_str() operation ( #4371 )
2022-08-20 20:52:10 +02:00
Oliver Stöneberg
d73a33d17e
avoid redundant `Token::declEndToken()` calls ( #4363 )
2022-08-20 20:50:14 +02:00
Oliver Stöneberg
2afd5f80e7
smallvector.h: bake `reserve()` into the non-boost `SmallVector` implementation ( #4385 )
2022-08-20 20:44:26 +02:00
Oliver Stöneberg
1d95d1908d
refs #10663 - sped up `Library::detectContainerOrIterator()` by iterating the containers only once ( #4380 )
2022-08-20 12:14:55 +02:00
chrchr-github
2ab8de2650
Fix #11145 FP negativeMemoryAllocationSize with possible value ( #4387 )
2022-08-20 07:56:31 +02:00
Oliver Stöneberg
f138df2909
mathlib.h: replaced slow `std::ostringstream` with `std::to_string()` in `MathLib::toString()` ( #4382 )
2022-08-19 20:44:24 +02:00
chrchr-github
80a486dda0
Fix #11167 FP virtual call in destructor even though class is final / Delete 'final' from specializations ( #4383 )
...
* Add 'final' keyword
* Delete 'final' from specializations
* Fix #11167 FP virtual call in destructor even though class is final
* Fix test
2022-08-19 18:26:00 +02:00
Oliver Stöneberg
16f598c409
added missing `sstream` includes ( #4381 )
2022-08-19 10:16:23 +02:00
chrchr-github
1aa259569e
Fix #10138 syntax error : int (operator"" _ii)(unsigned long long v) … ( #4374 )
...
* Fix #10138 syntax error : int (operator"" _ii)(unsigned long long v) { return v; }
* Format
2022-08-18 23:38:45 +02:00
Oliver Stöneberg
e09f5f0db7
refs # 11106 (optimize CheckUnusedVar::checkStructMemberUsage()) - added missing loop breaks ( #4376 )
2022-08-18 23:36:21 +02:00
chrchr-github
6a0c254d1f
Fix #9931 FP zerodiv (daca@home) ( #4379 )
...
* Fix #9931 FP zerodiv (daca@home)
* Format
* Parentheses
* clang-tidy
2022-08-18 20:38:36 +02:00
chrchr-github
4a64e20592
unusedScopedObject: Don't warn for void statements ( #4370 )
...
* Fix unusedScopedObject FPs
* Simplify
* Simplify
* Fix test
* Don't warn for void statements
* Format
2022-08-17 19:45:46 +02:00
Oliver Stöneberg
0f0c4061ff
astutils.cpp: avoid redundant callback invocation in `isExpressionChangedAt()` ( #4369 )
2022-08-17 13:50:39 +02:00
Oliver Stöneberg
5f171b9673
fixed some `modernize-use-emplace` false negatives with `std::stack` / removed `internalStlUsage` check ( #4346 )
2022-08-17 09:50:14 +02:00
chrchr-github
5b4c6c1e73
Fix #11026 FP pointerOutOfBounds with strlen() ( #4366 )
2022-08-17 09:45:07 +02:00
chrchr-github
1a95515e47
Fix unusedScopedObject FPs ( #4364 )
2022-08-17 09:11:23 +02:00
Oliver Stöneberg
98b9f2cbf1
reduced scope of some variables and avoided some copies ( #4328 )
2022-08-16 22:28:39 +02:00
chrchr-github
3dc2c0bd42
Fix #11257 FN constStatement with misused comma ( #4365 )
2022-08-16 22:10:58 +02:00
Oliver Stöneberg
31d704e4bc
cppcheckexecutor.cpp: extracted platform-dependent code into separate files ( #4359 )
2022-08-16 22:03:44 +02:00
Paul Fultz II
72c764b034
Expose exprId to addon ( #4354 )
2022-08-16 22:00:31 +02:00
Oliver Stöneberg
38c7d0a5f8
config.h: implemented `NORETURN` for GCC < 5 ( #4361 )
2022-08-16 06:52:54 +02:00
Oliver Stöneberg
4bf5dcd29f
cleaned up includes based on include-what-you-use ( #4358 )
...
* cleaned up includes based on include-what-you-use
* testlibrary.cpp: no need for `empyString` optimization
2022-08-14 12:44:19 +02:00
Oliver Stöneberg
f7caf7dc93
avoid some unnecessary `std::string()` construction in comparisons ( #4357 )
...
* avoid unnecessary string wrapping
* consistently use `strcmp()`
2022-08-14 12:44:09 +02:00
chrchr-github
afef71f6b6
Partial fix for #10057 unused variable without assignment not detected ( #4348 )
...
* Partial fix for #10057 unused variable without assignment not detected
* Add test for #9672
2022-08-13 08:29:06 +02:00
Oliver Stöneberg
c54b3f4de0
removed leftover bughunting GUI related fields from `ErrorMessage` ( #4351 )
2022-08-13 08:27:52 +02:00
Paul Fultz II
bfd9470600
Fix 11158: FP zerodiv in loop ( #4356 )
...
* 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
#11238 : Fix regression ( #4349 )
...
* Fix #11238 FP knownConditionTrueFalse with constexpr?
* Modify isConstVarExpression()
* Use predicate
* Format
* #11238 : Fix regression
2022-08-09 13:13:16 +02:00
chrchr-github
974e34490f
Fix #9282 FP Unused private function ( #4327 )
2022-08-07 20:06:32 +02:00
Oliver Stöneberg
156323c95e
avoid unnecessary copies with `insert()` ( #4323 )
2022-08-07 19:31:16 +02:00
chrchr-github
078a6d7804
Fix #11238 FP knownConditionTrueFalse with constexpr? ( #4341 )
2022-08-07 19:06:19 +02:00
chrchr-github
d5a0dfda00
Fix #11239 checkLibraryCheckType with asm goto() (invalid varid), add test for #8666 ( #4340 )
...
* Add test for #6541 , avoid duplicate warning
* Add test for #5475
* Fix test
* Merge
* Add test for #8666
* Fix #11239 checkLibraryCheckType with asm goto() (invalid varid)
* Format
2022-08-04 21:35:18 +02:00
umanamente
460f63558d
Fixed typo in checkautovariables.cpp: getPointerDepth() ( #4329 )
2022-08-04 07:52:10 +02:00
Paul Fultz II
c0f55a2b85
Fix 11142: FP nullPointer before assignment ( #4319 )
...
* 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() ( #4333 )
...
* Fix 11147: FP invalidContainer with substr()
* Format
2022-08-03 19:04:44 +02:00
chrchr-github
dd927aab9b
Fix #11237 checkLibraryNoReturn with unassigned object ( #4338 )
...
* Handle float values
* Fix #11237 checkLibraryNoReturn with unassigned object
2022-08-03 19:04:10 +02:00
chrchr-github
a62c3ea90e
Fix #11234 Broken AST with auto**, FP constStatement ( #4339 )
2022-08-03 19:03:38 +02:00
chrchr-github
0eabe0505b
Handle float values ( #4336 )
2022-08-02 22:11:31 +02:00
chrchr-github
71f9a7269f
Add test for #6541 , #5475 , avoid duplicate warning ( #4335 )
...
* Add test for #6541 , avoid duplicate warning
* Add test for #5475
* Fix test
2022-08-02 21:43:18 +02:00
chrchr-github
bc409776e3
Fix #10320 Wrong redundant condition: misleading/wrong message ( #4334 )
...
* Fix #10320 Wrong redundant condition: misleading/wrong message
* Use expressionString()
* Clarify condition
* Update testcondition.cpp
* Trigger CI
2022-08-02 18:31:02 +02:00
chrchr-github
92d569afb6
#11233 FP: knownConditionTrueFalse (wrong message text) ( #4330 )
...
* #11233 FP: knownConditionTrueFalse (wrong message text)
* Format
* Update testcondition.cpp
* Trigger CI
2022-08-02 18:18:46 +02:00
chrchr-github
38fdbe0890
Fix #9716 Syntax error for function-try-block in global scope ( #4305 )
...
* Fix #9716 Syntax error for function-try-block in global scope
* static through instance
* Handle multiple catch blocks
* Add test
* Fix skip logic
* Handle init lists in simplifyFunctionTryCatch()
2022-07-31 14:49:50 +02:00
Oliver Stöneberg
efaaa58896
fixed some `modernize-use-emplace` false negatives and some `bugprone-assignment-in-if-condition` warnings ( #4311 )
2022-07-28 22:53:59 +02:00
Oliver Stöneberg
b65b47d3a8
enabled and fixed `modernize-pass-by-value` clang-tidy warnings ( #4169 )
2022-07-28 22:51:45 +02:00
chrchr-github
304e448749
Fix #8476 --check-library reports missing configuration for static_assert ( #4314 )
2022-07-28 22:47:15 +02:00
chrchr-github
c340b6ae6c
Fix #11191 FP moduloofone with pow() ( #4312 )
2022-07-28 22:11:23 +02:00
Daniel Marjamäki
898ad314ab
badBitmaskCheck: Avoid FP when there is #ifdef in expression
2022-07-28 21:56:05 +02:00
Oliver Stöneberg
d6eb3a8f40
some changes for clang/clang-tidy 15 ( #4310 )
2022-07-26 15:30:53 +02:00
Oliver Stöneberg
887463855b
mitigated most clang-tidy warnings in headers ( #4175 )
2022-07-26 11:10:03 +02:00
chrchr-github
58d7185d64
Fix #10077 FP functionConst when overloaded operator ++ is used ( #4309 )
2022-07-26 08:30:59 +02:00
Oliver Stöneberg
0005be1dbf
some cleanups ( #4308 )
2022-07-26 08:28:55 +02:00
chrchr-github
15f8c71ec3
Fix #9946 FP: unassignedVariable when operator() is called subsequently ( #4303 )
2022-07-24 17:52:14 +02:00
chrchr-github
479533a80a
Rework fix for #11008 ( #4296 )
2022-07-24 12:15:04 +02:00
chrchr-github
1aceded300
Fix #10977 FP noExplicitConstructor with variadic template ( #4301 )
2022-07-24 10:18:19 +02:00
Oliver Stöneberg
b2f15fdbb1
reduced padding in some classes/structs ( #4295 )
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 ( #4300 )
...
* Fix BufferOverrun TODO
* clang-tidy
2022-07-22 07:24:34 +02:00
chrchr-github
79f091c59a
Fix uselessCallsConstructor TODOs ( #4299 )
...
* Fix uselessCallsConstructor TODOs
* Format
2022-07-21 22:15:16 +02:00
Daniel Marjamäki
a7afaba21d
SymbolDatabase: add BaseInfo::nameTok to dumpfile
2022-07-21 15:57:41 +02:00
chrchr-github
5342e2cd03
Fix #11037 FP knownConditionTrueFalse with dynamic_cast ( #4297 )
2022-07-20 20:48:17 +02:00
Oliver Stöneberg
4316884123
valueflow.cpp: avoid some copies related to `ErrorPath` ( #4160 )
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 #11016 FP unusedStructMember when used through iterator (regression) ( #4289 )
...
* Format
* Fix #11016 FP unusedStructMember when used through iterator (regression)
* Format
* Fix test
* Format
* Nullptr check
2022-07-19 20:42:54 +02:00
Oliver Stöneberg
f644938eb0
fixed Cppcheck version ( #4292 )
2022-07-19 20:42:19 +02:00
chrchr-github
5e537a666f
Fix --check-library warning for int(i) ( #4293 )
2022-07-19 20:41:18 +02:00
chrchr-github
c736fe8787
Fix #11008 FP doubleFree with pointer in struct ( #4294 )
2022-07-19 20:41:08 +02:00
Daniel Marjamäki
db155a59c1
Tokenizer: remove simplifyTokenList2
2022-07-18 16:20:36 +02:00
chrchr-github
b08aabefee
Fix #9877 FP unreadVariable (incomplete code; missing macro definition) ( #4278 )
2022-07-17 19:40:39 +02:00
chrchr-github
4894cdab8f
Fix #11108 FP unreadVariable with unique_ptr and unknown c'tor ( #4284 )
...
* Fix #11108 FP unreadVariable with unique_ptr and unknown c'tor
* Fix test
2022-07-16 23:46:55 +02:00
chrchr-github
b16d12b5fb
Improve check for wchar_t ( #4285 )
2022-07-16 23:46:10 +02:00
chrchr-github
109a031ec7
Fix #11195 Add redundantContinue check ( #4283 )
2022-07-16 16:02:58 +02:00
chrchr-github
9e74da6126
Fix #11098 FP compare with negated constant ( #4282 )
2022-07-16 07:28:15 +02:00
chrchr-github
53cd3dc665
Fix #10661 FP extern function reported as unused ( #4279 )
2022-07-14 20:59:58 +02:00
chrchr-github
2543dc97d2
Fix FP bitwiseOnBoolean ( #4280 )
2022-07-14 20:59:39 +02:00
chrchr-github
2c7d98626a
Fix FP leakNoVarFunctionCall with Qt object ( #4272 )
...
* Add missing <leak-ignore/>, test
* Fix qt.cfg, format
* Fix FP leakNoVarFunctionCall
* Format
* Delete memory, rule of five
* Missing include
* Avoid dependency
* explicit
* Fix Qt test case
* Fix typo
* Fix
* Add Q_OBJECT
2022-07-13 21:09:53 +02:00
chrchr-github
6eab3cb8bd
Fix #9788 ctu: false negative array index out of bounds for array arguments ( #4277 )
2022-07-13 21:08:51 +02:00
chrchr-github
49117f5aeb
Fix #7375 static_assert shouldn't be reported by --check-library ( #4276 )
...
* No need to check smart pointers, since they take template arguments
* Fix #7375 static_assert shouldn't be reported by --check-library
2022-07-13 21:08:43 +02:00
chrchr-github
21d992cc00
Fix crash on Windows with -j option ( #4229 )
...
* 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 #11179 FP invalidFunctionArgStr
* Revert "Fix #11179 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() ( #4205 )
...
Merged from LCppC.
2022-07-12 19:43:48 +02:00
chrchr-github
381c38b2f5
Improve check: uselessCallsConstructor ( #4270 )
2022-07-12 17:40:14 +02:00
Oliver Stöneberg
22be5f29aa
fixed #11183 (checkLibraryFunction with parameter to "std::string()") / added rudimentary tests for `CheckFunctions::checkLibraryMatchFunctions()` / added test for #10105 ( #4265 )
2022-07-12 17:39:01 +02:00
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 #11166 inefficient way to remove last character from std::string ( #4267 )
...
* Fix #11166 inefficient way to remove last character from std::string
* Format
* Modify message, add test
* Format
* Fix another warning
2022-07-11 23:07:37 +02:00
chrchr-github
c5dcd49dae
Fix #4233 FN: Bitwise operation with bool and int ( #4266 )
...
* Fix #4233 FN: Bitwise operation with bool and int
* Format
2022-07-11 22:58:37 +02:00
chrchr-github
8fc75402a1
Fix #11179 FP invalidFunctionArgStr ( #4264 )
2022-07-11 22:58:19 +02:00
chrchr-github
f9337b725b
Fix nullptr deref ( #4262 )
...
* Fix some FNs related to c_str()
* Format, fix FP
* Fix nullptr deref
* Fix merge
2022-07-11 22:58:08 +02:00
Oliver Stöneberg
e8b0f12367
replaced `if(MATCHES)` with `if(STREQUAL)` ( #4263 )
...
`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" ( #4260 )
2022-07-10 22:40:05 +02:00
chrchr-github
c218859418
Fix some FNs related to c_str() ( #4258 )
2022-07-10 11:38:01 +02:00
chrchr-github
f5c4a21eae
Fix #10704 FN redundantCopyLocalConst ( #4115 )
2022-07-10 11:33:24 +02:00
Oliver Stöneberg
c9c1f83a69
use `emptyString` more consistently ( #4034 )
2022-07-10 10:57:29 +02:00
Oliver Stöneberg
c36320747f
some `missingInclude`/`missingIncludeSystem` fixes and tests ( #4027 )
...
* do not emit `missingInclude` and `missingIncludeSystem` errors when not enabled / fixed and improved TestPreprocessor::inline_suppression_for_missing_include()
* testpreprocessor.cpp: added missing tests for `missingInclude` and `missingIncludeSystem`
* cppcheckexecutor.cpp: `missingIncludeSystem` was not emitted in normal analysis if `missingInclude` existed
* dmake
* added `run-dmake` as `testrunner` dependency
2022-07-09 23:21:11 +02:00
orbitcowboy
c117f62926
Fixed zerodiv/moduloofone FNs for more math functions
2022-07-09 22:36:17 +02:00
orbitcowboy
8215521843
Fixed zerodiv/moduloofone FNs for more math functions
2022-07-09 19:59:16 +02:00
orbitcowboy
ef47d34e75
Fixed zerodiv/moduloofone FNs for more math functions
2022-07-09 19:21:58 +02:00
orbitcowboy
0282c3a86e
Fixed zerodiv/moduloofone FN for '1/std::expm1(0)'
2022-07-09 17:52:58 +02:00
orbitcowboy
07eeee1620
Fixed zerodiv FN for '1/std::exp2(0)'
2022-07-09 17:47:21 +02:00
orbitcowboy
048d31ec56
Fixed zerodiv FN for '1/std::erfc(42)'
2022-07-09 17:43:17 +02:00
orbitcowboy
87c1e6587a
Fixed zerodiv FN for '1/std::erf(0)'
2022-07-09 17:38:28 +02:00
orbitcowboy
c777cd5060
Fixed zerodiv FN for '1/std::ceil(0)'
2022-07-09 17:32:32 +02:00
orbitcowboy
41b6452604
Fixed zerodiv FN for '1/std::cbrt(0)' and added more test cases for other math functions
2022-07-09 17:28:15 +02:00
Paul Fultz II
6b72274c67
Evaluate math library functions in valueflow ( #4255 )
...
* Evaluate math library functions in valueflow
* Format
2022-07-09 07:40:32 +02:00
Paul Fultz II
edebe746bc
Fix 10361: false negative: uninitvar (std::next(iterator)) ( #4256 )
2022-07-09 07:39:04 +02:00
Jens Yllman
b246781da6
Try to stop range overflow in forwardRange() ( #4235 )
...
* 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 ( #4254 )
...
* Fix 11162: FP: knownConditionTrueFalse
* Format
2022-07-09 00:57:25 +02:00
Oliver Stöneberg
b51aea5531
separated process execution code into `ProcessExecutor` ( #4249 )
2022-07-08 16:42:57 +02:00
Tau
c17e2b9826
Correctly interpret boolean literals in `execute()` ( #4251 )
...
* Correctly interpret boolean literals in `execute()`
* Add regeression test case for boolean literals
2022-07-08 12:39:29 +02:00
chrchr-github
bd92e7411c
Fix #11163 Hang on smart pointer with auto type deduction ( #4250 )
...
* Fix #11163 Hang on smart pointer with auto type deduction
* Format
* Format
2022-07-08 12:37:53 +02:00
chrchr-github
89a9e5ecc6
Fix #9944 FP: terminateStrncpy doesn't account for size check ( #4252 )
...
* Fix #9944 FP: terminateStrncpy doesn't account for size check
* Fix container size check
* Undo
* Format
* Rebuild
* Rebuild
2022-07-08 12:35:21 +02:00
Daniel Marjamäki
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 ( #4246 )
...
* 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 ( #4245 )
...
* Fix FP compareValueOutOfTypeRangeError
* Remove suppressions
2022-07-01 10:48:32 +02:00
chrchr-github
27578e9c4c
Fix FP returnStdMoveLocal ( #4244 )
2022-06-30 13:50:31 +02:00
chrchr-github
d8e64b4cbb
Fix FP leakNoVarFunctionCall ( #4243 )
...
* Fix #10857 FN: leakNoVarFunctionCall
* Fix TODO
* Fix #10858 FN: leakNoVarFunctionCall (if ( b && malloc ) )
* #11155 FN: leakNoVarFunctionCall (ternary operator)
* Fix #11157 FN: leakNoVarFunctionCall (switch condition)
* Fix FN constStatement
* Fix FP leakNoVarFunctionCall
* Fix FP leakNoVarFunctionCall
* Format
* Fix FP leakNoVarFunctionCall with unknown function
* Fix FP leakNoVarFunctionCall
2022-06-30 13:05:28 +02:00
chrchr-github
06b408ea20
Fix FP leakNoVarFunctionCall with unknown function ( #4242 )
...
* Fix #10857 FN: leakNoVarFunctionCall
* Fix TODO
* Fix #10858 FN: leakNoVarFunctionCall (if ( b && malloc ) )
* #11155 FN: leakNoVarFunctionCall (ternary operator)
* Fix #11157 FN: leakNoVarFunctionCall (switch condition)
* Fix FN constStatement
* Fix FP leakNoVarFunctionCall
* Fix FP leakNoVarFunctionCall
* Format
* Fix FP leakNoVarFunctionCall with unknown function
2022-06-29 13:43:17 +02:00
chrchr-github
b90a726441
Fix FP leakNoVarFunctionCall ( #4241 )
...
* Fix #10857 FN: leakNoVarFunctionCall
* Fix TODO
* Fix #10858 FN: leakNoVarFunctionCall (if ( b && malloc ) )
* #11155 FN: leakNoVarFunctionCall (ternary operator)
* Fix #11157 FN: leakNoVarFunctionCall (switch condition)
* Fix FN constStatement
* Fix FP leakNoVarFunctionCall
* Fix FP leakNoVarFunctionCall
* Format
2022-06-29 07:22:26 +02:00
Paul Fultz II
185294499c
Adjust the severity of the uninitvar ( #4234 )
2022-06-28 22:52:35 +02:00
chrchr-github
f8b796403b
Fix #11146 Crash in expandTemplate() ( #4238 )
2022-06-28 22:43:34 +02:00
Paul Fultz II
a2f2699088
Refactor alias check in isExpressionChangeAt into isAlias function ( #4223 )
2022-06-28 22:40:59 +02:00
chrchr-github
2223cd24b9
Fix #11157 FN: leakNoVarFunctionCall (switch condition) ( #4240 )
...
* Fix #10857 FN: leakNoVarFunctionCall
* Fix TODO
* Fix #10858 FN: leakNoVarFunctionCall (if ( b && malloc ) )
* #11155 FN: leakNoVarFunctionCall (ternary operator)
* Fix #11157 FN: leakNoVarFunctionCall (switch condition)
* Fix FN constStatement
* Fix FP leakNoVarFunctionCall
2022-06-28 14:02:02 +02:00
chrchr-github
cdeebc15ea
Fix #11155 FN: leakNoVarFunctionCall (ternary operator) ( #4239 )
...
* Fix #10857 FN: leakNoVarFunctionCall
* Fix TODO
* Fix #10858 FN: leakNoVarFunctionCall (if ( b && malloc ) )
* #11155 FN: leakNoVarFunctionCall (ternary operator)
2022-06-27 20:55:09 +02:00
chrchr-github
e7e23e87c2
Fix #10858 FN: leakNoVarFunctionCall (if ( b && malloc ) ) ( #4237 )
...
* Fix #10857 FN: leakNoVarFunctionCall
* Fix TODO
* Fix #10858 FN: leakNoVarFunctionCall (if ( b && malloc ) )
2022-06-27 19:35:22 +02:00
chrchr-github
88bf11abba
Fix #10857 FN: leakNoVarFunctionCall ( #4236 )
...
* Fix #10857 FN: leakNoVarFunctionCall
* Fix TODO
2022-06-27 14:19:19 +02:00
chrchr-github
242afc389d
Fix #11148 Regression: Parameter \'ptr\' can be declared as pointer to const ( #4233 )
2022-06-25 21:42:55 +02:00
Daniel Marjamäki
d204c5f894
Tokenizer: Cleanup stuff in simplifyTokenList2
2022-06-25 17:09:51 +02:00
chrchr-github
63e567eb50
Remove simplifyKnownVariables() ( #4232 )
...
* Remove simplifyKnownVariables()
* Add some test cases back
* Remove unused functions
* Format
2022-06-25 08:38:17 +02:00
chrchr-github
60c1eef659
Fix FP containerOutOfBounds with std::map ( #4230 )
2022-06-23 20:26:47 +02:00
chrchr-github
f1212e66f7
Fix FP constVariable with 2D array. ( #4228 )
...
Test case #8717 was actually a FP as well.
2022-06-22 21:22:04 +02:00
Daniel Marjamäki
1d5166d70c
CheckClass: Fix false negatives for uninitMemberVar
2022-06-21 19:28:08 +02:00
chrchr-github
a658baf962
Fix #11143 FP: unreadVariable (remove simplifyMathExpressions()) ( #4227 )
...
* Fix #11143 FP: unreadVariable (remove simplifyMathExpressions())
* Remove unused function, tests
2022-06-21 15:42:23 +02:00
chrchr-github
0d4b4394bb
Fix FP with embedded zeros ( #4226 )
...
* Partial fix for #11137 FN: invalidFunctionArgStr printf argument
* Typo
* Remove <strz>, suppressions
* Add suppresion, remove <strz>
* Add suppressions
* Fix FP with embedded zeros
* Merge
2022-06-21 13:33:45 +02:00
chrchr-github
de2509f1ac
Fix FP with complex array size expression ( #4225 )
...
* Partial fix for #11137 FN: invalidFunctionArgStr printf argument
* Typo
* Remove <strz>, suppressions
* Add suppresion, remove <strz>
* Add suppressions
* Fix FP with complex array size expression
2022-06-21 00:12:11 +02:00
chrchr-github
5b9fa9657d
Partial fix for #11137 FN: invalidFunctionArgStr printf argument ( #4224 )
...
* Partial fix for #11137 FN: invalidFunctionArgStr printf argument
* Typo
* Remove <strz>, suppressions
* Add suppresion, remove <strz>
* Add suppressions
2022-06-20 20:02:22 +02:00
orbitcowboy
ff50a01d36
Fixed handling of PCRE rules, since 'simple' rules have been removed already, set default to 'normal'-tokenlist.
2022-06-20 09:17:11 +02:00
PKEuS
9eb16e1002
Replaced check for pipe() buffer size by ordinary CheckBufferOverrun, provide required Library configuration option ( #4183 )
...
Merged from LCppC.
2022-06-19 12:01:55 +02:00
Daniel Marjamäki
6873f5237b
Tokenizer: removing more stuff from simplifyTokenList2
2022-06-19 10:41:15 +02:00
Paul Fultz II
e735376f7d
Refactor to use AST for isContainerSizeChanged ( #4222 )
2022-06-19 08:17:05 +02:00
Paul Fultz II
e6fdcb9de2
Refactor to use derefShared ( #4220 )
2022-06-19 08:16:27 +02:00
Paul Fultz II
2a0b2f538e
Check tokType in match compiler ( #4219 )
...
* Check tokType in match compiler
* Set keyword when tokenlist is missing
2022-06-18 21:30:42 +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
Paul Fultz II
3612ddb3f5
Fix unit test failure ( #4218 )
2022-06-17 07:49:45 +02:00
Daniel Marjamäki
968d8d153e
Fixed #11101 (False positive: derived union members are initialized in constructor)
2022-06-16 20:17:57 +02:00
Paul Fultz II
3e09503561
Fix 11087: false negative: usage of reference to member of temporary object not detected ( #4217 )
...
* Fix 11087: false negative: usage of reference to member of temporary object not detected
* Format
* Add another test case
* Fix FP with pointer
* Format
2022-06-16 19:26:36 +02:00
Paul Fultz II
9cecc8468e
Fix 10570: Improve check; condition then pointer dereference, different pointers ( #4216 )
...
* Try to use after assign in loop
* Update valueflow forward to handle init tokens
* Fix tests
* Make test TODO
* Format
* Add tests
* Format
* Fix ubsan error
* Use simpleMatch
2022-06-16 19:26:23 +02:00
Paul Fultz II
de51ebbcf4
Fix 9135: Access of moved variable not detected in loop ( #4215 )
...
* Fix 9135: Access of moved variable not detected in loop
* Format
* Fix issue with pushing back on container
* Format
* Fix null pointer
* Remove yeild for now
2022-06-16 17:40:09 +02:00
Daniel Marjamäki
dbb12cb333
Tokenizer: Remove some functions from simplifyTokenList2
2022-06-16 14:06:07 +02:00
Paul Fultz II
46fcdca5ee
Add debug_valuetype intrinsic ( #4210 )
2022-06-15 21:25:55 +02:00
chrchr-github
176eefcbf3
Fix #10655 FN bitwiseOnBoolean with unseen function ( #4214 )
2022-06-14 23:08:17 +02:00
chrchr-github
6d22d6a8ae
Fix FP unusedVar with side effects in destructor ( #4212 )
2022-06-14 09:55:22 +02:00
Daniel Marjamäki
343d04feb4
Tokenizer: Remove simplifyCharAt from simplifyTokenList2
2022-06-12 15:14:48 +02:00
Daniel Marjamäki
8255e32540
cppcheck build dir: do not produce invalid dump file if code is unchanged and checking is skipped.
2022-06-12 11:08:28 +02:00
Paul Fultz II
d4fb5652c0
Fix 10619: Valueflow: Library function in subfunction does not propagate all values ( #4209 )
2022-06-12 07:17:28 +02:00
Paul Fultz II
bd63534a1c
Fix 10740: valueflow; conditional value. incremented value is oob. ( #4208 )
2022-06-12 07:16:28 +02:00
Paul Fultz II
cee48e5e19
Add backtrace to valueflow in debug mode ( #4195 )
2022-06-12 07:13:42 +02:00
Rikard Falkeborn
187460a277
Library: Replace auto with real types ( #4207 )
...
Following up on fc6c203b0e
, replace auto with the correct types to
clairfy the code. Note the use of const on the first type in the pair,
which allows us to use a reference.
2022-06-11 23:21:25 +02:00
chrchr-github
ecb24e28bc
Fix #10191 FP redundantCopyLocalConst - referenced variable changes ( #4202 )
2022-06-11 16:58:33 +02:00
PKEuS
cb382ac52c
C++20 support: Support consteval and constinit ( #4203 )
...
Backported from LCppC.
2022-06-11 15:28:20 +02:00
Rikard Falkeborn
fc6c203b0e
Library: Use range-based for loops ( #4200 )
2022-06-11 13:51:55 +02:00
Paul Fultz II
8945c151f5
Fix 11124: FP knownConditionTrueFalse with fruit ( #4196 )
...
* Update valueType
* Allow comparisons
* Fix compare op
* Add test
* Format
* Fix FP
* Format
2022-06-11 11:02:04 +02:00
chrchr-github
8579feb3aa
Fix #10545 FP redundantCopyLocalConst with modified object [inconclusive] ( #4197 )
...
* Fix #10545 FP redundantCopyLocalConst with modified object [inconclusive]
* Comment
2022-06-11 11:01:23 +02:00
Paul Fultz II
653a1ea83e
Fix 11100: FP knownConditionTrueFalse with getter/setter member functions ( #4198 )
...
* Fix 11100: FP knownConditionTrueFalse with getter/setter member functions
* Format
2022-06-11 11:00:40 +02:00
PKEuS
82af702c6f
LCppC backport: Restored Check: Detect negative VLA and allocation (new[]) sizes ( #4187 )
2022-06-11 09:55:38 +02:00
Daniel Marjamäki
533b3e2bcb
Tokenizer: Clarify code. The variableMap.find, variableMap.end was not strictly matching.
2022-06-11 09:47:06 +02:00
PKEuS
99ce89c003
Improvement: Set varId for variables with global scope operator :: Refactorization: Moved internal class from tokenize.h to tokenize.cpp ( #4184 )
...
Merged from LCppC.
2022-06-11 08:11:16 +02:00
Paul Fultz II
c9b85010f9
Fix 11096: FP knownConditionTrueFalse in do while loop ( #4192 )
...
* Check for loop
* Improve handling of exit values
* Add more checks to test
* Simplify
* Remove unnecessary test
* Fix typo
* Format
* Use simpleMatch
2022-06-10 20:42:02 +02:00
chrchr-github
829ca9ab7f
Fix #10935 FP: compareBoolExpressionWithInt with enum and template parameter ( #4193 )
2022-06-10 20:40:37 +02:00
chrchr-github
51c8630bb3
Fix #10618 FP knownConditionTrueFalse with virtual function ( #4194 )
...
* Fix #10618 FP knownConditionTrueFalse with virtual function
* Remove redundant check
2022-06-10 20:17:57 +02:00
Daniel Marjamäki
375880988c
Tokenizer: remove removeRedundantAssignment from simplifyTokenList2
2022-06-10 12:35:05 +02:00
chrchr-github
90392faa2b
Fix crash on nullptr deref ( #4189 )
2022-06-09 18:25:17 +02:00
Daniel Marjamäki
a76ba698c2
Tokenizer: remove simplifyCompoundAssignment from simplifyTokenList2
2022-06-09 07:38:27 +02:00
Daniel Marjamäki
c0f3d5b2fb
Tokenizer: remove simplifyAssignmentInFunctionCall used in simplifyTokenList2
2022-06-08 19:08:18 +02:00
PKEuS
1275b5275e
LCppC backport: Various optimizations ( #4182 )
...
* Optimization: Use Token::eIncDecOp instead of expensive Token::Match calls
Merged from LCppC.
* Small Optimizations: - Moved a std::set that is only need during initialization of SymbolDatabase to function scope - Use std::vector instead of std::list
Merged from LCppC.
* Optimization: Refactorized various Token::Match calls and surrounding conditions
Merged from LCppC.
* Refactorization: Cleanup usage of std::multimap
Merged from LCppC.
2022-06-08 16:58:57 +02:00
PKEuS
4bd189c3c8
Refactorization: Faster calculation of CRC32 by avoiding to create a temporary string. Use proper types in checksum functions. ( #4180 )
...
Merged from LCppC
2022-06-08 16:55:06 +02:00
PKEuS
898a3a25a1
ValueType: Added additional unit test ( #4185 )
...
Removed unnecessary library export
Backported from LCppC.
2022-06-08 15:27:56 +02:00
PKEuS
d20ea41325
Refactorization: Removed compatibility hacks for outdated or non-conformant compilers ( #4186 )
...
Merged from LCppC.
2022-06-08 15:16:01 +02:00
PKEuS
44097b59ff
Implemented error handling in cppcheck::Platform::loadFromXmlDocument(), enabled related unit test ( #8409 ) ( #4181 )
2022-06-08 12:35:23 +02:00
Daniel Marjamäki
86a8d88729
Tokenizer: Remove simplification of math functions from simplifyTokenList2
2022-06-08 09:58:11 +02:00
chrchr-github
bb3f490edd
Fix #11090 Infinite recursion in findTypeInBase() ( #4178 )
2022-06-08 09:20:16 +02:00
Oliver Stöneberg
9367be804e
fixed `modernize-use-equals-delete` warnings in headers ( #4177 )
2022-06-07 21:25:23 +02:00
chrchr-github
69834d537b
Fix #9997 False negative: variable is not used ( #4104 )
2022-06-07 21:20:33 +02:00
chrchr-github
1d677c57a8
Fix #11126 FN: noExplicitConstructor with single default parameter ( #4174 )
2022-06-07 21:15:13 +02:00
chrchr-github
b80d06b69e
Don't warn for 'x | MACRO' when MACRO is 0 ( #4176 )
2022-06-07 21:13:31 +02:00
chrchr-github
52453947c8
Don't warn for 'x | 0' in macro ( #4172 )
...
* Fix #11082 FN badBitmaskCheck for binary or with 0
* Add test for #10703
* Don't warn for 'x | 0' in macro
* Add test for #10876
2022-06-06 11:17:36 +02:00
chrchr-github
f962436826
Fix #11082 FN badBitmaskCheck for binary or with 0 ( #4170 )
...
* Fix #11082 FN badBitmaskCheck for binary or with 0
* Add test for #10703
2022-06-04 17:25:10 +02:00
orbitcowboy
433ce58fe6
Fixed FP found with daca@home: ftp://ftp.de.debian.org/debian/pool/main/libs/libslirp/libslirp_4.7.0.orig.tar.bz2; head libslirp-v4.7.0/src/tftp.c:336:20: error: Invalid strcasecmp() argument nr 1. A nul-terminated string is required. [invalidFunctionArgStr]
2022-06-04 12:00:54 +02:00
orbitcowboy
1c1c72058f
Fixed FP found with daca@home: ftp://ftp.de.debian.org/debian/pool/main/libs/libslirp/libslirp_4.7.0.orig.tar.bz2; head libslirp-v4.7.0/src/tftp.c:336:20: error: Invalid strcasecmp() argument nr 1. A nul-terminated string is required. [invalidFunctionArgStr]
2022-06-04 07:46:28 +02:00
Oliver Stöneberg
ce945ec7fc
enabled and fixed `modernize-use-override` clang-tidy warnings ( #4168 )
2022-06-03 21:32:39 +02:00
chrchr-github
e6f2929fac
Fix #11085 FN constVariable with range-based for ( #4118 )
2022-06-03 19:24:59 +02:00
Oliver Stöneberg
cc08a661e6
astutils.h: reserve `std::vector` space in `visitAstNodes()` to avoid excess allocations ( #4158 )
2022-06-03 19:21:17 +02:00
orbitcowboy
00abf21d40
Format
2022-06-03 18:59:43 +02:00
orbitcowboy
a74bb485b0
Fixed TODO_ASSERT
2022-06-03 18:59:09 +02:00
orbitcowboy
6680bf9790
Fixed TODO_ASSERT
2022-06-03 18:35:11 +02:00
Oliver Stöneberg
d36e05af28
enabled and fixed `modernize-use-emplace` clang-tidy warnings ( #4165 )
...
* enabled and fixed `modernize-use-emplace` clang-tidy warnings
* avoid unnecessary creation of temporaries in `emplace_back()` calls
2022-06-03 15:09:29 +02:00
chrchr-github
111f4e17da
Fix #11117 FP nullPointerArithmetic when adding 0 ( #4167 )
2022-06-03 13:11:54 +02:00
orbitcowboy
1a4bd0a7b3
Fixed FP, found with daca@home: ftp://ftp.de.debian.org/debian/pool/main/k/knot/knot_3.1.8.orig.tar.xz; knot-3.1.8/tests/knot/test_confio.c:301:18: error: Invalid strcmp() argument nr 2. A nul-terminated string is required. [invalidFunctionArgStr]
2022-06-03 13:10:45 +02:00
orbitcowboy
7dac213734
Removed useless parentheses
2022-06-03 10:50:07 +02:00
orbitcowboy
9b0f41e1a0
Revert change 3dfe9eff3e (commitcomment-75236431)
.
2022-06-03 10:22:29 +02:00
orbitcowboy
c24edc528e
astutils.cpp: Removed useless parentheses
2022-06-03 00:18:35 +02:00
orbitcowboy
3dfe9eff3e
astutils.cpp: Improved const correctness
2022-06-03 00:07:15 +02:00
Paul Fultz II
72342de0da
Fix 11114: FP knownConditionTrueFalse across functions ( #4163 )
...
* Fix 11114: FP knownConditionTrueFalse across functions
* Format
2022-06-02 23:24:11 +02:00
orbitcowboy
67795cdfcf
Fixed FPs from Ticket 11119 - invalidFunctionArgStr with null-terminated strings ( #4164 )
...
* Fixed first FP from #11119 - invalidFunctionArgStr with null-terminated strings
* Fixed second test case from #11119 .
* Fixed another FP, found on daca@home ftp://ftp.de.debian.org/debian/pool/main/g/glhack/glhack_1.2.orig.tar.gz.
* Format
2022-06-02 19:30:29 +02:00
orbitcowboy
58460edaf8
Fixed crash due to missing null pointer check.
2022-06-02 11:32:55 +02:00
orbitcowboy
7275350f3e
Combined consecutive Token::simpleMatch() calls
2022-06-02 07:27:19 +02:00
orbitcowboy
3b2509c9cc
Fixed failing self-check: style: Call to 'Token::previous()' followed by 'Token::tokAt()' can be simplified. [redundantNextPrevious]
2022-06-02 07:16:09 +02:00
orbitcowboy
886b5d1039
Improved invalidFunctionArgStr checking and detect more cases where a NON-null-terminated string is used to call functions, configured with <strz/>.
2022-06-02 01:09:09 +02:00
chrchr-github
cd7362e0e7
Fix FN with default init ( #4162 )
...
* Fix #11099 FP: variableScope when using range constructor to vector
* Format
* Fix FN with default init
2022-06-01 23:18:59 +02:00
chrchr-github
2452a2c01d
Fix #11099 FP: variableScope when using range constructor to vector ( #4161 )
...
* Fix #11099 FP: variableScope when using range constructor to vector
* Format
2022-06-01 21:15:41 +02:00
Paul Fultz II
e430a11b49
Add debug_valueflow instrinsic to show valueflow values and its error path ( #4159 )
...
* Add debug_valueflow instrinsic to show valueflow values and its error path
* Format
2022-06-01 06:53:21 +02:00
Oliver Stöneberg
40bcbd47d6
small `Token::Match()` optimizations ( #4154 )
...
* token.cpp: fixed `readability-else-after-return` warnings in `Match()`
* token.cpp: removed some duplicated code from `Match()`
* token.cpp: use `strchr()` instead of loop in `Match()`
* token.cpp: added early exit and removed unnecessary loop condition in `Match()`
2022-05-31 13:52:34 +02:00
Oliver Stöneberg
3d5d2e8fd8
inlined `findAstNode()` calls ( #4146 )
2022-05-31 13:37:21 +02:00
chrchr-github
423e67bd6a
Fix FP memleak ( #4145 )
2022-05-30 06:55:15 +02:00
Paul Fultz II
d7c914bd3e
Handle subfunction values in valueflow conditions ( #4128 )
2022-05-29 19:57:10 +02:00
chrchr-github
7fbb9c7c13
Fix #10980 FN constVariable with range-based for loop ( #4144 )
...
* Fix #10980 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 #11095 FP constParameter with decremented pointer ( #4131 )
2022-05-28 08:32:58 +02:00
chrchr-github
16a4449901
Fix crash with statement expression ( #4142 )
2022-05-28 00:11:23 +02:00
chrchr-github
16af6561c2
Fix FP memleak with unknown ptr typedef ( #4141 )
...
* Fix #11019 FN memleak with redundant pointer op
* Style
* Fix #7705 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 #11094 FP unreadVariable with unique_ptr and unknown type ( #4140 )
2022-05-27 17:17:50 +02:00
Rikard Falkeborn
068e5bad27
Fix #9966 : FP memleak with multiple assignments in if-statement ( #4138 )
...
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 ( #4139 )
...
* Fix #11019 FN memleak with redundant pointer op
* Style
* Fix #7705 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 ( #4133 )
...
* Fix #11019 FN memleak with redundant pointer op
* Style
* Fix #7705 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
orbitcowboy
eb3b8a6cec
checkAlwaysTrueOrFalseStringCompare: Added '_mbscmp_l' to list of functions.
2022-05-25 13:35:39 +02:00
chrchr-github
1ed280fe63
Fix FP memleak with function call, fix cppcheckError ( #4130 )
...
* Fix #11019 FN memleak with redundant pointer op
* Style
* Fix #7705 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 #11084 : ValueType for pointer typedef, don't warn for typedef'd pointers, improve error message ( #4123 )
...
* Fix ValueType for pointer typedef
* Add test
* Don't warn for typedef'd pointers, improve error message
* Fix tests
* Add TODO
* Fix test
* Set isSimplifiedTypedef() for more tokens, add test
* Add test
2022-05-24 10:09:48 +02:00
Paul Fultz II
7405ea039d
Refactor valueflow forward and reverse functions and unify them ( #4127 )
...
* Move functions around
* Make it a template to handle both overloads
* Simplify forward
* Remove container forward
* Remove unused settings params
* Format
* Remove valueFlowForwardExpression
* Format
* Remove init list
* Make const ref
* Remove braces
* Remove braces
2022-05-24 06:41:17 +02:00
Paul Fultz II
5999b35130
Fix 10944: FN: knownConditionTrueFalse ( #4124 )
...
* Fix 10944: FN: knownConditionTrueFalse
* Use or
* Format
2022-05-23 23:22:08 +02:00
chrchr-github
1ced94be43
Fix #11019 FN memleak with redundant pointer op / #7705 FN: Memory leak not detected on struct member ( #4126 )
...
* Fix #11019 FN memleak with redundant pointer op
* Style
* Fix #7705 FN: Memory leak not detected on struct member
2022-05-23 23:21:36 +02:00
Daniel Marjamäki
03c9253962
Token: add isRestrict flag
2022-05-22 14:10:55 +02:00
Paul Fultz II
e2c35abde5
Fix 11050: False positive: unreadVariable for class variable when another function uses the same variable name ( #4121 )
2022-05-22 09:20:32 +02:00
chrchr-github
22a4fdb6c4
Fix crash in checkPassByReference() ( #4122 )
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 #8545 FN Condition '...' is always true ' uint16_t i; ( i <= 0xFFFF)' ( #4114 )
2022-05-21 08:33:42 +02:00
Paul Fultz II
feaef46436
Fix 11076: Assert failure / crash with loop over init list ( #4119 )
2022-05-21 08:25:09 +02:00
Paul Fultz II
a62fb986a5
Fix 11090: Infinite recursion in findTypeInBase() ( #4120 )
2022-05-21 08:24:29 +02:00
chrchr-github
2b723eafcb
Fix ValueType for references in range-based for loop ( #4116 )
...
* Fix ValueType for references in range-based for loop
* Format
2022-05-20 08:48:01 +02:00
chrchr-github
112b1573c5
Fix #11078 FN constructing string from nullptr / #11079 FN unread variables ( #4112 )
...
* Fix #11078 FN constructing string from nullptr / #11079 FN unread variables
* Format
2022-05-18 13:52:44 +02:00
Daniel Marjamäki
54ec666739
provide more details when executing addons fails
2022-05-18 08:36:20 +02:00
Paul Fultz II
90e6c10c12
Fix 11072: FP arrayIndexOutOfBounds, nullPointer with nested loops ( #4113 )
...
* Fix 11072: FP arrayIndexOutOfBounds, nullPointer with nested loops
* Format
* Remove print statement
2022-05-18 08:29:30 +02:00
Oliver Stöneberg
14421ae627
fail `run-clang-tidy` in case of compiler warnings / fixed Clang warnings / cleanups ( #4036 )
2022-05-15 12:42:29 +02:00
orbitcowboy
e02182bd88
Cleanup redundant parentheses
2022-05-15 07:53:32 +02:00
orbitcowboy
4f410ffb79
library: Improved argument <valid>-interface to defined values that are explicitly excluded. ( #4111 )
...
* 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 #8004 unintentional semicolon in expression '.. ; +dostuff();' ( #4109 )
...
* Fix #8004 unintentional semicolon in expression '.. ; +dostuff();'
* Improve error message
* Don't remove single unary + in front of variables
2022-05-13 06:54:02 +02:00
Paul Fultz II
fbba72ab5a
Fix 11057: FP danglingTemporaryLifetime with reference member ( #4103 )
...
* 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 ( #4107 )
...
* Fix 11056: FP uninitvar with known condition in loop
* Format
2022-05-12 06:37:48 +02:00
Paul Fultz II
5d8da2b83c
Fix 11035: FP arrayIndexOutOfBoundsCond with array and vector ( #4105 )
...
* Fix 11035: FP arrayIndexOutOfBoundsCond with array and vector
* Format
* Move comment
2022-05-12 06:21:33 +02:00
chrchr-github
e7e8b1baf9
Fix #9861 FN: "static" not suggested for non-const method ( #4101 )
...
* Fix #9861 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 #11059 FP multiCondition when variable is assigned in if/else ( #4102 )
2022-05-11 20:01:13 +02:00
chrchr-github
942dbad11c
Fix #7197 not getting expected warning in relational comparison of booleans ( #4095 )
...
* Fix #7197 not getting expected warning in relational comparison of booleans
* return nullptr
2022-05-11 08:09:32 +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 #11052 inline static global struct declaration interferes with checks ( #4098 )
2022-05-10 20:43:11 +02:00
chrchr-github
759c16fcef
Fix boolean expressions ( #4099 )
...
* Enable experimental check
* Remove experimental
* Don't compare Booleans using relational operators
* Fix boolean expressions
2022-05-10 20:42:24 +02:00
Daniel Marjamäki
0a4e2abf01
dump: add token isComplex attribute
2022-05-10 19:05:02 +02:00
chrchr-github
e2bb77f990
Remove severity 'experimental' from checkComparisonOfBoolWithBool() ( #4097 )
...
* Enable experimental check
* Remove experimental
* Don't compare Booleans using relational operators
2022-05-10 18:25:13 +02:00