Commit Graph

347 Commits

Author SHA1 Message Date
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
Daniel Marjamäki c8d688607a Fixed #8901 (Unused value: const variable initialization) 2018-12-16 19:01:05 +01:00
Daniel Marjamäki 46a0172480 FwdAnalysis: fix FP in loop 2018-12-16 16:43:04 +01:00
Daniel Marjamäki 3af0d73f82 Unused value: Fixed false negatives for loops 2018-12-16 11:18:37 +01:00
Daniel Marjamäki 1bfe98447a FwdAnalysis: Tweak possiblyAliased 2018-12-15 11:54:00 +01:00
Daniel Marjamäki 37416010ef Unused value: Fix false positive (ast, {}) 2018-12-14 18:56:09 +01:00
Daniel Marjamäki 8464085535 UnusedVariables: Fix FP for unknown variable 2018-12-13 21:37:21 +01:00
Daniel Marjamäki 092d434f91 UnusedVar: Fix FP for array arguments 2018-12-13 21:08:18 +01:00
Daniel Marjamäki 1f27cd56c0 FwdAnalysis; Code cleanup, isNullOperand 2018-12-13 21:01:33 +01:00
Daniel Marjamäki 0b4e08cac9 Use FwdAnalysis in UnusedVar. This is still work-in-progress. Merging to master branch so it can be tested. 2018-12-13 18:52:56 +01:00
Daniel Marjamäki 69f6100d83 Fixed #8339 (false positive: unread variable despite delete is used on it) 2018-11-14 17:04:21 +01:00
Daniel Marjamäki 45379a3aa6 Updated copyright year for modified files
[ci skip]
2018-06-10 22:07:21 +02:00
IOBYTE ce50df8047 Fix override warnings. (#1234) 2018-05-15 16:37:40 +02:00
Daniel Marjamäki 7ee636b934 Refactoring: Reuse isLikelyStreamRead in isVariableChanged 2018-04-18 17:46:10 +02:00
Daniel Marjamäki c84628c28a Fixed #8494 (False positive: serialization class overloads operator) 2018-04-17 14:23:04 +02:00
Daniel Marjamäki c4caee6b18 Updated copyright year 2018-01-14 15:37:52 +01:00
Daniel Marjamäki b3c80947ed Fixed #6508 (False positive unusedStructMember - brace initializer) 2017-11-12 22:33:17 +01:00
Daniel Marjamäki e6f6efc684 astyle formatting
[ci skip]
2017-08-02 07:48:38 +02:00
Daniel Marjamäki 9ef9d0e4a8 Fixed #8128 (False negative: variable is assigned value that is not read) 2017-08-01 14:56:53 +02:00
Daniel Marjamäki 0a03bbb320 Fixed #6315 (false positive - unreadVariable - variable is used via pointer) 2017-07-23 23:32:14 +02:00
Daniel Marjamäki ac85b78e2a Fixed #5619 (false positive: unusedVariable - array accessed by pointer variable only) 2017-07-09 11:19:00 +02:00
Daniel Marjamäki d6f066482e Fixed #6542 (FP: Variable 'lcount' is not assigned a value - using address of integer array) 2017-07-01 11:31:51 +02:00
Daniel Marjamäki db01ea1408 Fixed #6261 (false positive: Variable used in ternary expression within function argument list) 2017-07-01 11:03:49 +02:00
Daniel Marjamäki b8ee500d45 Fixed #7092 (Invalid style error: Variable not assigned a value) 2017-06-03 15:31:29 +02:00
Ayaz Salikhov 28aa939d69 iwyu - include what you use 2017-05-27 04:33:47 +02:00
Daniel Marjamäki 040d2f0012 Use simplecpp lexer in test cases 2017-05-18 21:52:31 +02:00
Daniel Marjamäki 841e0c2921 Fixed #7546 (Assignment to array element not detected if pointer addition is used) 2017-02-28 22:04:05 +01:00
Matthias Krüger f80e888b7e run astyle
[ci-skip]
2017-01-31 16:22:31 +01:00
umanamente 0c1ba8e8b4 (Fixed #7895) C++11 brace initialization. Added test. (#862)
Add an optional extended description…
2017-01-22 10:16:40 +01:00
PKEuS 1227a3f596 Improved check: Complain if a variable is modified but not used again 2016-10-10 21:27:40 +02:00
Simon Martin d3c6fb4ccf Ticket #7557: Test case added since the fix for #7541 also fixed this. 2016-10-01 21:21:07 +02:00
Daniel Marjamäki ac1a869d60 unused struct members: don't warn about packed structs (#3088) 2016-09-05 17:27:12 +02:00
Daniel Marjamäki 60f22bd4ee Fixed #7477 (False positive 'Assigned value is never used' in multithreaded context) 2016-09-03 20:38:36 +02:00
Daniel Marjamäki f23287544a Fixed #7196 (Improve check: deem sizeof(thing) as using the thing's members) 2016-08-02 18:50:04 +02:00
Daniel Marjamäki 41526ef3a8 Fixed #6147 (FP unreadVariable: variable assignment in function call argument list) 2016-08-02 08:50:04 +02:00
Robert Reif c1594bedbb Fixed creation of SymbolDatabase for some template code (#7594) 2016-07-09 09:22:52 +02:00
PKEuS 3bdcf68990 Fixed false positive in CheckUnusedVar::checkFunctionVariableUsage(): Bailout when break; is encountered
See also: https://sourceforge.net/p/cppcheck/discussion/general/thread/1c169dc5/
2016-07-07 18:27:31 +02:00
Daniel Marjamäki 54be403f64 Fixed #7026 (Cppcheck does not recognizes the use of a variabile inside lambda function) 2016-05-26 18:07:56 +02:00
Daniel Marjamäki 7453b641bd Fixed #4839 (Variable (in array) is assigned a value that is never used) 2016-05-17 16:03:55 +02:00
Daniel Marjamäki b54613a942 Fixed #7046 (constexpr value used as template parameter reported as not used) 2016-01-31 12:39:43 +01:00
PKEuS 3b046b42a6 Support function pointers in CheckUnusedVar::checkFunctionVariableUsage_iterateScopes() (#7194) 2016-01-30 20:59:55 +01:00
Daniel Marjamäki fd67ca146d Fixed #4955 (false positive: Variable 'i' is assigned a value that is never used (only used in template instantiation)) 2016-01-30 16:49:39 +01:00
Daniel Marjamäki 95009a4630 Merge pull request #745 from lanurmi/2016_ad
Update copyright year to 2007-2016.
2016-01-01 22:57:19 +01:00
Daniel Marjamäki 3bd5a4d10e CheckUnusedVar: Fix FP when there is class initialization 2016-01-01 16:04:13 +01:00
Lauri Nurmi 996c9244d8 Update copyright year to 2007-2016. 2016-01-01 15:34:45 +02:00
Daniel Marjamäki dea41e2390 CheckUnusedVar: Fix FP for assignment in while 2016-01-01 12:14:18 +01:00
Daniel Marjamäki 350908d0e9 Fix FP in CheckUnusedVar. Caused by #7230 fix. 2015-12-31 15:30:33 +01:00
Daniel Marjamäki 8171154e12 Fixed #7230 (Confusing code snippet in error message) 2015-12-31 01:15:49 +01:00
PKEuS 8f22e4924c Updated AStyle to version 2.05.1
Tweaked runastyle.bat a little bit.
2015-12-17 15:53:13 +01:00
Matthias Krüger 158238ad4b add testcase for #7179 (see bebf8cc ) 2015-12-17 14:08:24 +01:00
Daniel Marjamäki bebf8ccdd5 Revert da15efb3 and 6304a4dd to fix FPs. See #7148, #7179, etc 2015-12-16 14:51:50 +01:00
Daniel Marjamäki 0f9d90d2be Changed Copyrights. Removed my name. 2015-11-18 20:04:50 +01:00
PKEuS 7866990d04 Fixed false positive with range-based for-loop (#7075) 2015-10-27 14:47:18 +01:00
PKEuS 3a5cef8a7e Refactorization: Improved usage of Settings instances in test suite 2015-10-07 18:40:03 +02:00
Dmitry-Me 6304a4dddb Fix FP for members of temporaries 2015-09-25 13:57:11 +03:00
Dmitry-Me da15efb3f6 Fix FN for distinct structs with identical members 2015-09-24 18:29:08 +02:00
Dmitry-Me 0b991f5560 Tell if it's struct or union 2015-09-22 17:38:23 +03:00
Simon Martin c78d99dc07 Ticket #6954: Properly handle pointers to arrays in CheckUnunsedVar. 2015-08-27 23:56:26 +02:00
PKEuS ac867b4220 Handle pointers to const member functions in Tokenizer::simplifyFunctionPointers() (#6603) 2015-04-13 21:21:57 +02:00
PKEuS bc5132e0ac Refactorization: Moved declaration of errout, ... to testsuite.h, uniformized style 2015-03-11 22:54:43 +01:00
Daniel Marjamäki ff11ba9847 Updated copyright year to 2015 2015-01-03 12:14:58 +01:00
Alexander Mai ec2c4aa2e3 #6301 Unused shared lock variable. Add exception for std::shared_lock() to CheckUnusedVar::checkFunctionVariableUsage_iterateScopes() 2014-12-07 15:32:09 +01:00
Daniel Marjamäki 051d42ae6b astyle formatting 2014-11-20 14:20:09 +01:00
orbitcowboy f5d804f71a running astyle 2014-11-20 10:13:03 +01:00
PKEuS 6955e719cf Collected garbage code tests and moved them to testgarbage.cpp 2014-10-16 10:59:46 +02:00
PKEuS 936043d47d Fixed false positive 'unusedVar' with C++11 initialization (#6160) 2014-09-30 12:39:27 +02:00
PKEuS b8918906e6 Fixed false positive #5466 2014-08-31 19:46:30 +02:00
PKEuS 8f4662de92 No unused variable messages about std::unique_ptr|shared_ptr|auto_ptr (#4355) 2014-08-31 19:18:02 +02:00
PKEuS adcc8b1634 Implement support for __attribute__((used)) (#3408) 2014-08-06 11:13:58 +02:00
PKEuS f3e0df7501 Support C++11 style initialization with {}:
-> Support in setVarId and SymbolDatabase (#4344)
-> Fixed false positives in unused variable checking (#5491, #5494)

Side-effect: Support global variables initialized with brackets (C++03 style) in SymbolDatabase
2014-08-05 15:33:57 +02:00
PKEuS 57c055fcc4 Fixed false negative #5985: default argument values should not affect variable usage checking. 2014-08-03 19:13:37 +02:00