Commit Graph

364 Commits

Author SHA1 Message Date
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
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
orbitcowboy 9f7c34272d Added a regression test for ticket #10000 - No UnreadVariable for simple class 2022-05-03 06:58:03 +02:00
chrchr-github 0636018df3
Fix #10368 FP: unassignedVariable with structured binding (#3990) 2022-04-09 14:50:30 +02:00
chrchr-github 7b97230dd2
Fix #10505 FP unreadVariable for lock_guard variable (#3938) 2022-03-28 21:45:49 +02:00
chrchr-github 190506db40
Fix #10737 Regression: unusedStructMember (#3894)
* Fix #10737 Regression: unusedStructMember

* Add test for #9161

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

* Fix test

* Fix test cases
2022-03-13 06:26:21 +01:00
chrchr-github 4c85ac0d7b
Fix #10852 FP unused struct member (inner struct in C code) (#3890)
* Fix #10852 FP unused struct member (inner struct in C code)

* Redundant findType() call, add test
2022-03-12 06:16:29 +01:00
chrchr-github 2616046461
Partial fix for #10848 FP: unusedStructMember (#3880) 2022-03-09 20:25:58 +01:00
chrchr-github 557263acde
Partial fix for #10848 FP: unusedStructMember (II) (#3881)
* Preliminary

* Fix member search, add tests
2022-03-09 18:22:30 +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 0b0a8cad39
Fix #10846 FP unreadVariable within a macro (regression) (#3874)
* Fix #10846 FP unreadVariable within a macro (regression)

* Format

