[neon/qt6/qt6-libqaccessibilityclient/Neon/unstable] debian: fix build with newer versions of GCC/Clang (#897792)

Pino Toscano null at kde.org
Mon Mar 13 14:22:57 GMT 2023


Git commit 049746e406392c3955d175cd80de5ebab2e0d187 by Pino Toscano.
Committed on 22/07/2018 at 20:41.
Pushed by jriddell into branch 'Neon/unstable'.

fix build with newer versions of GCC/Clang (#897792)

backport upstream commit 34f6084ff3ba1dd025cae17e5d114caff1d7fa6f

M  +4    -0    debian/changelog
M  +1    -0    debian/patches/series
A  +101  -0    debian/patches/upstream_Compile-with-clang-and-make-sure-qHash-works-with-Ac.patch

https://invent.kde.org/neon/qt6/qt6-libqaccessibilityclient/commit/049746e406392c3955d175cd80de5ebab2e0d187

diff --git a/debian/changelog b/debian/changelog
index 805c528..d752e7c 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -19,6 +19,10 @@ libqaccessibilityclient (0.2.0-0r1) UNRELEASED; urgency=medium
   * Backport upstream commit f5a27fab1eda69c6cca24463868262f487977aac to fix
     the destructor of an internal class; patch
     upstream_Add-missing-virtual-destructor.patch.
+  * Backport upstream commit 34f6084ff3ba1dd025cae17e5d114caff1d7fa6f to fix
+    build with newer versions of GCC/Clang; patch
+    upstream_Compile-with-clang-and-make-sure-qHash-works-with-Ac.patch.
+    (Closes: #897792)
 
  -- Debian KDE Extras Team <pkg-kde-extras at lists.alioth.debian.org>  Sun, 20 May 2018 19:34:58 +0200
 
diff --git a/debian/patches/series b/debian/patches/series
index e7fba21..d3ad73f 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -1,2 +1,3 @@
 libdir.diff
 upstream_Add-missing-virtual-destructor.patch
+upstream_Compile-with-clang-and-make-sure-qHash-works-with-Ac.patch
diff --git a/debian/patches/upstream_Compile-with-clang-and-make-sure-qHash-works-with-Ac.patch b/debian/patches/upstream_Compile-with-clang-and-make-sure-qHash-works-with-Ac.patch
new file mode 100644
index 0000000..c8be217
--- /dev/null
+++ b/debian/patches/upstream_Compile-with-clang-and-make-sure-qHash-works-with-Ac.patch
@@ -0,0 +1,101 @@
+From 34f6084ff3ba1dd025cae17e5d114caff1d7fa6f Mon Sep 17 00:00:00 2001
+From: Frederik Gladhorn <frederik.gladhorn at qt.io>
+Date: Tue, 25 Jul 2017 16:27:12 +0200
+Subject: [PATCH] Compile with clang and make sure qHash works with
+ AccessibleObject
+
+Clang didn't like the complicated friend declaration. To make sure it's
+not broken again, add one test to verify that we can use AO in hashes,
+since apps might want to do that.
+---
+ src/qaccessibilityclient/accessibleobject.cpp |  4 ----
+ src/qaccessibilityclient/accessibleobject.h   | 17 ++++++++++-------
+ tests/auto/tst_accessibilityclient.cpp        |  9 +++++++++
+ 3 files changed, 19 insertions(+), 11 deletions(-)
+
+diff --git a/src/qaccessibilityclient/accessibleobject.cpp b/src/qaccessibilityclient/accessibleobject.cpp
+index b2b005b..b8c9d33 100644
+--- a/src/qaccessibilityclient/accessibleobject.cpp
++++ b/src/qaccessibilityclient/accessibleobject.cpp
+@@ -534,7 +534,3 @@ QACCESSIBILITYCLIENT_EXPORT QDebug QAccessibleClient::operator<<(QDebug d, const
+     return d.space();
+ }
+ #endif
+-
+-uint qHash(const QAccessibleClient::AccessibleObject& object) {
+-    return qHash(object.d);
+-}
+diff --git a/src/qaccessibilityclient/accessibleobject.h b/src/qaccessibilityclient/accessibleobject.h
+index a0d0db4..ee2e5ad 100644
+--- a/src/qaccessibilityclient/accessibleobject.h
++++ b/src/qaccessibilityclient/accessibleobject.h
+@@ -27,8 +27,6 @@ namespace QAccessibleClient {
+     class AccessibleObject;
+ }
+ 
+-uint qHash(const QAccessibleClient::AccessibleObject& object);
+-
+ #include <qlist.h>
+ #include <QSharedPointer>
+ #include <qaction.h>
+@@ -40,6 +38,11 @@ namespace QAccessibleClient {
+ class AccessibleObjectPrivate;
+ class RegistryPrivate;
+ 
++
++#ifndef QT_NO_DEBUG_STREAM
++    QACCESSIBILITYCLIENT_EXPORT QDebug operator<<(QDebug, const AccessibleObject &);
++#endif
++
+ /**
+     This class represents an accessible object.
+ 
+@@ -746,13 +749,13 @@ private:
+     friend class RegistryPrivate;
+     friend class CacheWeakStrategy;
+     friend class CacheStrongStrategy;
+-    friend QDebug QAccessibleClient::operator<<(QDebug, const AccessibleObject &);
+-    friend uint ::qHash(const AccessibleObject& object);
+-};
+-
+ #ifndef QT_NO_DEBUG_STREAM
+-QACCESSIBILITYCLIENT_EXPORT QDebug operator<<(QDebug, const AccessibleObject &);
++    friend QDebug QAccessibleClient::operator<<(QDebug, const AccessibleObject &);
+ #endif
++    friend uint qHash(const QAccessibleClient::AccessibleObject& object) {
++        return qHash(object.d);
++    }
++};
+ 
+ }
+ 
+diff --git a/tests/auto/tst_accessibilityclient.cpp b/tests/auto/tst_accessibilityclient.cpp
+index ad98c0e..c377982 100644
+--- a/tests/auto/tst_accessibilityclient.cpp
++++ b/tests/auto/tst_accessibilityclient.cpp
+@@ -75,6 +75,7 @@ private Q_SLOTS:
+ 
+     void tst_registry();
+     void tst_accessibleObject();
++    void tst_hashable();
+     void tst_application();
+     void tst_navigation();
+     void tst_focus();
+@@ -145,6 +146,14 @@ void AccessibilityClientTest::tst_accessibleObject()
+     QVERIFY(!invalid2.isValid());
+ }
+ 
++void AccessibilityClientTest::tst_hashable()
++{
++    AccessibleObject testObject;
++    QHash<AccessibleObject, int> testHash;
++    testHash[testObject] = 1;
++    QCOMPARE(testHash[testObject], 1);
++}
++
+ void AccessibilityClientTest::tst_application()
+ {
+     QString appName = QLatin1String("Lib QAccessibleClient test");
+-- 
+2.18.0
+



More information about the Neon-commits mailing list