Commit Graph

889 Commits

Author SHA1 Message Date
Daniel Marjamäki 464fbe8d53 Update copyright year 2023-01-28 10:16:34 +01:00
chrchr-github b5a06d045e
Fix debug: CheckClass::isMemberVar found used member variable 'x' with varid 0 (inconclusive) () 2023-01-26 22:19:51 +01:00
chrchr-github 6e2cc450b8
Fix FN functionConst with access of smart pointer ()
* Fix  FNfunctionConst with access of smart pointer

* Simplify
2023-01-16 22:07:04 +01:00
Oliver Stöneberg 1cfe49e340
use `const_iterator` where possible () 2022-12-30 15:13:47 +01:00
Oliver Stöneberg 3c68b9b29f
use `cbegin()` and `cend()` with `const_ierator` loops () 2022-12-20 20:32:16 +01:00
Oliver Stöneberg 6fedbb4f77
add/preserve `const` in `dynamic_cast` () 2022-12-19 20:01:12 +01:00
chrchr-github e3939d32d0
Fix crash on nullptr ()
* Update tokenlist.cpp

* Update testincompletestatement.cpp

* Fix  FP constStatement with lambda

* Format

* Fix crash on nullptr

* Emit syntax error

* Fix test

* Use strAt()

* Fix another crash on nullptr

* Update testconstructors.cpp

* Fix crash on nullptr

* Fix test
2022-11-13 23:04:51 +01:00
chrchr-github 701d381895
Fix FP selfAssignment: lambda capture / FP operatorEqRetRefThis ()
* Fix   FP selfAssignment: lambda capture /  
FP operatorEqRetRefThis

* Format
2022-11-13 21:20:44 +01:00
chrchr-github 4e75c08f58
Respect [[maybe_unused]] in unusedPrivateFunction () 2022-11-10 20:58:39 +01:00
chrchr-github ffc0c57562
Fix crashes on nullptr () 2022-11-09 21:56:16 +01:00
gerboengels d7a8f7f297
Fix couple issues with missing operatorEqVarError () 2022-11-05 10:48:34 +01:00
chrchr-github 3273e51fd5
Fix FN useStlAlgorithm with iterators () 2022-10-16 13:46:26 +02:00
Oliver Stöneberg ee124cd097
modernized `erase()` calls () 2022-10-02 07:13:31 +02:00
Oliver Stöneberg cff1cd9cda
applied clang-tidy `misc-const-correctness` fixes for POD types, iterators and references ()
* applied `misc-const-correctness` fixes for POD types and iterators

* applied `misc-const-correctness` fixes for references
2022-10-02 07:12:40 +02:00
chrchr-github d608bec414
Fix FP with std::array ()
* Fix  wrong usage of std::string in memcpy

* Fix memsetClass FP

* Fix  FN memset on container containing structs with containers

* Token::Match

* Use AST

* simpleMatch

* Fix FP with std::array

* simpleMatch
2022-09-23 20:18:49 +02:00
chrchr-github 0bb82b70d9
Fix FN functionStatic, functionConst with this ()
* Fix  FN functionStatic, functionConst with this

* Fix FP
2022-09-23 08:46:31 +02:00
chrchr-github 2aca275e0c
Fix FN memset on container containing structs with containers ()
* Fix  wrong usage of std::string in memcpy

* Fix memsetClass FP

* Fix  FN memset on container containing structs with containers

* Token::Match

* Use AST

* simpleMatch
2022-09-21 17:33:48 +02:00
chrchr-github c9ade33298
Fix memsetClass FP () 2022-09-15 20:20:49 +02:00
chrchr-github 07caf17eb3
Fix wrong usage of std::string in memcpy () 2022-09-13 15:14:25 +02:00
Oliver Stöneberg dbc05da356
fixed some clang-tidy warnings () 2022-09-08 20:01:41 +02:00
Oliver Stöneberg d46ea7ba86
avoid unnecessary copies with `push_back()` and `push_front()` () 2022-09-08 09:21:35 +02:00
Oliver Stöneberg 0e1cd8b2ac
do not do C++ processing for C code in `parsedecl()` () 2022-08-21 17:11:22 +02:00
chrchr-github 80a486dda0
Fix FP virtual call in destructor even though class is final / Delete 'final' from specializations ()
* Add 'final' keyword

* Delete 'final' from specializations

* Fix  FP virtual call in destructor even though class is final

