Commit Graph

833 Commits

Author SHA1 Message Date
chrchr-github e3939d32d0
Fix crash on nullptr (#4582)
* Update tokenlist.cpp

* Update testincompletestatement.cpp

* Fix #11370 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 #11383 FP selfAssignment: lambda capture / #11380 FP operatorEqRetRefThis (#4581)
* Fix  #11383 FP selfAssignment: lambda capture /  #11380
FP operatorEqRetRefThis

* Format
2022-11-13 21:20:44 +01:00
chrchr-github 4e75c08f58
Respect [[maybe_unused]] in unusedPrivateFunction (#4579) 2022-11-10 20:58:39 +01:00
chrchr-github ffc0c57562
Fix crashes on nullptr (#4575) 2022-11-09 21:56:16 +01:00
gerboengels d7a8f7f297
Fix couple issues with missing operatorEqVarError (#4576) 2022-11-05 10:48:34 +01:00
chrchr-github 3273e51fd5
Fix #10412 FN useStlAlgorithm with iterators (#4157) 2022-10-16 13:46:26 +02:00
Oliver Stöneberg ee124cd097
modernized `erase()` calls (#4530) 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 (#4529)
* 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 (#4497)
* Fix #1655 wrong usage of std::string in memcpy

* Fix memsetClass FP

* Fix #8619 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 #11328 FN functionStatic, functionConst with this (#4496)
* Fix #11328 FN functionStatic, functionConst with this

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

* Fix memsetClass FP

* Fix #8619 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 (#4465) 2022-09-15 20:20:49 +02:00
chrchr-github 07caf17eb3
Fix #1655 wrong usage of std::string in memcpy (#4460) 2022-09-13 15:14:25 +02:00
Oliver Stöneberg dbc05da356
fixed some clang-tidy warnings (#4435) 2022-09-08 20:01:41 +02:00
Oliver Stöneberg d46ea7ba86
avoid unnecessary copies with `push_back()` and `push_front()` (#4451) 2022-09-08 09:21:35 +02:00
Oliver Stöneberg 0e1cd8b2ac
do not do C++ processing for C code in `parsedecl()` (#4304) 2022-08-21 17:11:22 +02:00
chrchr-github 80a486dda0
Fix #11167 FP virtual call in destructor even though class is final / Delete 'final' from specializations (#4383)
* Add 'final' keyword

* Delete 'final' from specializations

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

* Fix test
2022-08-19 18:26:00 +02:00
chrchr-github 58d7185d64
Fix #10077 FP functionConst when overloaded operator ++ is used (#4309) 2022-07-26 08:30:59 +02:00
chrchr-github 1aceded300
Fix #10977 FP noExplicitConstructor with variadic template (#4301) 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 #11101 (False positive: derived union members are initialized in constructor) 2022-06-16 20:17:57 +02:00
chrchr-github 1d677c57a8
Fix #11126 FN: noExplicitConstructor with single default parameter (#4174) 2022-06-07 21:15:13 +02:00
chrchr-github e7e8b1baf9
Fix #9861 FN: "static" not suggested for non-const method (#4101)
* Fix #9861 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 (#4094)
* Fix #10569 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 #9391 False negative: Uninitialized struct member (default constructor) (#4088)
* Fix #9391 False negative: Uninitialized struct member (default constructor)

* Format

* Initialize variables

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

* Format

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

* Update releasenotes.txt
2022-04-11 22:55:16 +02:00
chrchr-github f5313dc519
Fix crash with defaulted destructor (#3975) 2022-04-05 23:18:08 +02:00
chrchr-github e0830693c3
Fix FP uninitMemberVarPrivate with anonymous union (#3927) 2022-03-23 07:35:41 +01:00
chrchr-github 2baf8f6cd4
Fix FP virtualCallInConstructor with function pointer (#3913) 2022-03-19 20:00:06 +01:00
chrchr-github e073860e62
Fix #10841 FN uninitMemberVar when member is being used in constructor (regression) (#3909) 2022-03-16 20:35:55 +01:00
chrchr-github fb1170b10b
Fix #10872 FP constStatement with variable called std (#3906) 2022-03-16 15:29:34 +01:00
chrchr-github 200b098471
Fix #10516 FP for unused private function if address of function is taken (#3901) 2022-03-14 19:15:48 +01:00
Oliver Stöneberg 0d336b868c
avoid some Clang compiler warnings (#3896) 2022-03-13 20:07:58 +01:00
chrchr-github 2eed660b32
Fix #8496 Clarify warnings for uninitMemberVar (#3760) 2022-03-13 17:33:31 +01:00
chrchr-github 3a5931b417
Fix #5499 C++11 default values not for all class fields and missing constructor (#3876) 2022-03-07 08:39:19 +01:00
chrchr-github 78dd29ada3
Fix #10770 FP noConstructor with function pointer member (#3751) 2022-03-03 13:56:24 +01:00
chrchr-github 8a7992c6ac
Suppress operatorEqVarError for known non-copyable types (#3869)
* 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 (#3868) 2022-03-02 07:46:23 +01:00
chrchr-github 6a8bd981b5
Fix #10825 CheckClass::isMemberVar found used member variable with varid 0 (#3863)
* Fix #10825 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 #10360 FP uninitMemberVar from copy constructor [inconclusive] (#3748) 2022-02-27 19:15:19 +01:00
chrchr-github 5574e41b86
Fix #10065 CheckClass::isMemberVar found used member variable with varid 0 (#3843) 2022-02-20 18:17:47 +01:00
chrchr-github b07814f329
Fix #3462 FN missed class members in copy operator of derived class (#3837) 2022-02-16 21:30:19 +01:00
Rikard Falkeborn d4cd249c21
10671 fix const iterator function const take two (#3802)
* Revert "Revert "Fix #10671: functionConst FN with begin/end and const_iterator (#3749)""

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 (#3823) 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 #10671: functionConst FN with begin/end and const_iterator (#3749)"
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 #10671: functionConst FN with begin/end and const_iterator (#3749)
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