chrchr-github
cab4997b0b
Fix #11039 Empty AST with delete new / #11327 FP leakReturnValNotUsed with new and offset ( #4513 )
...
* Fix internalAstError with new
* Format
* nullptr check
* Add test for #11039
* Fix #11039 Empty AST with delete new / #11327 FP leakReturnValNotUsed with new and offset
2022-09-27 18:12:58 +02:00
chrchr-github
0f79f8bd70
Fix internalAstError with new ( #4508 )
...
* Fix internalAstError with new
* Format
* nullptr check
2022-09-26 22:05:58 +02:00
chrchr-github
64f3f85804
Fix #11332 Function::addArguments found argument 'b' with varid 0 wit… ( #4506 )
...
* Fix #11332 Function::addArguments found argument 'b' with varid 0 with lambda parameter
* Fix varid0 warning
2022-09-26 18:21:21 +02:00
Paul Fultz II
fc39a4d1bb
Fix 11171: False positive: missing return statement when std::enable_if_t is used ( #4504 )
...
* Fix 11171: False positive: missing return statement when std::enable_if_t is used
* Format
* Return false
* Workaround bug in cppcheck
2022-09-26 18:20:42 +02:00
orbitcowboy
2bdeaf858e
Added regression test for ticket #11091 - FP: Using object that is a temporary
2022-09-24 22:11:04 +02:00
chrchr-github
2808fc615e
Fix #10057 "statement without effect" / #4779 FN unusedScopedObject does not work for classes in different namespace ( #4500 )
...
* Partial fix for #10057 unused variable without assignment not detected
* Add test for #9672
* Fix #4779 FN unusedScopedObject does not work for classes in different namespace
* Merge
* Fix #10057 "statement without effect" (unused variable without assignment) not detected
* Format
2022-09-24 12:49:37 +02:00
Oliver Stöneberg
dc03a50414
some small cleanups and refactorings ( #4488 )
...
* moved `plistFile` from `ErrorLogger` to `CppCheck`
* got rid of global CWE objects
* lib/CMakeLists.txt: suppress some `-Wfloat-equal` clang warning in matchcompiled builds as well
* lib/CMakeLists.txt: moved a loop into proper block
* test/CMakeLists.txt: simplified `add_fixture`
* test/CMakeLists.txt: moved `fixture_cost`
* fixed `naming-privateMemberVariable` selfcheck warning
2022-09-24 11:59:13 +02:00
chrchr-github
d608bec414
Fix FP with std::array ( #4497 )
...
* Fix #1655 wrong usage of std::string in memcpy
* Fix memsetClass FP
* Fix #8619 FN memset on container containing structs with containers
* Token::Match
* Use AST
* simpleMatch
* Fix FP with std::array
* simpleMatch
2022-09-23 20:18:49 +02:00
chrchr-github
0bb82b70d9
Fix #11328 FN functionStatic, functionConst with this ( #4496 )
...
* Fix #11328 FN functionStatic, functionConst with this
* Fix FP
2022-09-23 08:46:31 +02:00
chrchr-github
bb2ba53bf5
Add tests for #6504 , #11177 ( #4494 )
...
* Add test for #11177
* Add test for #6504
2022-09-22 19:41:29 +02:00
Jim Kuhn
f27fbdd8ab
Fix sense of test (.analyzerinfo files get placed in wrong directory) ( #4486 )
...
* Fix sense of test (.analyzerinfo files get placed in wrong directory)
* Update testanalyzerinformation.cpp
style (tabs -> spaces)
2022-09-21 17:38:23 +02:00
chrchr-github
3b07661fd3
Fix #11293 debug: CheckClass::isMemberVar found used member variable 'x' with varid 0 ( #4489 )
2022-09-21 17:35:10 +02:00
chrchr-github
2aca275e0c
Fix #8619 FN memset on container containing structs with containers ( #4491 )
...
* Fix #1655 wrong usage of std::string in memcpy
* Fix memsetClass FP
* Fix #8619 FN memset on container containing structs with containers
* Token::Match
* Use AST
* simpleMatch
2022-09-21 17:33:48 +02:00
chrchr-github
3644d79162
Fix duplicateConditionalAssign FP ( #4484 )
...
* Fix #9406 FN redundant assignment of Boolean variable
* Fix warning, refactor
* Update testcondition.cpp
* Fix duplicateConditionalAssign FP
* Format
2022-09-20 21:57:27 +02:00
chrchr-github
48999cf1d1
Add support for std::ofstream::precision() ( #4485 )
...
* Add support for std::copy_n/merge/stable_sort
* Format
* Add support for std::unordered_set::count(), std::push_heap
* Missing include
* Add support for std::iota
* Missing include
* Add support for std::ofstream::precision()
* Typo
* Typo
2022-09-20 17:23:18 +02:00
chrchr-github
2ce25abd81
Add support for std::iota ( #4481 )
...
* Add support for std::copy_n/merge/stable_sort
* Format
* Add support for std::unordered_set::count(), std::push_heap
* Missing include
* Add support for std::iota
* Missing include
2022-09-20 07:30:24 +02:00
chrchr-github
dcb332acb0
Fix #9406 FN redundant assignment of Boolean variable ( #4482 )
...
* Fix #9406 FN redundant assignment of Boolean variable
* Fix warning, refactor
* Update testcondition.cpp
2022-09-20 07:30:12 +02:00
chrchr-github
f274d499a1
Fix #11171 FP missing return statement when std::enable_if_t is used ( #4480 )
...
* Fix #11171 FP missing return statement when std::enable_if_t is used
* Add check
2022-09-19 12:47:58 +02:00
Paul Fultz II
09944c0b7e
Fix 11298: FP danglingTemporaryLifetime when constructing from const char* ( #4479 )
...
* Fix 11298: FP danglingTemporaryLifetime when constructing from const char*
* Format
2022-09-18 08:30:58 +02:00
Paul Fultz II
de7d02293f
Fix 11308: FP accessMoved with virtual function ( #4478 )
...
* Fix 11308: FP accessMoved with virtual function
* Format
2022-09-18 08:30:06 +02:00
Paul Fultz II
d34de745c0
Fix 11306: FP knownConditionTrueFalse with strlen() ( #4477 )
...
* Fix 11306: FP knownConditionTrueFalse with strlen()
* Add another test
2022-09-18 08:29:10 +02:00
Oliver Stöneberg
8126d5c1a6
improved `TestCmdlineParser` ( #4475 )
2022-09-17 18:50:25 +02:00
chrchr-github
cb6f04a16c
Fix #11315 FP zerodivcond from enum definition / #11310 FP unassignedVariable with static variable ( #4476 )
...
* Fix #11315 FP zerodivcond from enum definition
* Simplify Boolean expression
* Fix #11310 FP unassignedVariable with static variable
2022-09-17 18:50:07 +02:00
Oliver Stöneberg
897826006e
mitigated some clang-tidy warnings in headers ( #4472 )
...
* erroritem.h: avoid `performance-no-int-to-ptr` clang-tidy warning
* suppress `readability-inconsistent-declaration-parameter-name` clang-tidy warnings for Qt signals
* tokenlist.h: mitigated `readability-make-member-function-const` clang-tidy warnings
* fixed `modernize-use-override` clang-tidy warnings in headers
* fixed `modernize-pass-by-value` clang-tidy warnings in headers
* tokenize.cpp: avoid unnecessary copy
2022-09-16 18:59:15 +02:00
Oliver Stöneberg
339484d2a1
mitigated and enabled more clang-tidy warnings ( #4470 )
...
* fixed some `performance-inefficient-string-concatenation` clang-tidy warnings
* fixed and enabled `modernize-replace-random-shuffle` clang-tidy warning
* fixed and enabled `bugprone-suspicious-string-compare` clang-tidy warning
* mitigated and enabled `readability-non-const-parameter` clang-tidy warnings
* clang-tidy.md: documented some disabled checks
* mitigated and enabled `performance-unnecessary-value-param` clang-tidy warnings
2022-09-16 18:58:59 +02:00
chrchr-github
45ccc9ba1e
Fix ctunullpointer FP ( #4471 )
2022-09-16 12:11:34 +02:00
Oliver Stöneberg
b3ec225480
iwyu.yml: use `debian:unstable` to always get latest include-what-you-use / cleaned up includes ( #4466 )
...
* iwyu.yml: use debian:unstable to always get latest include-what-you-use
* cleaned up includes based on include-what-you-use
* mitigated include-what-you-use false positives
2022-09-16 07:15:49 +02:00
chrchr-github
d6aab96734
Add support for std::unordered_set::count(), std::push_heap ( #4469 )
...
* Add support for std::copy_n/merge/stable_sort
* Format
* Add support for std::unordered_set::count(), std::push_heap
* Missing include
2022-09-16 07:12:36 +02:00
chrchr-github
c9ade33298
Fix memsetClass FP ( #4465 )
2022-09-15 20:20:49 +02:00
chrchr-github
7111270d5f
Add support for std::copy_n/merge/stable_sort ( #4467 )
...
* Add support for std::copy_n/merge/stable_sort
* Format
2022-09-15 19:56:45 +02:00
chrchr-github
d1386a842a
Fix #11301 debug: constStatementError not handled. ( #4463 )
...
* Fix #11301 debug: constStatementError not handled.
* Use function
2022-09-14 23:57:02 +02:00
chrchr-github
266174ddc4
Fix #10993 danglingTemporaryLifetime reported in two different locati… ( #4462 )
...
* Fix #10993 danglingTemporaryLifetime reported in two different locations for std::string_view usage
* Missing include
* Add test
2022-09-14 07:28:04 +02:00
chrchr-github
07caf17eb3
Fix #1655 wrong usage of std::string in memcpy ( #4460 )
2022-09-13 15:14:25 +02:00
chrchr-github
e904f7341e
Fix ValueFlow crash ( #4461 )
2022-09-13 12:25:15 +02:00
Paul Fultz II
43caa32abf
Fix 9755: false negative: access of moved variable in conditional code ( #4459 )
...
* Fix 9755: false negative: access of moved variable in conditional code
* Format
2022-09-11 12:32:01 +02:00
Paul Fultz II
53820515c9
Set valueflow for container elements ( #4455 )
...
* Track elements to containers
* Format
* Handle other access methods
* Format
2022-09-10 09:26:44 +02:00
Paul Fultz II
117a753b10
Partial fix 11154: FN: knownConditionTrueFalse ( #4453 )
...
* Partial fix 11154: FN: knownConditionTrueFalse
* Formay
* Add more tests
* FOrmat
* Fix FP
* Add test
* Check for side effects
* Format
* Update tests
* Format
2022-09-08 22:08:38 +02:00
Oliver Stöneberg
dbc05da356
fixed some clang-tidy warnings ( #4435 )
2022-09-08 20:01:41 +02:00
Paul Fultz II
7c986fbef1
Fix 11203: false positive: knownConditionTrueFalse 'always false' when comparing integer with floating-point ( #4350 )
2022-09-08 19:59:02 +02:00
Paul Fultz II
f83b8dd385
Fix 11194: FN: knownConditionTrueFalse ( #4452 )
...
* Fix 11194: FN: knownConditionTrueFalse
* Format
2022-09-08 18:51:44 +02:00
Daniel Marjamäki
92845295b8
Fix broken CI caused by my qt fix
2022-09-08 11:12:38 +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
Oliver Stöneberg
54771306c5
selfcheck : cleaned up some suppressions, fixed warnings and some cleanups ( #4436 )
...
* cleaned up triage.pro and pass all triage files to selfcheck
* CI-unixish.yml: factored out redundant selfcheck flags
* CI-unixish.yml: cleaned up selfcheck suppressions and fixed warnings
* added explicit `missingInclude` checks to selfcheck to work around current issues/limitations / fixed selfcheck includes / added some unit tests for `missingInclude`
* applied the selfcheck changes to the sanitizer jobs
* only fail TSAN CI build in case of TSAN error / updated sanitizer CI build TODOs
2022-09-06 23:11:39 +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
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
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
b815153b0c
Add test for #10594 ( #4397 )
2022-08-26 11:36:47 +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
Daniel Marjamäki
112852f70b
formatting
2022-08-24 08:53:59 +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
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
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
PKEuS
d81a758850
LCppC backports: Refactorizations/Optimizations ( #4204 )
2022-08-21 17:21:02 +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
chrchr-github
5cc8ef7e87
Add test for #9817 ( #4388 )
...
* Add test for #8919
* Add test for #9817
* Revert
2022-08-20 19:23:55 +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
1b4141cbe5
added more missing `sstream` includes ( #4384 )
2022-08-19 18:23:15 +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
chrchr-github
2fee7a6e3f
Add test for #9744 , #11140 ( #4375 )
...
* Add test for #10603
* Add test for #10559
* Add test for #10212
* Format
* Add test for #9744
* Format
* Add test for #11140
2022-08-18 23:37:41 +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
chrchr-github
e9f1665d4f
Add test for #10212 ( #4373 )
...
* Add test for #10603
* Add test for #10559
* Add test for #10212
* Format
2022-08-17 19:38:37 +02:00
chrchr-github
0978cc2d46
Add tests for #10559 , #10603 ( #4367 )
2022-08-17 10:01:49 +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
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
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
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
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
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
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