* Fix test
2022-08-19 18:26:00 +02:00
chrchr-github 58d7185d64
Fix FP functionConst when overloaded operator ++ is used () 2022-07-26 08:30:59 +02:00
chrchr-github 1aceded300
Fix FP noExplicitConstructor with variadic template () 2022-07-24 10:18:19 +02:00
Daniel Marjamäki 1d5166d70c CheckClass: Fix false negatives for uninitMemberVar 2022-06-21 19:28:08 +02:00
Daniel Marjamäki 968d8d153e Fixed (False positive: derived union members are initialized in constructor) 2022-06-16 20:17:57 +02:00
chrchr-github 1d677c57a8
Fix FN: noExplicitConstructor with single default parameter () 2022-06-07 21:15:13 +02:00
chrchr-github e7e8b1baf9
Fix FN: "static" not suggested for non-const method ()
* Fix  FN: "static" not suggested for non-const method

* Format

* Make functions static

* static
2022-05-11 20:01:22 +02:00
chrchr-github 52cbbb0229
Fix FP uninitMemberVar with defaulted special member functions ()
* Fix  FN: duplicateExpression with multiple strings compared

* Fix compiler warning

* TODO -> ASSERT

* Update testautovariables.cpp

* Improve error message

* Format

* Improve message

* Fix FP with defaulted operator=

* Fix condition
2022-05-10 13:04:45 +02:00
chrchr-github 38bdece3fe
Fix False negative: Uninitialized struct member (default constructor) ()
* Fix  False negative: Uninitialized struct member (default constructor)

* Format

* Initialize variables

* Init
2022-05-09 20:28:21 +02:00
chrchr-github 8ce0faf723
Fix Regression: selfInitialization () 2022-05-02 16:49:13 +02:00
chrchr-github f323e8a6c6
Fix FP functionConst ()
* Fix  FP functionConst

* Format

* Format
2022-04-13 12:25:36 +02:00
chrchr-github 00badff622
Fix FP functionConst ()
* Fix  FP functionConst

* Update releasenotes.txt
2022-04-11 22:55:16 +02:00
chrchr-github f5313dc519
Fix crash with defaulted destructor () 2022-04-05 23:18:08 +02:00
chrchr-github e0830693c3
Fix FP uninitMemberVarPrivate with anonymous union () 2022-03-23 07:35:41 +01:00
chrchr-github 2baf8f6cd4
Fix FP virtualCallInConstructor with function pointer () 2022-03-19 20:00:06 +01:00
chrchr-github e073860e62
Fix FN uninitMemberVar when member is being used in constructor (regression) () 2022-03-16 20:35:55 +01:00
chrchr-github fb1170b10b
Fix FP constStatement with variable called std () 2022-03-16 15:29:34 +01:00
chrchr-github 200b098471
Fix FP for unused private function if address of function is taken () 2022-03-14 19:15:48 +01:00
Oliver Stöneberg 0d336b868c
avoid some Clang compiler warnings () 2022-03-13 20:07:58 +01:00
chrchr-github 2eed660b32
Fix Clarify warnings for uninitMemberVar () 2022-03-13 17:33:31 +01:00
chrchr-github 3a5931b417
Fix C++11 default values not for all class fields and missing constructor () 2022-03-07 08:39:19 +01:00
chrchr-github 78dd29ada3
Fix FP noConstructor with function pointer member () 2022-03-03 13:56:24 +01:00
chrchr-github 8a7992c6ac
Suppress operatorEqVarError for known non-copyable types ()
* Fix FP operatorEqVarError with class hierarchy

* Suppress operatorEqVarError for std::mutex

* Add test, non-copyable Qt types

* Update cppcheck-cfg.rng
2022-03-03 09:41:26 +01:00
chrchr-github 8e8e6b1170
Fix FP operatorEqVarError with class hierarchy () 2022-03-02 07:46:23 +01:00
chrchr-github 6a8bd981b5
Fix CheckClass::isMemberVar found used member variable with varid 0 ()
* Fix  CheckClass::isMemberVar found used member variable with varid 0

* Restore call to simpleMatch()
2022-02-28 18:28:23 +01:00
chrchr-github 05a6d09c5f
Fix FP uninitMemberVar from copy constructor [inconclusive] () 2022-02-27 19:15:19 +01:00
chrchr-github 5574e41b86
Fix CheckClass::isMemberVar found used member variable with varid 0 () 2022-02-20 18:17:47 +01:00
chrchr-github b07814f329
Fix FN missed class members in copy operator of derived class () 2022-02-16 21:30:19 +01:00
Rikard Falkeborn d4cd249c21
10671 fix const iterator function const take two ()
* Revert "Revert "Fix : functionConst FN with begin/end and const_iterator ()""

