Commit Graph

697 Commits

Author SHA1 Message Date
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
Daniel Marjamäki 1dd647ae84 Refactoring; Use range for loop 2018-07-14 07:49:04 +02:00
Daniel Marjamäki d759015d99 Refactoring; Use range for loops 2018-07-13 23:51:22 +02:00
Daniel Marjamäki 594e07acaa Refactoring; Use range for loop 2018-07-13 23:45:34 +02:00
Daniel Marjamäki 58ac8a9982 Refactoring; Use range for loops 2018-07-13 23:43:03 +02:00
Daniel Marjamäki ed76f06ca7 Refactoring; use range for loop 2018-07-13 23:32:49 +02:00
Daniel Marjamäki b2403c36cd Refactoring; Use Token::isUnaryOp() to clarify code 2018-07-13 23:17:24 +02:00
Daniel Marjamäki 60ac463a79 CheckClass: Restore a few warnings about member initialization of classes 2018-06-29 22:54:12 +02:00
Daniel Marjamäki 61c56eda44 Tweak the CheckClass::constructors() check 2018-06-27 14:02:57 +02:00
Daniel Marjamäki 79664abf2a Refactoring: Use range for loop 2018-06-27 09:14:03 +02:00
Daniel Marjamäki 3155f15325 CheckClass: Use Variable::valueType() 2018-06-24 16:14:11 +02:00
Daniel Marjamäki 9fab15bb53 CheckClass: Use Variable::valueType() instead of Variable::typeStartToken 2018-06-24 15:41:16 +02:00
Daniel Marjamäki e90c04cff9 Rename private member variable 2018-06-17 18:43:54 +02:00
Daniel Marjamäki 79ffe1d4fc Rename _tokenizer, _settings, _errorLogger 2018-06-16 16:10:28 +02:00
Daniel Marjamäki 45379a3aa6 Updated copyright year for modified files
[ci skip]
2018-06-10 22:07:21 +02:00
Daniel Marjamäki 3029606342 CheckClass: Fix Cppcheck warning about mismatching function parameters 2018-06-10 22:04:22 +02:00
Daniel Marjamäki 1abc9008d8 Fixed #8573 (FP noCopyConstructor - derive from noncopyable class) 2018-06-06 16:02:25 +02:00
orbitcowboy 33777c5b72 Improved const correcntess of local variables. 2018-05-29 13:24:48 +02:00