156 Commits

Author SHA1 Message Date
PKEuS
8924e8af43 Fixed #4143: Give correct line numbers in checkunusedvar.cpp 2012-09-04 14:53:24 +02:00
kbajaj91
be716e81d3 Fixed #4138 - False positive about variable assigned a value that is never
used in loops
2012-09-04 13:06:04 +02:00
Kartik Bajaj
ea0cbbcf78 Fixed #1481 2012-09-02 18:50:17 +02:00
Daniel Marjamäki
7975ffba21 Fixed #3980 (Variable not assigned a value) 2012-08-25 13:07:33 +02:00
Daniel Marjamäki
f133c9e8ec Fixed #4020 (false positive: (style) Variable 'dst' is assigned a value that is never used) 2012-08-22 19:47:46 +02:00
PKEuS
c537a86363 Fixed false negative in unused variable checking when class without side effects inherits from another one. 2012-08-20 07:55:39 -07:00
PKEuS
35d94c26d5 Changed creation of SymbolDatabase. Database always created after Tokenizer::tokenize() and Tokenizer::simplifyTokenList() instead of on-demand creation by Tokenizer::getSymbolDatabase.
-> With Token::scope() it is possible to access the symboldatabase without having to call getSymbolDatabase(). The change increases safety because it is guaranteed that the database is available in all checks, even if the specific check doesn't call getSymbolDatabase
- Tokenizer::_symbolDatabase does no longer have to be mutable -> Increased const correctness

