IOBYTE
1874b9cb0f
fix crash in CheckClass::getFileInfo ( #3172 )
...
* fix crash in CheckClass::getFileInfo
* fix another crash
* fix memory leak
Co-authored-by: Robert Reif <reif@FX6840>
2021-03-19 09:19:48 +01:00
PKEuS
141d2ac215
Refactorization: Improved internal implementation of severity and certainty levels
...
Backported from LCppC.
2021-02-24 22:00:06 +01:00
IOBYTE
75e439e56d
fix crash in checkclass from unknown template valueType ( #3129 )
2021-02-13 13:41:12 +01:00
Daniel Marjamäki
c2c40a18fd
One definition rule; avoid false positives when location is same
2021-02-10 11:44:05 +01:00
Daniel Marjamäki
fbf63b932e
astyle formatting
...
[ci skip]
2021-02-10 11:42:00 +01:00
Daniel Marjamäki
0fa225ecb5
Fix Cppcheck warning; useStlAlgorithm
2021-02-09 21:47:56 +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
205af353db
CheckClass: Fix endless recursion
2021-02-03 19:13:49 +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
Daniel Marjamäki
dc63dd6ada
Fix Cppcheck self check warnings
2021-02-01 19:31:30 +01:00
Daniel Marjamäki
986f658e39
Fixed #10161 (False negative; uninitialized member variable in base class without constructor)
2021-02-01 18:58:51 +01:00
Daniel Marjamäki
bd9e6212b2
Refactoring, avoid 'magic' connection between vector items and variables
2021-02-01 17:13:58 +01:00
Ken-Patrick Lehrmann
96ea5a432f
Fix crash in checkclass.cpp ( #3104 )
2021-01-31 12:14:10 +01:00
IOBYTE
fde5994cc3
fix #10061 (debug: Executable scope 'x' with unknown function.) ( #3062 )
2021-01-18 19:01:04 +01:00
Oliver Stöneberg
ac7647fcd8
some self-check suppression cleanups ( #3032 )
2021-01-09 20:32:38 +01:00
Oliver Stöneberg
20e462a8ed
split "varid0" from more generic "debug" messages ( #2997 )
2020-12-31 19:24:16 +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
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 #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
687b44dbb7
Token: add flag for splitted variable declaration with initialization
2020-09-09 16:22:47 +02:00
Daniel Marjamäki
30d3643bb8
Fixed #9851 (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 #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
Oliver Stöneberg
4f68d85633
optimized non-matchcompiled Token::simpleMatch() a bit ( #2640 )
2020-05-26 20:13:56 +02:00
Oliver Stöneberg
37bc0483a4
made check.h less heavy ( #2633 )
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 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
Oliver Stöneberg
2c1e36e63e
cleaned up includes based on include-what-you-use ( #2600 )
...
* 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 #9221 (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 ( #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
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 ( #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
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 " #9391 Detecting uninited member variables with default ctor ( #2249 )"
...
This reverts commit 08bc369296
.
2019-10-09 08:17:47 +02:00
blacktea
08bc369296
#9391 Detecting uninited member variables with default ctor ( #2249 )
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 ( #2181 )
...
* 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 717aa826d8
( #2130 )
...
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 ( #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
ed7edc6d2a
Improve warning message
2019-08-13 20:42:25 +02:00
Daniel Marjamäki
41f8c1b281
Fixed #9271 (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) ( #2057 )
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] ( #1978 )
2019-07-11 08:25:25 +02:00
Rikard Falkeborn
839fcddd8a
Fix #6115 (Add support to realloc to cfg files) ( #1953 )
...
* 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 9765a2dfab
. 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 ( #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
Daniel Marjamäki
c98ceb6e14
Tweak bailout so it's only used in unused template classes
2019-06-20 14:00:44 +02:00
Daniel Marjamäki
cf79830afd
Revert "Remove bailout. It hides lots of warnings for real code to avoid FP in unused templates."
...
This reverts commit 2a4be5ae1c
.
When I look at daca@home now there are still lots of false negatives. So this bailout did not cause as much false negatives as I thought.
2019-06-19 22:29:00 +02:00
Daniel Marjamäki
2a4be5ae1c
Remove bailout. It hides lots of warnings for real code to avoid FP in unused templates.
2019-06-16 19:01:45 +02:00
Daniel Marjamäki
29e5992e51
Fixed #9045 (FP operatorEqRetRefThis - recent regression)
2019-05-20 21:30:20 +02:00
Paul Fultz II
cf3515ee61
Fix issue 7372: False positive uninitMemberVar - on template specialization
...
This fixes the issue by skipping diagnostics when the symbols are incomplete in the constructor.
2019-05-17 20:24:41 +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
Daniel Marjamäki
14a312e310
useInitializationList: Skip warning when rhs is a multi line lambda. For readability it might be better to have assignments in constructor in this case.
2019-02-05 19:53:10 +01:00
Daniel Marjamäki
4457faa26b
Fixed #8850 (Array in-class initialization for private member considered uninitialized)
2019-02-02 18:34:41 +01:00
Daniel Marjamäki
9d8f798aca
Fixed #8951 (false postive: (style) The class 'x' does not have a constructor although it has private member variables.)
2019-02-02 18:25:26 +01:00
Lauri Nurmi
3bbd9fc9a4
Replace "virtual method" with "virtual function" in messages.
...
The term "method" is not really a part of C++ terminology.
2019-01-15 06:22:14 +01:00
Lauri Nurmi
f267900257
Fix spelling of "overridden" in function names.
...
One 'd' was missing.
2019-01-15 06:22:14 +01:00
Daniel Marjamäki
43035ff186
Remove inline suppression. The Cppcheck warning was a true positive.
2019-01-13 08:42:48 +01:00
Daniel Marjamäki
e6edd74099
Temporarily suppress Cppcheck false positives
2019-01-12 19:11:44 +01:00
Daniel Marjamäki
8509159d1a
Uninitialized Member variable: Fixed FP when delegate constructor is used
2019-01-10 20:13:37 +01:00
Daniel Marjamäki
e4525d56a0
Fixed #8111 (performance warning - member variable at constructor)
2019-01-07 21:26:58 +01:00
Daniel Marjamäki
7ef8f60b07
Fixed #8817 (Change wording in performance/functionStatic)
2018-12-03 18:30:54 +01:00
Daniel Marjamäki
2b09354b05
Refactoring; use visitAstNodes
2018-11-23 20:33:31 +01:00
rikardfalkeborn
a3e717bea9
Use functions instead of comparing with enum ( #1471 )
...
* Use isComparisonOp() instead of enum
* Use isAssignmentOp() instead of enum
2018-11-09 06:30:41 +01:00
IOBYTE
c966f31183
Fixed #8835 (friend class and non-empty constructor: Uninitialized members not reported) ( #1466 )
2018-11-06 06:44:08 +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
Daniel Marjamäki
a31db92918
Fixed #8669 (operator>> causes wrong style message)
2018-10-03 13:00:11 +02:00
Daniel Marjamäki
de621eab99
Refactoring; use range for loop
2018-10-03 12:54:59 +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
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
4429ee55c3
Refactoring; Use range for loop
2018-07-14 07:55:18 +02:00