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
PKEuS
4b01d5bdc6
Re-enabled a bunch of disabled unit tests, some as TODO tests
...
Merged from LCppC.
2021-02-20 13:02:14 +01:00
PKEuS
cf1937294a
Refactorization: Removed unnecessary \n and spaces in strings
...
Merged from LCppC.
2021-02-20 12:58:42 +01:00
PKEuS
423d7dbc3c
Fixed false negatives literalWithCharPtrCompare when address-of operator (C only) or arrays are used, adapted TODO unit tests
...
Enabled working unit test in testunusedvar.cpp
Merged from LCppC.
2021-02-20 12:42:48 +01:00
miltolstoy
ee8d5b972a
checkunusedvar: handle array element change using pointer arithmetic ( #3000 )
2021-01-01 08:06:20 +01:00
miltolstoy
6366a577f9
feat(unused_var): analyze global variables inside function body ( #2944 )
2020-12-19 08:55:19 +01:00
Daniel Marjamäki
484b68c550
astyle formatting
2020-11-28 05:52:35 +01:00
miltolstoy
5d299016f1
feat: analyze function side effects ( #2901 )
2020-11-26 17:34:42 +01:00
Daniel Marjamäki
34c8334882
Fixed #9737 (False positive: unreadVariable)
2020-10-25 20:32:45 +01:00
Daniel Marjamäki
05514950af
astyle formatting
...
[ci skip]
2020-10-25 07:12:30 +01:00
miltolstoy
d55874ec37
checkunusedvar: handle initialization list ( #2836 )
2020-10-25 07:11:45 +01:00
Daniel Marjamäki
6de91d6386
Fixed #9707 (False positive: unreadVariable, union)
2020-10-02 20:22:22 +02:00
Daniel Marjamäki
ba84303501
Fixed #9680 (false positive: style: Variable 'x' is assigned a value that is never used with smart pointers)
2020-09-27 19:15:15 +02:00
Daniel Marjamäki
7bb82c5df7
Fixed #9901 (False positive: variable is assigned value that is not used 'if (--N == 0)')
2020-09-26 22:13:05 +02:00
Daniel Marjamäki
682a6d1c02
Fixed #9017 (Simple classes without side effects not reported as unused)
2020-07-23 11:10:08 +02:00
Daniel Marjamäki
0583763cc6
Fixed #3088 (False positive: Dont report "struct or union member is never used" for structs with __attribute__((packed)) or #pragma pack(push))
2020-06-30 11:00:40 +02:00
Daniel Marjamäki
08ddd84780
Update copyright year
2020-05-10 11:16:32 +02:00
Daniel Marjamäki
3e0218299b
Revert "Update copyright year"
...
This reverts commit 6eec6c4bd5
.
2020-05-10 11:13:05 +02:00
Daniel Marjamäki
6eec6c4bd5
Update copyright year
2020-05-10 11:11:34 +02:00
shaneasd
82c09f243b
Maybeunusedsupport ( #2570 )
...
* Add rudimentary support for [[maybe_unused]]
* Add more test cases. use the symboldatabase rather than reparsing. Fix travis error.
* test review actions
* change var to usage._var
2020-04-12 20:35:54 +02:00
Daniel Marjamäki
37a4e375ba
astyle formatting
...
[ci skip]
2020-04-08 22:39:17 +02:00
Achouv
7719e4309d
avoid false positive unused static const struct member ( #2598 )
2020-04-08 18:09:20 +02:00
Daniel Marjamäki
67b495fc50
Fixed #9280 (False positive: unreadVariable on assignment to fixed address volatile struct member)
2020-02-15 17:31:47 +01:00
Daniel Marjamäki
8c0ad6a1b9
Fixed #9555 (False positive (unreadVariable): struct is assigned a value that is never used)
2020-02-15 16:43:06 +01:00
Daniel Marjamäki
bd83630f2e
Fixed #8990 (False positive: struct member not used (union))
2019-12-20 18:31:55 +01:00
Daniel Marjamäki
f5e3dc9a38
Improved fix for #8978 (False positive: Variable assigned value that is never used when assigning via iterator)
2019-11-17 12:08:21 +01:00
Daniel Marjamäki
5654630099
Fixed #8978 (False positive: Variable assigned value that is never used when assigning via iterator)
2019-11-16 19:49:54 +01:00
Daniel Marjamäki
06ea1a2b53
Fixed #9312 (FP : variable is assigned a value that is never used (static))
2019-11-04 17:59:16 +01:00
Daniel Marjamäki
510748134f
Fixed #9234 (FP unreadVariable - assignment via iterator)
2019-08-04 10:21:16 +02:00
Daniel Marjamäki
a1214348c0
Fixed #8974 (false negative regression about never used variable)
2019-07-29 08:49:19 +02:00
Daniel Marjamäki
a178d05cc5
Changed TODO test case, I do not see why it should warn.
2019-07-29 07:51:00 +02:00
Daniel Marjamäki
d2284ddbcd
Fix false positives in self check: Variable t is assigned a value that is never used. Classes with destructors was not handled properly.
2019-07-14 16:20:45 +02:00
Daniel Marjamäki
1cadd9398a
Fixed #8933 (false negative: (style) Variable is assigned a value that is never used (std::string))
2019-07-14 09:44:30 +02:00
Daniel Marjamäki
f84dcc4738
astyle formatting
...
[ci skip]
2019-07-03 08:29:47 +02:00
Ken-Patrick
d6f6e68fa2
Fix false positive 9167 ( #1904 )
...
Skip returns from local class/struct definition in FwdAnalysis.
2019-07-03 08:17:06 +02:00
Paul Fultz II
108cdaa485
Fix FP with unreadVariable ( #1859 )
2019-05-31 08:06:36 +02:00
Daniel Marjamäki
bd7790fd8c
Update copyright year
2019-02-09 07:24:06 +01:00
Daniel Marjamäki
2bba9ac78a
Fixed #8948 (False Positive: Variable 'n' is assigned a value that is never used.)
2019-01-26 21:44:07 +01:00
Daniel Marjamäki
8c07be136a
Fixed #8949 (False Positive: Variable 'f' is assigned a value that is never used.)
2019-01-22 21:16:27 +01:00
Daniel Marjamäki
8da4e31c42
Fixed #8941 (False Positive: Variable 'f' is assigned a value that is never used.)
2019-01-20 13:20:23 +01:00
Daniel Marjamäki
d50c3de740
Remove inline suppression and fix false positive.
2019-01-13 07:59:41 +01:00
Daniel Marjamäki
8dd641b8be
Use OVERRIDE in test
2019-01-12 15:45:25 +01:00
Daniel Marjamäki
2b63997c2c
Fixed #8928 (false positive: (style) Variable 'x' is assigned a value that is never used.)
2019-01-02 20:23:02 +01:00
Daniel Marjamäki
6b49a784c5
Fixed #8911 (Regression: False positive: Unassigned variable (alias))
2018-12-30 20:20:20 +01:00
Daniel Marjamäki
6fef02498c
Fixed #7263 (False negative: redundant assignment using +=)
2018-12-27 17:27:53 +01:00
Daniel Marjamäki
e2c433a0f8
Fixed #8914 (False positive with unary_function argument)
2018-12-19 19:43:05 +01:00
Daniel Marjamäki
bf4e850e11
Fixed #4475 (New check: struct member is assigned a value that is not read)
2018-12-17 15:40:15 +01:00
Daniel Marjamäki
357e2fbfb3
Add testcase for #8807 (False negative: Redundant variable assignments (loop))
2018-12-16 21:45:26 +01:00