Commit Graph

46 Commits

Author SHA1 Message Date
Daniel Marjamäki 5ad3ac2653 Fixed #5695 (FP: Mismatching assignment and comparison) 2014-05-06 19:35:47 +02:00
PKEuS 25b1f2f541 Fixed #5643 (crash on address-of-operator& in condition) as suggested by serval2412 2014-04-10 19:49:21 +02:00
Daniel Marjamäki 8dcb3bae47 Refactoring checks of overlapping conditions in if and else-if 2014-04-03 19:35:50 +02:00
Daniel Marjamäki 23efc68dd7 use nullptr 2014-02-16 10:32:10 +01:00
Daniel Marjamäki fd3a8a2a18 Update copyright 2014-02-15 07:45:39 +01:00
Daniel Marjamäki 5ba02d2fdd AST: Always use AST 2013-12-09 18:06:19 +01:00
Daniel Marjamäki b0ce42565e AST: Added experimental new implementations for CheckAssignIf::comparison, CheckOther::checkIncorrectLogicOperator and CheckOther::checkDuplicateExpression 2013-11-07 14:38:08 +01:00
Daniel Marjamäki fd26bad6fa AssignIf: Improved handling of function calls 2013-08-13 14:08:54 +02:00
Daniel Marjamäki 1bebf1fd7e AssignIf: added todo test case (pass variable by value to function) 2013-07-29 12:27:57 +02:00
Daniel Marjamäki 9c67af058a SymbolDatabase: Renamed Variable::varId() to Variable::declarationId() to make it more clear how it works. 2013-07-20 12:31:04 +02:00
Daniel Marjamäki e1dd14626c Fixed #4735 (FP: Mismatching assignment and comparison) 2013-04-23 06:47:15 +02:00
Daniel Marjamäki f43d732f33 Fixed #4691 (False positive: Mismatching bitmasks in switch()) 2013-04-07 04:25:10 +02:00
PKEuS f899e6ca30 Changed behaviour of %op% pattern accordingly to changes to Token::isOp(). Added %cop% as replacement for old %op% 2013-03-01 02:43:59 -08:00
Robert Reif 94c953931d Simplify checks by caching symbol database Variable pointer in Token 2013-01-31 20:08:48 +01:00
Daniel Marjamäki bfafd51ca1 Fixed #4470 (New check: redundant bitand 'x&=1; x&=2;' can be simplified to 'x=0;') 2013-01-21 19:59:34 +01:00
Reijo Tomperi 5d5f7085bf Updating year 2012 -> 2013 to .cpp and .h files and man page. 2013-01-01 18:29:08 +02:00
Daniel Marjamäki 2e0a9c4b33 Fixed #4434 (false positive: (style) Mismatching assignment and comparison, comparison 'pen!=-1' is always true.) 2012-12-27 15:40:00 +01:00
Edoardo Prezioso f6c23fa1e7 runastyle and fix checkInternal messages. 2012-12-01 03:17:55 +01:00
Daniel Marjamäki 7760a92930 CheckAssignIf: Better handling of various expressions in assignments 2012-11-29 10:19:52 +01:00
Daniel Marjamäki 4e1bef5535 AssignIf: better handling of function calls 2012-09-29 19:22:34 +02:00
Daniel Marjamäki 10aa667648 assignif: Fixed testcase. parse while loops if variable is local and not external. 2012-09-29 10:54:09 +02:00
Daniel Marjamäki b6153a00ee assign-if: Fixed token match 2012-09-29 10:41:34 +02:00
Daniel Marjamäki 12cfdee61b AssignIf: Check into scopes recursively 2012-09-29 10:33:54 +02:00
Daniel Marjamäki bb62325ddb AssignIf: Better handling of complex conditions with multiple subconditions 2012-09-28 17:03:16 +02:00
Daniel Marjamäki 9f7a0146d0 AssignIf: Detect mistake in such code: 'int x=y&4; if ((x==3)||..' 2012-09-26 20:15:46 +02:00
Daniel Marjamäki a9c1a052b9 CheckAssignIf: Improved checking for bitwise or 2012-09-14 19:13:44 +02:00
PKEuS 0f1cb4c98c Message refactorization: checkassignif.cpp, checkautovariables.cpp 2012-07-07 11:31:18 -07:00
PKEuS 9dc8123151 Refactorizations:
- Use const string references instead of const strings copies when possible
- Fixed cppcheck warning about postfix increment in CheckIO
- Use symbolDatabase to detect pointers in CheckOther::checkAssignBoolToPointer
2012-05-25 03:09:41 -07:00
Reijo Tomperi 8cae17fda8 Update year to 2012 2012-01-01 01:05:37 +02:00
PKEuS 9b685ba3c3 Code cleanup 2011-12-09 21:00:57 +01:00
Daniel Marjamäki c7e2a198cb Fixed Visual Studio compiler warnings 2011-12-01 18:32:14 +01:00
Edoardo Prezioso 42e369a4b4 Change every 'tokAt(..)->link()' to 'linkAt(..)'. 2011-11-20 14:24:27 +01:00
Daniel Marjamäki c025bf9d57 Fixed #3332 (mismatching comparison: Hard to understand) 2011-11-19 08:38:54 +01:00
Daniel Marjamäki 033fef36da improved error message 'mismatching comparison' 2011-11-18 20:07:42 +01:00
Daniel Marjamäki 6f8e42a5af changed the astyle formatting flags 2011-10-13 20:53:06 +02:00
Kimmo Varis 3cfe7ca1a7 Move "information" errors to "style" errors.
"information" severity is documented in lib/errorlogger.h as:

  Checking information.
  Information message about the checking (process) itself. These
  messages inform about header files not found etc issues that are
  not errors in the code but something user needs to know.

It IS NOT for errors in the code. All the current "information"-
severity errors fit nicely into description of the "style"-
severity.

We definitely need to separate processing information and actual
errors in the code. It is highly confusing for users to mix these
two different things. Hence all current "information" code error
messages are moved to "style" category.

Ticket: #3165 (Stop misusing the 'information' error severity!)
2011-10-05 20:44:00 +03:00
Daniel Marjamäki 72b01d1ca0 Improve check: Tweaked the assignAndCompare to handle | also in addition to & 2011-08-19 16:10:09 +02: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
Daniel Marjamäki 207038a087 AssignIf: detect more problems for 'if' and 'else if' conditions 2011-08-01 11:33:09 +02:00
Daniel Marjamäki 103542bb15 Fixed #2908 (common logic when using bitwise and) 2011-08-01 09:36:12 +02:00
Daniel Marjamäki 8e888a0dfb astyle formatting 2011-08-01 07:48:18 +02:00
Daniel Marjamäki 880e0e3b5f AssignIf: Improved the error message for mismatching comparison 2011-08-01 07:13:47 +02:00
Daniel Marjamäki afc825da68 AssignIf: handle parantheses. ticket: #2909 2011-07-31 17:09:53 +02:00
Daniel Marjamäki 00e28f5c4e AssignIf: Match lhs and rhs for comparisons. Ticket: #2909 2011-07-31 11:23:38 +02:00
Daniel Marjamäki e47aac2501 AssignIf: Detect problem for 'y=x&4; if(y!=3)..'. Ticket: #2909 2011-07-31 10:48:31 +02:00
Daniel Marjamäki 47f13860b7 AssignIf: Added new check. Ticket: #2909 2011-07-30 21:43:21 +02:00