745 Commits

Author SHA1 Message Date
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 () 2020-12-21 07:14:52 +01:00
Daniel Marjamäki
40963100c4 Avoid functionStatic FP when there is #ifdef in function 2020-12-04 20:29:10 +01:00
Daniel Marjamäki
d383913e1b Attempt to fix crashes when variable valueType is nullptr. This can happen when decltype is used on unknown type 2020-11-27 16:49:25 +01:00
vilarion
bc5ec38149
Fix (False positive: template function can be static) ()
* 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 (False positive: Delegating constructor and initialization list) 2020-09-09 18:04:21 +02:00
Daniel Marjamäki
687b44dbb7 Token: add flag for splitted variable declaration with initialization 2020-09-09 16:22:47 +02:00
Daniel Marjamäki
30d3643bb8 Fixed (FP virtualDestructor - private virtual dtor) 2020-09-04 18:56:12 +02:00
Daniel Marjamäki
d5b64d9c3a Clarify inconclusive uninitMemberVar warning in copy constructors, it's in general a good idea to copy all the data. 2020-08-05 13:57:40 +02:00
Daniel Marjamäki
b4552dedb0 Fix Cppcheck warning 2020-07-24 19:58:36 +02:00
Daniel Marjamäki
6a839ad511 Fixed (False positive: functionConst, trailing return type) 2020-07-24 19:40:42 +02:00
Daniel Marjamäki
a49d277e0d Fixed (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
Oliver Stöneberg
4f68d85633
optimized non-matchcompiled Token::simpleMatch() a bit () 2020-05-26 20:13:56 +02:00
Oliver Stöneberg
37bc0483a4
made check.h less heavy () 2020-05-23 07:16:49 +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 6eec6c4bd53d42e3a1179fd3a8a7dae5a43d4d50.
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 ()
* 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 (False positive: use this after free (lambda not executed directly)) 2020-04-17 20:20:45 +02:00
Oliver Stöneberg
2c1e36e63e
cleaned up includes based on include-what-you-use ()
* cleaned up includes based on include-what-you-use

* check.h: trying to work around Visual Studio 2012 bug

* fixed Visual Studio compilation
2020-04-13 13:44:48 +02:00
Daniel Marjamäki
32bf53eeda Fixed (False positive when using an array of lists) 2020-04-10 14:01:15 +02:00
Daniel Marjamäki
eff225a09c Use 'static' instead of unnamed namespace for variables 2020-04-10 13:48:38 +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 () 2020-01-09 06:53:08 +01:00
Maksim Derbasov
a3ed9116e5 Clarify error msg for hidingInheritedPublic () 2020-01-05 09:32:39 +01:00
orbitcowboy
1e0f8ae9b4 Running astyle [ci skip]. 2020-01-04 00:06:27 +01:00
Maksim Derbasov
fc5fd3c40c Check that virtual function non-narrow access modifier in derived class ()
* 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
1a2b770bfd Break the loop once a match is found 2019-12-31 18:32:45 +03:00
Daniel Marjamäki
eaa5bfcadd Remove 'unsafeClassDivZero' warning. The software verification will cover this better. 2019-11-10 16:49:34 +01:00
Dmitry-Me
f2cf71f6e9 Fix typo 2019-11-01 18:39:53 +03:00
Daniel Marjamäki
c04e25e936 Revert " Detecting uninited member variables with default ctor ()"
This reverts commit 08bc369296f838adddbeceb3f3eb4b24f987ca96.
2019-10-09 08:17:47 +02:00
blacktea
08bc369296 Detecting uninited member variables with default ctor () 2019-10-08 19:33:07 +02: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
Oliver Stöneberg
de9f489b08 use range loops / constness ()
* use range loops / constness

* platform.cpp: avoid shadowed variable
2019-09-19 20:29:33 +02:00
Ken-Patrick
d918f76a0d Remove useless check introduced by 717aa826d8c98dab533b7c2166eb412b1422b14d ()
I was confused by the naming in the forum entry (this/that). This would
be a pointer, there's no point checking for it there.
2019-09-01 09:53:45 +02:00
Ken-Patrick
717aa826d8 Fix false positive in initializationListUsage ()
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
ed7edc6d2a Improve warning message 2019-08-13 20:42:25 +02:00
Daniel Marjamäki
41f8c1b281 Fixed (Safe classes: Class that store references) 2019-08-13 20:40:48 +02:00
amai2012
f02636e995 Refactoring: Convert enums to enum classes 2019-08-02 21:14:29 +02:00
Rikard Falkeborn
f6726b76ae Fix 9215 (add tilde for missing destructor override warning) () 2019-08-01 10:43:45 +02:00
Daniel Marjamäki
4fb6c27276 Modernize: Use enum class 2019-07-23 14:29:02 +02:00
Daniel Marjamäki
2afd5f5dd0 Modernize: Use enum class 2019-07-17 10:39:06 +02:00
Daniel Marjamäki
3637c486c4 Replace 'unsigned' with 'nonneg' in checkclass 2019-07-16 09:03:45 +02:00
IOBYTE
9700490e51 fix lib/checkclass.cpp:51:12: warning: enumeration value ‘eLambda’ not handled in switch [-Wswitch] () 2019-07-11 08:25:25 +02:00
Rikard Falkeborn
839fcddd8a Fix (Add support to realloc to cfg files) ()
* Allow to configure realloc like functions

* memleakonrealloc: Bring back tests.

The old memleak checker was removed, and the tests for it was removed in
commit 9765a2dfab4f59102507fe759ef2184b5ed41c9f. This also removed the
tests for memleakOnRealloc. Bring back those tests, somewhat modified
since the checker no longer checks for memory leaks.

* Add realloc to mem leak check

* Add tests of realloc buffer size

* Configure realloc functions

* Add test of freopen

* Allow to configure which element is realloc argument

* Fix wrong close in test

cppcheck now warns for this

* Update manual

* Update docs

* Rename alloc/dalloc/realloc functions

Naming the member function realloc caused problems on appveyor. Rename
the alloc and dealloc functions as well for consistency.

* Change comparisson order

* Remove variable and use function call directly

* Create temporary variable to simplify

* Throw mismatchError on mismatching allocation/reallocation

* Refactor to separate function

* Fix potential nullptr dereference

As pointed out by cppcheck.
2019-07-05 12:44:52 +02:00
shaneasd
7e54f989f9 Update symbol database such that the override keyword implies that the function is also virtual ()
* 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