Commit Graph

275 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 ac6d67dc4d add support for using global qualified :: memset on class and class member initialization 2011-08-04 20:37:27 -04:00
Robert Reif e687ee9a9a assume all std::*::size() and std::*::empty() are const in CheckClass::checkConstFunc() 2011-07-30 10:30:31 -04:00
Robert Reif c6a804d306 add std::*.empty() to possible const functions in CheckClass::checkConstFunc 2011-07-30 09:44:20 -04:00
Robert Reif 74c1bdde77 fix #1593 (false negative: the function can be declared as const) 2011-07-30 08:48:11 -04:00
Robert Reif ca2e8b057b fix #2947 (False positive: member variable is not initialized (a[x::y] = 0;)) 2011-07-27 12:03:44 -04:00
Robert Reif 6eecab5d73 fix #2807 (Wrong handling of function references when prefixed with &) 2011-06-29 07:19:34 -04:00
Robert Reif 0f6da27b9f fix #2795 (hash operator[] is not 'const') (original patch by Sebastien Debrard) (modified to use the symbol database) 2011-06-03 22:00:27 -04:00
Robert Reif 42316f3e0b fix #2792 (false positive: Member variable 'class::m_val' is not assigned a value in 'class::operator=') 2011-05-24 20:25:34 -04:00
Robert Reif 6abf29bd22 fix spelling of initialized in checkclass messages 2011-04-26 20:37:16 -04:00
Greg Hewgill 3fc1db51d1 Change symbol database such that the typestart token skips over type modifiers (const/static/mutable).
This fixes checking for the case of a memset() on a static variable.
2011-04-23 01:13:23 +12:00
Robert Reif 79e5d2db15 run astyle 2011-04-20 19:07:28 -04:00
Daniel Marjamäki 061eab4d22 Virtual destructors: Enabled the check again. I think it is conclusive now. Ticket: #2728 2011-04-20 18:03:16 +02: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
Robert Reif 77aebd357e Refactoring: add Token::isAssignmentOp and use it in CheckClass::checkConstFunc 2011-04-09 14:36:05 -04:00
Robert Reif a39444a40f change CheckClass::operatorEqToSelf to make better use of the symbol database 2011-03-31 19:53:35 -04:00
Robert Reif cf65a73c47 fix CheckClass::operatorEq to check return type more closely (to match check description) 2011-03-31 19:40:28 -04:00
Robert Reif dd5e15b40c output a debug message when a member variable is used that has a varid of 0 2011-03-27 14:27:14 -04:00
Robert Reif 1e1434e191 make member variable change detection simpler and more accurate for CheckClass::checkConst 2011-03-27 13:59:12 -04:00
Robert Reif c27ecf5aeb only break when we know we are inc/dec a member variable in CheckClass::checkConstFunc 2011-03-25 23:22:28 -04:00
Robert Reif 168db82fd6 better checking of assignment to array element in CheckClass::checkConstFunc 2011-03-25 23:02:13 -04:00
Robert Reif f8e1735b0f add support to CheckClass::checkConstFunc for ++/-- array elements 2011-03-25 22:37:32 -04:00
Robert Reif ca50bc7850 move 2 CheckClass helper functions to follow externally called functions so code matches comments 2011-03-25 22:21:40 -04:00
Robert Reif 61e720c82b fix #1288 (Use of memset on struct - nested structs not handled) 2011-03-23 21:58:58 -04:00
Robert Reif 14c07e988e fix pointer/reference check in CheckClass::noMemset symbol database conversion 2011-03-22 22:29:39 -04:00
Robert Reif 5314cc02b2 convert remainder of CheckClass::noMemset to use symbol database 2011-03-22 22:23:57 -04:00
Robert Reif 468a983db1 use the symbol database to look up base classes in CheckClass::noMemset check 2011-03-22 21:24:28 -04:00
Robert Reif d36ed9aff1 fix #2670 (False positive: function can be const, overloaded functions) 2011-03-22 19:23:36 -04:00
Robert Reif 2277cb6965 fix #2663 (False negative: function can be const (changing unknown or uninitialised variable)) 2011-03-20 13:29:52 -04:00
Greg Hewgill fa868e44ae Support use of 'this->' when checking operator=() return type 2011-03-15 20:19:30 +13:00
Robert Reif 27f4b8b88b Convert CheckClass::noMemset to use the symbol database to lookup types. This adds better support for namespaces and nested classes. 2011-03-12 22:41:21 -05:00
Robert Reif 79f0fe7d1c refactor symbol database and checks to use list of Scope rather than list of Scope pointers 2011-03-10 19:43:29 -05:00
Greg Hewgill 1ec6a642dc Revert "Check for memset on nested structs (ticket #1288)"
Turns out this fix is incomplete.

This reverts commit a084697410.
2011-03-10 20:19:31 +13:00
Greg Hewgill a084697410 Check for memset on nested structs (ticket #1288) 2011-03-09 23:02:49 +13:00
Greg Hewgill 3883afcbf4 Check for memset on objects with virtual functions (ticket #607) 2011-03-09 22:10:39 +13:00
Greg Hewgill 70b4076111 refactor noMemset so it recursively checks parent classes for non-memset-compatible things 2011-03-09 21:29:30 +13:00
Robert Reif 31a18b9b23 convert CheckClass::noMemset to use new variable lookup capability 2011-02-26 16:00:05 -05:00
Robert Reif f596a6959e code cleanup and add more tests to CheckClass::noMemset() 2011-02-24 19:59:50 -05:00
Chuck Larson db7ce1c13c memset: using memset on struct/class that has std::string member variable. ticket: #1655 2011-02-24 18:38:45 +01:00
Robert Reif ba6c2ca310 fix #2602 (segmentation fault of cppcheck ( class A {A& operator=(const A&); }; )) 2011-02-22 06:47:28 -05:00
Robert Reif 5984b6b53f fix #2595 (False positive Technically the member function 'A::foo' can be const) 2011-02-20 20:01:54 -05:00
Robert Reif 537ac0cb34 use func->start rather than searching for '{' in CheckClass::privateFunctions 2011-02-20 08:36:06 -05:00
Robert Reif 7dd8a3283a fix comment in CheckClass::initializeVarList 2011-02-19 20:09:07 -05:00
Robert Reif fef1142997 fix #2592 (False positive: 'operator=' should return reference to self) 2011-02-19 20:02:16 -05:00
Daniel Marjamäki 227a6100f7 astyle formatting 2011-02-11 19:31:37 +01:00
Robert Reif b8c5426bb8 fix #2567 Unused private function when implemented in different file 2011-02-11 08:00:41 -05:00
Raphael Geissert f8e2d50e6f Use Token::simpleMatch where no special patterns are needed 2011-02-02 13:27:02 -06:00
Raphael Geissert 8d5863133c Use Token::simpleMatch where no patterns are used 2011-02-02 13:27:01 -06:00
Raphael Geissert cf2b6f7bc1 Remove useless spacing at the end of *Match strings 2011-02-02 13:27:01 -06:00