[clazy] [Bug 365940] New: Warn when using non-owning smart pointers as associative container key
https://bugs.kde.org/show_bug.cgi?id=365940 Bug ID: 365940 Summary: Warn when using non-owning smart pointers as associative container key Product: clazy Version: unspecified Platform: Other OS: Linux Status: UNCONFIRMED Severity: wishlist Priority: NOR Component: general Assignee: unassigned-b...@kde.org Reporter: vkra...@kde.org CC: smart...@kde.org Quoting -Wmarc: "The values of keys in an associated container are not supposed to change over time, thus they are marked as const in the std containers. But some types can change their values under the hood while being stored as const. Examples of such types as QPointer, weak_ptr, QWeakPointer, but also QPersistentModelIndex. As they change, the container's class invariants are broken (order in sorted and hash value unordered associative containers), and accessing such a container results in undefined behaviour." Reproducible: Always -- You are receiving this mail because: You are watching all bug changes.
[clazy] [Bug 360112] New: function-args-by-ref triggers on (deleted) copy ctor
https://bugs.kde.org/show_bug.cgi?id=360112 Bug ID: 360112 Summary: function-args-by-ref triggers on (deleted) copy ctor Product: clazy Version: unspecified Platform: Other OS: Linux Status: UNCONFIRMED Severity: normal Priority: NOR Component: general Assignee: unassigned-b...@kde.org Reporter: vkra...@kde.org CC: smart...@kde.org /k/qt5-dev/inst/include/QtCore/qmetatype.h:324:5: warning: Pass small and trivially-copyable type by value (const struct QtPrivate::AbstractConverterFunction &) [-Wclazy-function-args-by-ref] Q_DISABLE_COPY(AbstractConverterFunction) ^ /k/qt5-dev/inst/include/QtCore/qglobal.h:324:11: note: expanded from macro 'Q_DISABLE_COPY' Class(const Class &) Q_DECL_EQ_DELETE;\ ^ Reproducible: Always Expected Results: The check probably should ignore both copy ctors and deleted functions? -- You are receiving this mail because: You are watching all bug changes.
[clazy] [Bug 360338] New: qstring-ref check does not trigger for toFloat() calls on string temporaries
https://bugs.kde.org/show_bug.cgi?id=360338 Bug ID: 360338 Summary: qstring-ref check does not trigger for toFloat() calls on string temporaries Product: clazy Version: unspecified Platform: Other OS: Linux Status: UNCONFIRMED Severity: normal Priority: NOR Component: general Assignee: unassigned-b...@kde.org Reporter: vkra...@kde.org CC: smart...@kde.org qtdeclarative/src/quick/util/qquickglobal.cpp contains example code that should trigger (s.left/mid().toFloat()), but does not. This seems to fix it: diff --git a/checks/qstringref.cpp b/checks/qstringref.cpp index 1ef8e88..45b5920 100644 --- a/checks/qstringref.cpp +++ b/checks/qstringref.cpp @@ -58,7 +58,7 @@ static bool isInterestingSecondMethod(CXXMethodDecl *method, const clang::LangOp return false; static const vector list = { "compare", "contains", "count", "startsWith", "endsWith", "indexOf", - "isEmpty", "isNull", "lastIndexOf", "length", "size", "toDouble", "toInt", + "isEmpty", "isNull", "lastIndexOf", "length", "size", "toDouble", "toFloat", "toInt", "toUInt", "toULong", "toULongLong", "toUShort", "toUcs4"}; if (!clazy_std::contains(list, method->getNameAsString())) Reproducible: Always -- You are receiving this mail because: You are watching all bug changes.
[clazy] [Bug 360374] New: Check for QString::left(1) mis-use.
https://bugs.kde.org/show_bug.cgi?id=360374 Bug ID: 360374 Summary: Check for QString::left(1) mis-use. Product: clazy Version: unspecified Platform: Other OS: Linux Status: UNCONFIRMED Severity: wishlist Priority: NOR Component: general Assignee: unassigned-b...@kde.org Reporter: vkra...@kde.org CC: smart...@kde.org QString::left(1) is an inefficient way of saying QString::at(0) in most cases. A quick grep over Qt and KDE sources show basically two use-cases (about 40-50 hits): * str.left(1) == QStringLiteral("#") * str.left(1).toUpper() - typically used as part of string concatenations Both cases would work with at(0) just as well, and at least the latter one isn't caught yet by clazy. Reproducible: Always -- You are receiving this mail because: You are watching all bug changes.
[clazy] [Bug 362063] New: [qobject-macro] False positive when implementing qt_metacall manually
https://bugs.kde.org/show_bug.cgi?id=362063 Bug ID: 362063 Summary: [qobject-macro] False positive when implementing qt_metacall manually Product: clazy Version: unspecified Platform: Other OS: Linux Status: UNCONFIRMED Severity: minor Priority: NOR Component: general Assignee: unassigned-b...@kde.org Reporter: vkra...@kde.org CC: smart...@kde.org If you implement the virtuals defined by Q_OBJECT yourself, bypassing moc, the missing Q_OBJECT warning still triggers. It's a very rare fringe case, of course ;) Reproducible: Always Steps to Reproduce: An example can be found e.g. in GammaRay, core/multisignalmapper.cpp, GammaRay::MultiSignalMapperPrivate. The most prominent example for this in Qt is QSignalSpy, which is excluded from this check already by being a template though. -- You are receiving this mail because: You are watching all bug changes.
[clazy] [Bug 360374] Check for QString::left(1) mis-use.
https://bugs.kde.org/show_bug.cgi?id=360374 --- Comment #2 from Volker Krause --- I haven't found a valid use of left(1) yet, so an unconditional warning would probably be fine. In theory it differs from at(0) in that it returns a QString rather than a QChar, which doesn't matter for string concatenations or comparisons, but might be relevant in some other context. -- You are receiving this mail because: You are watching all bug changes.