Commit Graph

561 Commits

Author SHA1 Message Date
PKEuS 141d2ac215 Refactorization: Improved internal implementation of severity and certainty levels
Backported from LCppC.
2021-02-24 22:00:06 +01:00
PKEuS cf1937294a Refactorization: Removed unnecessary \n and spaces in strings
Merged from LCppC.
2021-02-20 12:58:42 +01:00
IOBYTE 8547ff8cc2
fix some hangs in daca from uninstantiated template classes derived f… (#3133)
* fix some hangs in daca from uninstantiated template classes derived from itself

* remove assertions

* fix another simplifyUsing hang

Co-authored-by: Robert Reif <reif@FX6840>
2021-02-17 18:12:49 +01:00
Daniel Marjamäki ef726aaece New check: Detect one definition rule violations 2021-02-09 21:35:08 +01:00
IOBYTE da3eb2e411
fix #10169 (CheckClass::checkDuplInheritedMembersRecursive) (#3114)
Co-authored-by: Robert Reif <reif@FX6840>
2021-02-05 11:05:07 +01:00
Daniel Marjamäki 0338e99f84 CheckClass: Refactoring 2021-02-03 19:25:28 +01:00
Daniel Marjamäki c0731703af astyle formatting
[ci skip]
2021-02-02 15:01:28 +01:00
alonlib12 a22e476162
Fix CheckClass::operatorEqToSelf (#3088) 2021-02-02 15:00:46 +01:00
IOBYTE fde5994cc3
fix #10061 (debug: Executable scope 'x' with unknown function.) (#3062) 2021-01-18 19:01:04 +01:00
Daniel Marjamäki 13ed2effa1 astyle formatting
[ci skip]
2020-12-22 08:09:51 +01:00
abhijit-sawant 7d6fc23022
Checking in fix for issue 9957 - - False negative: duplInheritedMember (#2964) 2020-12-21 07:14:52 +01:00
vilarion bc5ec38149
Fix #9806 (False positive: template function can be static) (#2868)
* Include detecting variadic template functions by matching against endTok instead of startTok.
* Add argument count check for variadic (template) member functions.
2020-10-31 10:02:15 +01:00
Daniel Marjamäki f95a53b0ca Fixed #9821 (False positive: Delegating constructor and initialization list) 2020-09-09 18:04:21 +02:00
Daniel Marjamäki 30d3643bb8 Fixed #9851 (FP virtualDestructor - private virtual dtor) 2020-09-04 18:56:12 +02:00
Daniel Friedrich 160b8f0f17 Add test case to reproduce bug
Add tokenizer test range based for with decltyle(x) *
2020-08-17 20:51:45 +02:00
Daniel Marjamäki 6a839ad511 Fixed #9814 (False positive: functionConst, trailing return type) 2020-07-24 19:40:42 +02:00
Daniel Marjamäki a49d277e0d Fixed #6471 (FP functionConst - member function modifying member variable after cast (inconclusive)) 2020-06-29 13:09:01 +02:00
Daniel Marjamäki 3f8218af1b Removed CheckClass::operatorEq: does not 'belong' 2020-06-17 20:35:43 +02:00
orbitcowboy 9861a5291e Formatted the code, there are no functional changes [ci skip] 2020-05-20 23:45:00 +02:00
PKEuS fb1afe2345 Fixed test suite: Do no longer apply simplifyTokenList2 to token lists, except for those tests that test those simplifications, because checks are no longer run on that simplified token list
Changed failing unit test to TODO tests, as they indicate patterns we do no longer understand properly.
2020-05-20 18:54:16 +02:00
Daniel Marjamäki 08ddd84780 Update copyright year 2020-05-10 11:16:32 +02:00
Daniel Marjamäki 3e0218299b Revert "Update copyright year"
This reverts commit 6eec6c4bd5.
2020-05-10 11:13:05 +02:00
Daniel Marjamäki 6eec6c4bd5 Update copyright year 2020-05-10 11:11:34 +02:00
Daniel Marjamäki 2e369cc842 astyle formatting
[ci skip]
2020-04-27 17:35:52 +02:00
Lionel Gimbert ad6be7b122
Enforcing CppCoreGuideline C.35 on virtual class destructor (#2572)
* Enforcing CppCoreGuideline C.35
A base class destructor should be either public and virtual, or protected and non-virtual

https://github.com/isocpp/CppCoreGuidelines/blob/master/CppCoreGuidelines.md#Rc-dtor-virtual

* Protected destructor of ciurtual class can be virtual
2020-04-27 09:22:42 +02:00
Daniel Marjamäki aa1bbf2e62 Fixed #9679 (False positive: use this after free (lambda not executed directly)) 2020-04-17 20:20:45 +02:00
Daniel Marjamäki afb5590741 New check: delete 'self pointer' that might be used as 'this' and then use some member/method 2020-02-18 18:24:18 +01:00
Daniel Marjamäki 332279326f checkVirtualFunctionCallInConstructor; Check should be 'style' since there is no UB. Disabled the check temporarily, it should use CTU to determine if the class is a base class 2020-02-14 17:10:12 +01:00
Maksim Derbasov 872d531568 Removing check hidingInheritedPublic (#2482) 2020-01-09 06:53:08 +01:00
Maksim Derbasov a3ed9116e5 Clarify error msg for hidingInheritedPublic (#2474) 2020-01-05 09:32:39 +01:00
Maksim Derbasov fc5fd3c40c Check that virtual function non-narrow access modifier in derived class (#2229)
* Check that virtual function has not narrowed access in derived class

* motivation info added

* error reporting moved to func

* added suppression for CI
2020-01-01 16:09:43 +01:00
Dmitry-Me 7da68bff7b Improve test coverage for missing destructors 2019-12-05 18:25:50 +03:00
Daniel Marjamäki eaa5bfcadd Remove 'unsafeClassDivZero' warning. The software verification will cover this better. 2019-11-10 16:49:34 +01:00
Daniel Marjamäki c7a23f126f Fixed #9373 (False Positive - missingOverride) 2019-11-03 18:42:04 +01:00
Daniel Marjamäki 7f64faae99 Virtual Destructors: Base class must have virtual destructor no matter if derived class has a destructor or not. There is UB according to paragraph 3 in [expr.delete]. 2019-09-27 09:55:56 +02:00
Daniel Marjamäki 7d63bdee6f astyle formatting
[ci skip]
2019-09-02 06:59:07 +02:00
Ken-Patrick 717aa826d8 Fix false positive in initializationListUsage (#2128)
https://sourceforge.net/p/cppcheck/discussion/general/thread/d5b690ef19/
Check that we warn only about using the initializer list when we assign
the object being constructed.
2019-08-31 12:27:07 +02:00
Daniel Marjamäki d4549217d0 Renamed safeClassRefMember => unsafeClassRefMember 2019-08-13 20:58:31 +02:00
Daniel Marjamäki 41f8c1b281 Fixed #9271 (Safe classes: Class that store references) 2019-08-13 20:40:48 +02:00
Rikard Falkeborn f6726b76ae Fix 9215 (add tilde for missing destructor override warning) (#2057) 2019-08-01 10:43:45 +02:00
shaneasd 7e54f989f9 Update symbol database such that the override keyword implies that the function is also virtual (#1907)
* Update symbol database such that the override keyword implies that the function is also virtual

* Add test case for implicit override

* change isVirtual to hasVirtualSpecifier

* fix method documentation for getVirtualFunctionCalls and getFirstVirtualFunctionCallStack

* Fix isImplicitlyVirtual to consider the override keyword and document logic

* Fix getFirstVirtualFunctionCallStack and getVirtualFunctionCalls to use isImplicitlyVirtual instead of isVirtual so new test case passes
2019-07-04 12:32:32 +02:00
IOBYTE 5642778206 Fixed #9193 (functionStatic false positive (inconclusive)) (#1943) 2019-07-02 11:40:57 +02:00
Scott Furry a195477470 Correct Zero/Null as pointer constant (#1938)
Building with enhanced clang warnings indicated a large number of
instances with the warning:

`warning: zero as null pointer constant`

Recommended practice in C++11 is to use `nullptr` as value for
a NULL or empty pointer value. All instances where this warning
was encountered were corrected in this commit.

Where warning was encountered in dependency code (i.e. external library)
no chnages were made. Patching will be offered upstream.
2019-06-30 21:39:22 +02:00
Daniel Marjamäki 29e5992e51 Fixed #9045 (FP operatorEqRetRefThis - recent regression) 2019-05-20 21:30:20 +02:00
Daniel Marjamäki 2513c1499b Library: Added <smart-pointer> element 2019-04-24 13:06:58 +02:00
Nicodemes 272760f9ca Fix explicit constructor with default arguments check bug
Before this fix, the code:
```
class A {
    A(int, int x=3){
        x;
    }
};
```
Was considered OK.
But explicit keyword is still needed

I'm still new to open-source contributions, so I will gladly take advice.
2019-04-23 10:46:22 +02:00
Daniel Marjamäki 761f18c75c Fixed #8988 (False positive: using memset on struct) 2019-04-01 19:32:03 +02:00
Daniel Marjamäki ad37664e86 Changed severities 2019-03-06 19:00:58 +01:00
Daniel Marjamäki bd7790fd8c Update copyright year 2019-02-09 07:24:06 +01:00
rikardfalkeborn aa730f45c6 Add regression test for #7714 (#1648)
Ticket #7714 was fixed in ea215c3b7b.
Add a regression test to make sure it stays fixed.
2019-02-07 08:49:55 +01:00