Commit Graph

433 Commits

Author SHA1 Message Date
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 85b2bd21dc fix #2968 (new check: testing if unsigned variable is less than 0) 2011-08-06 19:23:09 -04:00
Moritz Lipp 8d68981119 Fixed #2793 (SIGABRT on filenames without file extension) 2011-07-31 18:35:28 +02:00
Robert Reif 2f4aee2923 fix missing else in patch that added support for unused const local variables 2011-07-30 07:16:59 -04:00
Robert Reif cb4282d69a use simpleMatch where possible in checkother.cpp 2011-07-29 22:37:05 -04:00
Daniel Marjamäki dc629b4c39 Fixed 'possible null pointer dereference' warning messages 2011-07-28 08:12:21 +02:00
Daniel Marjamäki d2c0e5e7e6 Fixed #2821 (New Check : bool pointer null truth assignment) 2011-07-28 07:28:24 +02:00
Robert Reif 9a4447c835 add support for unused const local variables 2011-07-24 12:09:59 -04:00
Simon Martin 539c2e5acb Fixed #2932 (segmentation fault of cppcheck ( i / i )) 2011-07-24 09:06:38 +02:00
Robert Reif c3c3eb74e8 fix #2929 (Additional Unused variable check) 2011-07-21 18:37:37 -04:00
Robert Reif ed30edf9d3 simplify CheckOther::checkIncorrectLogicOperator() by using more pattern matching 2011-07-18 07:34:49 -04:00
Robert Reif 76d0872c0d made #2827 fix more generic by adding more ops and using pattern matching rather than string matching 2011-07-17 16:28:00 -04:00
Robert Reif 4149617978 fix #2827 to use numeric comparisons 2011-07-16 23:05:35 -04:00
Robert Reif 430d22032d fix #2827 condition always false or true) 2011-07-16 22:06:23 -04:00
Zachary Blair 997a3652d2 Fixed #2822 (New check: Duplicate break statements in switch) 2011-07-14 17:12:56 -07:00
Robert Reif 270b2b1772 fix #2904 (Memory leak not detected when creating a new class instance) 2011-07-14 19:15:59 -04:00
Daniel Marjamäki 0007351ef4 spell check of error message. contant => constant 2011-07-05 19:59:58 +02:00
Daniel Marjamäki 8cd2c3115e Fixed #2866 (Detect sign extension bugs) 2011-07-05 18:41:27 +02:00
Greg Hewgill 657b003dc8 Fix spelling error in warning identifier 2011-07-05 19:54:23 +12: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 3225c9dd9b cleanup isStatic in CheckOther::functionVariableUsage() 2011-07-01 07:15:59 -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
seb777 e06b2419a4 fix #2786 (new check: Using sizeof with numeric constant)
Add unit test and improve check with negative constant because in cppcheck %num%
means 'integer'
2011-05-28 16:40:01 +08:00
seb777 287840e6bc fix #2786 2011-05-25 01:45:58 +08: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
Robert Reif 2db67863a7 #2700 (common logic or cut and paste errors) make duplicate branches inclnclusive 2011-05-08 13:22:42 -04: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
Zachary Blair 46645ab327 Fixed #2722 (new check: statement that is always true (strcmp)) 2011-04-25 22:45:27 -07:00
Daniel Marjamäki 46afc54c10 astyle formatting 2011-04-20 06:41:26 +02:00
Daniel Marjamäki 8417c4eb28 const parameter: Added comment to reduce false negatives for various classes in the std namespace 2011-04-20 05:40:06 +02:00
Daniel Marjamäki 68e7003bb1 Fixed #2734 (False positive: reports 'should be passed by reference' for std::streamoff) 2011-04-19 20:07:54 +02:00
Robert Reif c238b1bba6 fix #2730 (The same expression on both sides of != is OK when checking for NaN) 2011-04-18 19:20:27 -04:00
Robert Reif 56212370d1 add check for same expression on both sides of an operator (part of #2700) 2011-04-10 10:25:02 -04:00
Robert Reif 434783530a Merge branch 'master' of github.com:danmar/cppcheck 2011-04-10 09:57:34 -04:00
Robert Reif 4a50aca7b2 fix a bug in checkDuplicateBranch where removed type info like signed/unsigned was not checked for difference 2011-04-10 09:57:09 -04:00
Daniel Marjamäki e5d43d4ed2 Renamed Settings::stupid to Settings::experimental 2011-04-10 15:55:08 +02:00
Daniel Marjamäki 30ee9ba6e4 Added Settings::stupid flag that can be used to hide checking that generates false positives. 2011-04-10 13:23:45 +02:00
Daniel Marjamäki f284c3a11f CheckOther: Code cleanup. Use %oror% 2011-04-10 11:52:12 +02:00
Daniel Marjamäki ec5ddb16b4 CheckOther: Use %op% in CheckUnsignedDivision 2011-04-10 11:31:04 +02:00
Robert Reif 66de41b313 partial fix for #2700 (common logic or cut and paste errors) 2011-04-09 17:05:27 -04:00
Robert Reif d22fcb8184 fix bug in previous commit: fix #311 (add detection of duplicated if else-cases) 2011-04-09 16:34:16 -04:00
Robert Reif 7e403ae210 fix #311 (add detection of duplicated if else-cases) 2011-04-09 15:14:01 -04:00
Daniel Marjamäki 7d93bfb42e Refactoring: Use Token::isArithmeticalOp instead of hardcoded conditions 2011-04-09 18:50:05 +02:00
Daniel Marjamäki 8e711b7925 Refactoring: there was almost duplicate functions 'isOp'. Created a new Token::isOp function instead. 2011-04-08 19:40:22 +02:00
Daniel Marjamäki 4ac3c7fe3b clarify calculation: fixed false negative for 'int x = a - b ? 2 : 3' 2011-04-04 21:33:16 +02:00
Daniel Marjamäki 63acd9bb3e Clarify calculation: Added warnings for << and >> 2011-04-03 22:12:22 +02:00
Daniel Marjamäki 29422b8552 clarify precedence: made the short message shorter 2011-04-02 17:27:36 +02:00