This reverts commit 9f6a36c1a8.

* Fix crash by adding missing null check
2022-02-11 21:23:23 +01:00
chrchr-github 5f3ddabd56
Fix FP constParameter with std::map () 2022-02-11 19:40:11 +01:00
Daniel Marjamäki 3989408738 Update copyright year 2022-02-05 11:45:17 +01:00
Daniel Marjamäki 9f6a36c1a8 Revert "Fix : functionConst FN with begin/end and const_iterator ()"
This reverts commit 2cacb13f85.
2022-02-03 11:04:02 +01:00
Daniel Marjamäki 4d9a1427b2 CheckClass: Write separate errorid for missing member copy instead of uninitMember 2022-02-02 20:44:22 +01:00
Rikard Falkeborn 2cacb13f85
Fix : functionConst FN with begin/end and const_iterator ()
Check if the iterator is assigned to a const_iterator or
const_revese_iterator, in which case it is possible the function can be
const. Unfortunately, it is not possible to remove the hard coding of
cbegin, cend, crbegin and crend due to the need to handle auto, as in
the following code snippet:

    void cbegin_auto(void)
    {
        for (auto it = m_str.cbegin(); it != m_str.cend(); ++it) {;}
    }
2022-02-02 19:37:06 +01:00
shaneasd 4127885282
improve noConstructor message () 2022-02-01 17:24:26 +01:00
Oliver Stöneberg 171da2e6f9
avoid dependency on transitive includes - based on include-what-you-use () 2022-01-27 19:03:20 +01:00
chrchr-github d64dadcd31
Fix Crash in CheckClass::checkConstFunc() () 2022-01-24 21:50:01 +01:00
chrchr-github b23ca879ed
Fix FP functionConst with overloaded operator[] [inconclusive] () 2022-01-21 20:40:10 +01:00
chrchr-github 1e2863cd33
Fix FP functionConst with aggregate initialization [inconclusive] () 2022-01-18 20:49:35 +01:00
chrchr-github ca2e0ca287
Fix FP functionConst with extra parentheses () 2022-01-18 20:21:25 +01:00
chrchr-github 605fd7cf98
Fix FP functionConst (inconclusive) with nested members () 2022-01-17 20:33:32 +01:00
Oliver Stöneberg ba402f3e50
cleaned up includes based on include-what-you-use () 2021-12-15 19:47:27 +01:00
nomick 5865b05703
fix false positive of virtual function call () 2021-11-11 07:53:30 +01:00
Paul Fultz II 7f358b2bed
Format with uncrustify () 2021-08-07 20:51:18 +02:00
Daniel Marjamäki ad478914f7 cppcheck build dir; Fix several xml syntax errors in the analyzer info files 2021-08-04 21:39:24 +02:00
Daniel Marjamäki d9dacc97e4 virtual call in constructor; warn when function is explicitly virtual 2021-07-11 11:03:31 +02:00
Daniel Marjamäki 03445c01c1 Fix false positives when class might inherit from VCL TObject class 2021-06-13 18:56:04 +02:00
Oliver Stöneberg 5de58c4ddd
added clang-tidy to CI () 2021-04-18 21:51:47 +02:00
Oliver Stöneberg 5a7e361442
run self-checks with standard set to C++11 () 2021-04-12 18:29:13 +02:00
ericmalenfant 1e9687aa8b
Fix noCopyConstructor with multiple inheritance () 2021-04-09 07:41:59 +02:00
Daniel Marjamäki a21c81365d one definition rule: Fixed false positive for 'class A::B ..' 2021-04-04 21:29:45 +02:00
Daniel Marjamäki 42437277dc Update Copyright year 2021-03-21 20:58:32 +01:00
Daniel Marjamäki b2691bda88 Fixed false positive in self check 2021-03-20 18:54:46 +01:00
IOBYTE 1874b9cb0f
fix crash in CheckClass::getFileInfo ()
* 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 () 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 (CheckClass::checkDuplInheritedMembersRecursive) ()
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 () 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 (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 () 2021-01-31 12:14:10 +01:00
IOBYTE fde5994cc3
fix (debug: Executable scope 'x' with unknown function.) () 2021-01-18 19:01:04 +01:00
Oliver Stöneberg ac7647fcd8
some self-check suppression cleanups () 2021-01-09 20:32:38 +01:00
Oliver Stöneberg 20e462a8ed
split "varid0" from more generic "debug" messages () 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 () 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