* Format
2022-03-05 08:14:57 +01:00
chrchr-github 9c50136571
Fix #10824 FN unreadVariable for pointer assignment when destructor exists (regression) (#3864)
* Fix #10824 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
chrchr-github 441b437cea
Fix #10826 FN: unusedStructMember (#3858) 2022-02-26 18:53:00 +01:00
chrchr-github 172aafdeb8
Fix #7908 FN: redundant assignment in loop (#3650) 2022-02-22 09:51:44 +01:00
chrchr-github 0a99e3b6fc
Partial fix for #9407 FN redundant assignment/unreadVariable (#3651) 2022-02-12 15:32:08 +01:00
Oliver Stöneberg f32583e097
removed OVERRIDE and FINAL defines and use the keywords directly (#3767) 2022-02-10 23:02:24 +01:00
Daniel Marjamäki 3989408738 Update copyright year 2022-02-05 11:45:17 +01:00
chrchr-github 8cf5c8fbf2
Fix #10684 FP unusedStructMember with static object (#3681) 2022-02-02 19:28:16 +01:00
chrchr-github 127b3bb1c4
Fix #9471 FP unreadVariable caused by invalid template injection (#3783) 2022-02-01 17:15:27 +01:00
Oliver Stöneberg 171da2e6f9
avoid dependency on transitive includes - based on include-what-you-use (#3757) 2022-01-27 19:03:20 +01:00
chrchr-github c132235a76
Add test for #10398 (#3752)
* Fix #10200 False positive: uninitStructMember

* Fix #9828 False positive: unreadVariable alias

* Use Token::Match

* Add test for #10398
2022-01-25 22:05:54 +01:00
chrchr-github d05e43ce15
Fix #9828 False positive: unreadVariable alias (#3744) 2022-01-24 21:52:45 +01:00
chrchr-github 089ca67d78
Use TODO_ASSERT (#3704) 2022-01-18 22:03:52 +01:00
chrchr-github 95dc05b21d
Fix #7732 false negative: (style) Unused variable: std::pair (#3695) 2022-01-13 08:05:05 +01:00
chrchr-github 7aa0ec3e95
Fix regression: unreadVariable for trivial initialization (#3698) 2022-01-12 22:06:03 +01:00
chrchr-github 1670805a8d
Fix #10490 FP unreadVariable with std::shared_lock (#3672) 2022-01-10 07:43:02 +01:00
chrchr-github df3da38483
Fix #10682 Unused QString / #10686 unused std::array / #10005 unused variable with c++11 braced initializer not detected (#3684) 2022-01-10 07:36:49 +01:00
chrchr-github 5a95ece15e
#10591: add TODO (#3647) 2021-12-21 10:24:38 +01:00
chrchr-github bb327be8e8
Fix #10591 FP unusedStructMember with value-initialized struct and typedef (#3643) 2021-12-18 22:55:52 +01:00
chrchr-github ca311ebcdf
ASSERT() on calls to Tokenizer::tokenize() in test code (#3501) 2021-11-29 07:34:39 +01:00
Daniel Marjamäki 3f7093004a Fixed #10485 (FP unusedStructMember for array size) 2021-10-30 19:34:46 +02:00
chrchr f363d8948b Fix test case 2021-10-30 19:04:50 +02:00
Daniel Marjamäki 1f01845efb Fixed #10531 (FP unreadVariable with reference and *=) 2021-10-25 19:34:19 +02:00
Daniel Marjamäki 2ee920dc4e Fixed #10495 (False positive: unreadVariable when assigning to reference returned by method) 2021-09-24 07:30:17 +02:00
Daniel Marjamäki a55b0c332a Fixed #10095 (False positive: unreadVariable) 2021-08-27 17:37:42 +02:00
Paul Fultz II 7f358b2bed
Format with uncrustify (#3388) 2021-08-07 20:51:18 +02:00
Daniel Marjamäki 216918756b Fixed #10276 (FP: (style) Variable '((uint8_t*)(uint16_t)0x1000)[0]' is assigned a value that is never used.) 2021-05-18 20:35:00 +02:00
Daniel Marjamäki 3c885df74d testunusedvar: Remove test cases that have undefined behavior 2021-05-15 14:55:35 +02:00
Daniel Marjamäki 404b82fc21 unused var; fix todo test cases, redundant assignment of array in loop 2021-05-14 19:07:30 +02:00
Daniel Marjamäki 56410c3d00 testunusedvar: fix mismatching allocation/deallocation in test 2021-05-14 14:01:39 +02:00
Daniel Marjamäki 56bc5536aa testunusedvar: move UB testcase to testuninitvar 2021-05-14 11:24:39 +02:00
Daniel Marjamäki ffac1d1b00 testunusedvar.cpp: remove test cases that has undefined behavior 2021-05-14 11:06:44 +02:00
Daniel Marjamäki fd31f0846e unused var; remove test case that has undefined behavior 2021-05-13 21:53:06 +02:00
Daniel Marjamäki 1def0d797b extracttests: disable TestUnusedVar::localvar2 tests they do not make sense externally 2021-05-13 21:31:44 +02:00
Daniel Marjamäki d549770b5b updated extracttests.py. fix syntax errors in test cases. 2021-05-13 20:21:02 +02:00
Daniel Marjamäki 2e2d766e2b Fixed #6766 (Improve check; struct member is assigned value that is never used) 2021-05-09 20:09:10 +02:00
dummyunit b18e6f1e10
Fix varId assignment for uses of variables declared in the if condition (#3231)
Variables declared in the if condition (or in C++17 init-statement) are
visible not only in the if body but also in the else body. But logic in
Tokenizer::setVarIdPass1() handled such variables as if they were
declared in the if body.

As the result they were removed from variablesMap by the time the else
block was parsed and their uses in the else block were either given an
incorrect varId from variables in some outer scope or not given a varId
at all.

This then resulted in false positive unreadVariable errors for variables
declared in the if condition (or init-statement) and used only in the
else block.

Simplification from "else if ..." to "else { if ... }" was moved before
setVarId() to simplify detection for ends of blocks in if-else chains.
2021-04-26 07:38:03 +02:00
Daniel Marjamäki 42437277dc Update Copyright year 2021-03-21 20:58:32 +01:00
PKEuS 141d2ac215 Refactorization: Improved internal implementation of severity and certainty levels
Backported from LCppC.
2021-02-24 22:00:06 +01:00