The change above required two additional changes:
- A bug causing a debug message was fixed in the symboldatabase that became visible in the test suite by the change above.
- Simplify expressions like "struct struct Foo" which might be result of typedef instanciation.
2012-08-12 03:01:24 -07:00
PKEuS
355c1322d6 Small refactorizations in checkunusedvar.cpp:
- Token::Match handles nullpointers
- In chained assignments variables are only written (not read) when assigned
- Fixed crash #4033
2012-08-10 03:36:08 -07:00
PKEuS
c11e8cdbfa Fixed false positive "Variable is not assigned a value" on class types 2012-07-25 00:34:27 -07:00
PKEuS
bb940e4722 Implemented unused variable checking for standard types (#2851) 2012-07-24 11:47:29 -07:00
PKEuS
2103811291 Refactorizations in testrunner:
- Removed unnecessary space characters
- Removed comments from test cases which are not preprocessed
2012-07-16 05:02:33 -07:00
Daniel Marjamäki
cb7757f650 CheckUnusedVar: dont report false positives for extern variables 2012-06-28 17:22:56 +02:00
Daniel Marjamäki
25b24d149f Fixed #3910 (False positive: Variable is not assigned a value (pointerArray alias)) 2012-06-24 16:54:37 +02:00
Daniel Marjamäki
951da02f89 Reviewed handling of unknown types in C files in checkunusedvar 2012-06-22 15:59:41 +02:00
Daniel Marjamäki
082e6d506b #3744 (Unexpected unused value warning for char ptr types set in switch) 2012-04-28 15:43:42 +02:00
Ettl Martin
bf0ed17a16 added testcase for ticket #3602 2012-04-27 02:05:45 +02:00
Daniel Marjamäki
d5f6cfcfa8 Tokenizer: Use new setVarId function. Removed the old one. 2012-04-22 11:36:31 +02:00
Daniel Marjamäki
aeac38b673 Tokenizer::setVarIdNew: Removed test case in TestUnusedVar that fails with the new setVarId function. The new setVarId function assumes that 'static int i(a);' is a variable declaration if it's in a executable scope (it is unknown if 'a' is a type or a variable so this assumption could be wrong). 2012-04-22 10:42:55 +02:00
Ettl Martin
2840b19fb3 removed some c++-comments within testcases ( from my last commit ). No functional change. 2012-04-19 10:15:29 +02:00
Ettl Martin
7699d5bf87 #3742 added testcases to ensure it works correctly. 2012-04-19 10:08:51 +02:00
PKEuS
782cd5d228 Fixed #3687: Don't treat catched variables as local ones. 2012-03-26 21:19:42 +02:00
PKEuS
002389f836 Fixed #3677
Added forgotten testcase for #3672
2012-03-21 18:40:32 +01:00
Daniel Marjamäki
385c9d341d Fixed #3633 (False positive: struct array not assigned a value) 2012-02-26 08:29:02 +01:00
Daniel Marjamäki
bbfae8e3ae Fixed #3583 (False positive Variable X is assigned a value that is never used) 2012-02-25 12:56:33 +01:00
Daniel Marjamäki
69d03bac34 Fixed #3603 (False Positive: Variable is assigned a value that is never used) 2012-02-19 15:25:46 +01:00
Daniel Marjamäki
9f139cf414 Fixed #3509 (FP: Variable 'itemList' is not assigned a value, when << operator is used) 2012-01-23 08:02:59 +01:00
Edoardo Prezioso
57fcde8090 Fixed ticket #3481 (segmentation fault of cppcheck) 2012-01-09 13:39:02 +01:00
Daniel Marjamäki
304980848f Fixed #3473 (False positive: variable is assigned value that is never used (used in return statement)) 2012-01-08 08:44:18 +01:00
Daniel Marjamäki
70c83d9ca9 Fixed #3467 (False positive: Variable is not assigned a value (new)) 2012-01-08 08:31:00 +01:00
Reijo Tomperi
8cae17fda8 Update year to 2012 2012-01-01 01:05:37 +02:00
Daniel Marjamäki
2ae48c7aef Fixed #3454 (false positive: (style) Variable 'iFaktor' is assigned a value that is never used) 2011-12-30 09:47:15 +01:00
Daniel Marjamäki
fd4bc12ed3 Fixed #3438 (false positive: (style) Variable 'dBuf' is not assigned a value) 2011-12-26 08:12:23 +01:00
PKEuS
6dc2a6e7ab Refactorized CheckUnusedVar 2011-12-18 20:15:41 +01:00
Daniel Marjamäki
6f8e42a5af changed the astyle formatting flags 2011-10-13 20:53:06 +02:00
Daniel Marjamäki
9a97fbe022 Fixed #3104 (unread despite modified and used in IF statement) 2011-09-11 08:19:35 +02:00
Daniel Marjamäki
8240422a09 Fixed #3078 (vector::at using int causes false positive) 2011-09-04 20:48:05 +02:00
Robert Reif
477d1e92c9 add new (nothrow) support to CheckUnusedVar::checkFunctionVariableUsage 2011-08-31 06:39:39 -04:00
Robert Reif
2dd93dff75 move unused variable checks from checkother to checkunusedvar 2011-08-19 14:35:25 -04:00
Kimmo Varis
cfcfa3f000 Use "enabled" list for the style checking.
Settings-class currently enables style checking via dedicated
boolean attribute. All other CLI's enable-options are handled
through the enable-list. This commit moves style-check enabling
to use the enable-list.

Main advantage is the consistency how options are handled/stored
in the Settings class. Which also unifies using them for the other
code. You need to enable certain type of checks? Use the
addEnabled()-method. You want to check if certain type of checks
are enabled? Use the isEnabled()-method.
2011-08-07 10:28:52 +03:00
Robert Reif
9a4447c835 add support for unused const local variables 2011-07-24 12:09:59 -04:00
Robert Reif
c3c3eb74e8 fix #2929 (Additional Unused variable check) 2011-07-21 18:37:37 -04:00
Robert Reif
270b2b1772 fix #2904 (Memory leak not detected when creating a new class instance) 2011-07-14 19:15:59 -04:00
Robert Reif
b32b2c6d87 add support for checking unused std::string local variables 2011-07-02 19:25:10 -04:00
Robert Reif
301e59cea0 fix false positive for unused local class/struct variable 2011-07-01 08:45:29 -04:00
Robert Reif
18e6509c5d add support in CheckOther::functionVariableUsage() for checking structures that are declared with struct keyword 2011-07-01 07:42:20 -04:00
Robert Reif
7826b5e22d add support for detecting unused function variables of type class or struct 2011-06-30 21:58:11 -04:00
Daniel Marjamäki
97d47fa20e Fixed #2805 (false positive: [NotAssigned1.cpp:5]: (style) Variable 'y' is not assigned a value) 2011-06-08 19:54:01 +02:00
Daniel Marjamäki
144d811e54 Fixed #2780 (false positive: variable p is not assigned a value 'int p[2]; *p = 0;') 2011-05-11 18:58:25 +02:00
Daniel Marjamäki
3629f953f0 Fixed #2770 (False positives (scope can be reduced / variable is assigned value that is never used)) 2011-05-06 21:16:01 +02:00
Daniel Marjamäki
5175e4ff3f Fixed #2535 (false positive: (style) Variable 'A' is not assigned a value) 2011-02-09 19:20:44 +01:00