Commit Graph

505 Commits

Author SHA1 Message Date
Daniel Marjamäki 7c47283e6d Fix testrunner 2018-12-04 17:17:07 +01:00
IOBYTE 2275f05f65 Fixed #8833 (false negative: No 'return' statement in non-void function causes undefined behavior.) (#1463) 2018-11-05 06:55:30 +01:00
IOBYTE 0a30768b59 Fixed #8693 (Template specialization: Constructor detected as normal … (#1418)
* Fixed #8693 (Template specialization: Constructor detected as normal function (functionStatic error))

Refactor template simplifier to remove the existing full specialization
function expandSpecialized and allow full specializations to use the
existing function expandTemplate.  The function expandTemplate was
modified to either expand the template like it originally did by copying
it or to modify the template in place.  Both instantiated and
uninstantiated full specializations are modified in place.  This also
fixes #8692 and probably other related tickets as well.

The function simplifyTemplates now tries twice to simplify templates so
more templates can be simplified.  We should try as many times as
necessary to find all possible templates.  We can't do that now because
uninstantiated templates are left unchanged.  It is relatively straight
forward to have the new code also expand in place uninstantiated
templates with their symbolic types but namespaces are not handled
properly (ticket #8671) and it would introduce regressions.

* Fix travis warnings.
2018-10-14 16:57:07 +02:00
Daniel Marjamäki a31db92918 Fixed #8669 (operator>> causes wrong style message) 2018-10-03 13:00:11 +02:00
rikardfalkeborn 5e120b567c isVariableDeclaration: Handle pointer to const pointer (#1395)
isVariableDeclaration did not handle pointer to const pointer, or
pointer to volatile pointer. This resulted in FPs in examples like the
following:

    class Fred {
        public:
        const char *const *data;
        const char *const *getData() { return data; };
    }

where cppcheck would say getData could be static, since it didn't
recognize const char *const *data as a variable declaration.
2018-09-25 06:19:26 +02:00
Daniel Marjamäki 738fb1b23a Disabled CheckClass::checkCopyCtorAndEqOperator because of FP (#8388) 2018-09-08 09:14:02 +02:00
Daniel Marjamäki 4d78a2e178 Fixed #7790 (Wrong order of <location> XML-elements for error duplInheritedMember) 2018-08-19 14:13:58 +02:00
Sylvain Joubert 13617375df missingOverride: False positive with cv-ref mismatch (#1340) 2018-08-17 08:42:22 +02:00
Daniel Marjamäki 78df7f98dd Fixed #8674 (False positive: Method that returns const should not be const) 2018-08-07 18:06:14 +02:00
Daniel Marjamäki 54e2726bf3 Fixed #8636 (Misleading verbose message if virtual method called from destructor) 2018-07-26 09:16:17 +02:00
Daniel Marjamäki 1abc9008d8 Fixed #8573 (FP noCopyConstructor - derive from noncopyable class) 2018-06-06 16:02:25 +02:00
IOBYTE 36f7585798 Fixed #8600 (false-positive/regression: confusion between copy constructors of internal classes and lack of explicit keyword) (#1266) 2018-05-27 10:53:34 +02:00
IOBYTE ce50df8047 Fix override warnings. (#1234) 2018-05-15 16:37:40 +02:00
Daniel Marjamäki f7746e4fb6 Revert "Missing override specifier warning on a pure virtual function makes no sense. (#1230)"
This reverts commit 348eb1c5c9.
2018-05-15 10:48:34 +02:00
IOBYTE 348eb1c5c9 Missing override specifier warning on a pure virtual function makes no sense. (#1230)
This fixes a large number of false positives for cppcheck source code.
2018-05-14 23:08:40 +02:00
Daniel Marjamäki 64b85b474c Fixed #8542 (False positive: noOperatorEq) 2018-05-05 07:46:58 +02:00
Daniel Marjamäki 7fb28b05f6 Check Class: Try to clarify the warnings for noCopyConstructor/noOperatorEq/noDestructor. 2018-05-04 15:39:23 +02:00
Daniel Marjamäki 99003c2084 CheckClass: Better handling of defaulted and deleted functions in the noCopyConstructor/noOperatorEq/noDestructor 2018-05-04 14:58:38 +02:00
Daniel Marjamäki 40b6f6b3dd CheckClass: Fix the noDestructor warning 2018-05-01 15:31:13 +02:00
Daniel Marjamäki 9710e819be CheckClass: Disable noDestructor for now, we need to handle new better 2018-05-01 09:26:03 +02:00
Daniel Marjamäki 42100fdf11 CheckClass: Better handling of non-copyable classes in the noCopyConstructor check 2018-05-01 08:33:23 +02:00
Daniel Marjamäki 73b41455dd CheckClass: If class has memory management it should have copy constructor, operator= and destructor 2018-04-30 23:13:33 +02:00
Daniel Marjamäki 1a9e8c158d CheckClass::copyconstructors: Use library to determine if function is a allocation function 2018-04-27 23:20:04 +02:00
Daniel Marjamäki 25599a76a7 Handle 'final' specifier better. 2018-04-27 14:57:43 +02:00
Daniel Marjamäki b830f462e6 Added missingOverride checker; Function 'f' overrides function in base class but does not have the 'override' keyword. 2018-04-27 11:12:09 +02:00
Daniel Marjamäki deaafd59d7 CheckClass: Undo the rule of 3 checker to avoid some warnings 2018-04-24 22:42:25 +02:00
Daniel Marjamäki 485d3e0229 CheckClass: Tweak rule of 3 checker 2018-04-24 21:45:30 +02:00
Daniel Marjamäki 6fb25dcaa4 CheckClass: Changed checker for 'copy constructor' and 'operator=' to a 'rule of 3' checker 2018-04-24 16:07:58 +02:00
Daniel Marjamäki 0d434efc15 virtualCallInConstructor: Clarify warning message 2018-04-04 13:04:40 +02:00
Daniel Marjamäki b3b364b42f virtualCallInConstructor: Updated warning message 2018-04-04 12:52:58 +02:00
IOBYTE fa968d75bd Partial fix for #8291: (False positive uninitMemberVar when calling delegated constructor) (#1142) 2018-04-04 08:29:12 +02:00
Daniel Marjamäki ee22a325c7 virtual function call in constructor: don't warn about explicit scoped call 2018-04-03 14:02:59 +02:00
IOBYTE 2a418fa0f5 Fixed #8466 (False Positive: Member variable is not initialized in the constructor. When using overloaded constructors) (#1141) 2018-04-02 18:32:45 +02:00
Daniel Marjamäki 1046ca2120 Improve check: Warn about virtual function calls in constructor/destructor 2018-04-02 15:31:47 +02:00
Simon Martin b4f32206af Ticket #8337: Fix false positive in copy constructor detection. (#1040) 2018-01-20 14:46:09 +01:00
Daniel Marjamäki c4caee6b18 Updated copyright year 2018-01-14 15:37:52 +01:00
PKEuS b684e1f202 Updated AStyle to version 3.0.1 2018-01-08 20:20:33 +01:00
Daniel Marjamäki 91839c2534 Fixed #7987 (FP copyCtorAndEqOperator - class with a move constructor and move assignment operator) 2017-12-23 10:35:14 +01:00
Daniel Marjamäki 4cb3548e2b unsafeClassDivZero: change severity to style 2017-10-21 21:51:58 +02:00
Daniel Marjamäki 5de3c43209 changed id for new checker to unsafeClassDivZero 2017-10-21 21:45:04 +02:00
Daniel Marjamäki 15d814e609 classPublicInterfaceDivZero: Try to make the error message a bit better. Added variable name and what the bad input value is. 2017-10-21 13:00:52 +02:00
Daniel Marjamäki 299835da2f classPublicInterfaceDivZero: don't warn in overloaded operators. It is normal behaviour that these are not protected. 2017-10-21 08:56:23 +02:00
Daniel Marjamäki 8a7411abdb CheckClass: Fix wrong 'public interface' warnings 2017-10-20 22:10:55 +02:00
Daniel Marjamäki 86c84029e3 New check: Check public interface of classes (#8248) 2017-10-20 02:02:51 +02:00
Dmitry-Me 6cfcf8610d Improve coverage for operator= return type detection.
This adds a testcase with parameter being a reference to non-const.
2017-09-14 00:12:10 +03:00
Robert Reif f5044bb65f Fixed #8142 (false positive: The class 'B' has 'copy constructor' but lack of 'operator='.)
Do not count static member variables when trying to figure out if
'operator =' is needed.
2017-08-01 19:52:41 -04:00
Ayaz Salikhov 3cd2f2d092 Don't cast bool to bool 2017-06-01 01:49:40 +03:00
Ayaz Salikhov 28aa939d69 iwyu - include what you use 2017-05-27 04:33:47 +02:00
Alexander Alekseev abba762d42 New check: checking for copy ctor and eq operator co-existence 2017-03-24 12:00:20 +01:00
PKEuS 996501a449 Fixed false positive #7953: Support type conversion operators returning pointers 2017-03-23 18:12:46 +01:00