Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package clazy for openSUSE:Factory checked in at 2026-03-10 17:57:12 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/clazy (Old) and /work/SRC/openSUSE:Factory/.clazy.new.8177 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "clazy" Tue Mar 10 17:57:12 2026 rev:36 rq:1337923 version:1.17 Changes: -------- --- /work/SRC/openSUSE:Factory/clazy/clazy.changes 2026-02-19 14:25:30.948039694 +0100 +++ /work/SRC/openSUSE:Factory/.clazy.new.8177/clazy.changes 2026-03-10 18:01:52.516732848 +0100 @@ -1,0 +2,6 @@ +Tue Mar 10 09:24:53 UTC 2026 - Christophe Marin <[email protected]> + +- Add upstream change: + * 0001-Fix-FullyQualifiedMocTypes-giving-false-positives-fo.patch + +------------------------------------------------------------------- New: ---- 0001-Fix-FullyQualifiedMocTypes-giving-false-positives-fo.patch ----------(New B)---------- New:- Add upstream change: * 0001-Fix-FullyQualifiedMocTypes-giving-false-positives-fo.patch ----------(New E)---------- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ clazy.spec ++++++ --- /var/tmp/diff_new_pack.3OSnZ1/_old 2026-03-10 18:01:53.912790245 +0100 +++ /var/tmp/diff_new_pack.3OSnZ1/_new 2026-03-10 18:01:53.932791068 +0100 @@ -27,6 +27,8 @@ Source1: https://download.kde.org/stable/clazy/%{version}/src/%{name}-%{version}.tar.xz.sig # https://invent.kde.org/sysadmin/release-keyring/-/blob/master/keys/[email protected]?ref_type=heads Source2: clazy.keyring +# PATCH-FIX-UPSTREAM +Patch0: 0001-Fix-FullyQualifiedMocTypes-giving-false-positives-fo.patch BuildRequires: clang BuildRequires: clang-devel >= 19.0 BuildRequires: cmake >= 3.13 ++++++ 0001-Fix-FullyQualifiedMocTypes-giving-false-positives-fo.patch ++++++ >From 2cec71f84238713e49f4f14f98b6cbca882ea49f Mon Sep 17 00:00:00 2001 From: Alexander Lohnau <[email protected]> Date: Mon, 9 Mar 2026 18:56:42 +0100 Subject: Fix FullyQualifiedMocTypes giving false positives for pointers inside of template args Fixes https://invent.kde.org/sdk/clazy/-/issues/35 --- Changelog | 7 +++++++ src/checks/level0/fully-qualified-moc-types.cpp | 12 ++++++++---- tests/fully-qualified-moc-types/config.json | 4 ++++ .../fully-qualified-moc-types/pointers_refs.cpp | 17 +++++++++++++++++ .../pointers_refs.cpp.expected | 2 ++ 5 files changed, 38 insertions(+), 4 deletions(-) create mode 100644 tests/fully-qualified-moc-types/pointers_refs.cpp create mode 100644 tests/fully-qualified-moc-types/pointers_refs.cpp.expected diff --git a/Changelog b/Changelog index 6d4c89f..cf9e92d 100644 --- a/Changelog +++ b/Changelog @@ -1,3 +1,10 @@ +Version 1.17.1 +~~~~~~~~~~~~ +Released: TBD + +Bugfixes: + * fully-qualified-moc-types: Fix false positive for pointer/reference types in generics + Version 1.17 ~~~~~~~~~~~~ Released: 2025-02-15 diff --git a/src/checks/level0/fully-qualified-moc-types.cpp b/src/checks/level0/fully-qualified-moc-types.cpp index 95c66575..e80626ce 100644 --- a/src/checks/level0/fully-qualified-moc-types.cpp +++ b/src/checks/level0/fully-qualified-moc-types.cpp @@ -164,20 +164,24 @@ std::string FullyQualifiedMocTypes::getQualifiedNameOfType(const Type *ptr, bool } if (auto *typedefDecl = ptr->getAs<TypedefType>(); typedefDecl && typedefDecl->getDecl()) { return typedefDecl->getDecl()->getQualifiedNameAsString(); - } - - else if (auto templateSpec = ptr->getAs<TemplateSpecializationType>(); templateSpec && resolveTemplateArgs) { + } else if (auto templateSpec = ptr->getAs<TemplateSpecializationType>(); templateSpec && resolveTemplateArgs) { return resolveTemplateType(templateSpec, false); } else if (auto templateSpec = ptr->getAs<TemplateSpecializationType>()) { // In case one uses a typedef with generics, like QVector<QString> in Qt6 // The docs indicate getAsTemplateDecl might be null - so be prepared for that if (auto *decl = templateSpec->getTemplateName().getAsTemplateDecl()) { return decl->getQualifiedNameAsString(); - } else { } } else if (auto recordDecl = ptr->getAsRecordDecl()) { return recordDecl->getQualifiedNameAsString(); } + // The lexer logic we use to collect the comparison string from the source code has no spaces between the type and * or & + if (ptr->isPointerType()) { + return getQualifiedNameOfType(ptr->getPointeeType().getTypePtr(), true) + "*"; + } + if (ptr->isReferenceType()) { + return getQualifiedNameOfType(ptr->getPointeeType().getTypePtr(), true) + "&"; + } return QualType::getFromOpaquePtr(ptr).getAsString(lo()); } diff --git a/tests/fully-qualified-moc-types/config.json b/tests/fully-qualified-moc-types/config.json index 15715653..61508624 100644 --- a/tests/fully-qualified-moc-types/config.json +++ b/tests/fully-qualified-moc-types/config.json @@ -12,6 +12,10 @@ { "filename": "enums.cpp", "has_fixits": true + }, + { + "filename": "pointers_refs.cpp", + "skip_qtnamespaced": true } ] } diff --git a/tests/fully-qualified-moc-types/pointers_refs.cpp b/tests/fully-qualified-moc-types/pointers_refs.cpp new file mode 100644 index 00000000..0578d1f3 --- /dev/null +++ b/tests/fully-qualified-moc-types/pointers_refs.cpp @@ -0,0 +1,17 @@ +#include <QtCore/qobject.h> +namespace EnumNs { + class FwdClass; // https://invent.kde.org/sdk/clazy/-/issues/35 +} +using namespace EnumNs; +class Test: public QObject{ + Q_OBJECT + +Q_SIGNALS: + void emitChangePtr(QList<EnumNs::FwdClass *> list); + void emitChangeRef(QList<EnumNs::FwdClass &> list); + void emitChangePtrSpace( QList< EnumNs::FwdClass * > list); + void emitChangeRefSpace( QList< EnumNs::FwdClass & > list); + void emitChangePtrUnqual(QList<FwdClass *> list); + void emitChangeRefUnqual(QList<FwdClass &> list); + +}; diff --git a/tests/fully-qualified-moc-types/pointers_refs.cpp.expected b/tests/fully-qualified-moc-types/pointers_refs.cpp.expected new file mode 100644 index 00000000..39af6ba7 --- /dev/null +++ b/tests/fully-qualified-moc-types/pointers_refs.cpp.expected @@ -0,0 +1,2 @@ +fully-qualified-moc-types/pointers_refs.cpp:14:28: warning: signal arguments need to be fully-qualified [-Wclazy-fully-qualified-moc-types] +fully-qualified-moc-types/pointers_refs.cpp:15:28: warning: signal arguments need to be fully-qualified [-Wclazy-fully-qualified-moc-types] -- 2.53.0
