From adbe6f41c029162b4ec99e70a3cc160041e64218 Mon Sep 17 00:00:00 2001 From: michael Date: Thu, 22 Nov 2012 21:40:21 +0100 Subject: [PATCH] ARM cannot bind references to packed fields. There is no possible implementation of QChar.unicode() returning a int&. Replace with unicodep() returning int*. The allows athe code to compile. To be determined if the reference access ever work on ARM as it cannot make the unaligned access. --- extra/qt3/PKGBUILD | 3 +- extra/qt3/arm.patch | 25 ------------- extra/qt3/arm_no_packed.patch | 69 +++++++++++++++++++++++++++++++++++ 3 files changed, 71 insertions(+), 26 deletions(-) delete mode 100644 extra/qt3/arm.patch create mode 100644 extra/qt3/arm_no_packed.patch diff --git a/extra/qt3/PKGBUILD b/extra/qt3/PKGBUILD index 8004ae7e1..636129a8f 100644 --- a/extra/qt3/PKGBUILD +++ b/extra/qt3/PKGBUILD @@ -30,7 +30,8 @@ sha1sums=('745def6250dc7f337dbb265e20bf38dcb41fd854' '40c7b8f06a21f809ddeb8b5560e9da63ccac6a17' '1346320614f6f86fbeb10b9fbad721dea29f5b61' 'd9b83b8f6f9c8bd98d290dc1d0e9913a00b62c3f' - '896ffd1d5d31101a4c60155648dfed419abee3c1') + '896ffd1d5d31101a4c60155648dfed419abee3c1' + 'f77e1bcd27205ab58a9025db9ddfd0da73979782') # qt-copy-kde-patches come from http://websvn.kde.org/trunk/qt-copy/patches/ # other qt-patches come from fedora and gentoo diff --git a/extra/qt3/arm.patch b/extra/qt3/arm.patch deleted file mode 100644 index 9e32f4bf2..000000000 --- a/extra/qt3/arm.patch +++ /dev/null @@ -1,25 +0,0 @@ -diff -urN qt-x11-free-3.3.8.orig/src/tools/qglobal.h qt-x11-free-3.3.8/src/tools/qglobal.h ---- qt-x11-free-3.3.8.orig/src/tools/qglobal.h 2011-01-20 21:18:42.000000000 -0700 -+++ qt-x11-free-3.3.8/src/tools/qglobal.h 2011-01-20 21:20:34.000000000 -0700 -@@ -320,6 +320,9 @@ - # if __GNUC__ == 3 && __GNUC_MINOR__ >= 4 - # define Q_NO_PACKED_REFERENCE - # endif -+# if __GNUC__ == 4 && __GNUC_MINOR__ >= 0 -+# define Q_NO_PACKED_POINTERS -+# endif - # endif - # if !defined(__EXCEPTIONS) - # define Q_NO_EXCEPTIONS -diff -urN qt-x11-free-3.3.8.orig/src/tools/qstring.h qt-x11-free-3.3.8/src/tools/qstring.h ---- qt-x11-free-3.3.8.orig/src/tools/qstring.h 2011-01-20 21:18:43.000000000 -0700 -+++ qt-x11-free-3.3.8/src/tools/qstring.h 2011-01-20 21:21:48.000000000 -0700 -@@ -195,6 +195,8 @@ - ushort unicode() const { return ucs; } - #ifdef Q_NO_PACKED_REFERENCE - ushort &unicode() { return *(&ucs); } -+#elif defined Q_NO_PACKED_POINTERS -+ ushort &unicode() { ushort& tmp = ucs; return tmp; } - #else - ushort &unicode() { return ucs; } - #endif diff --git a/extra/qt3/arm_no_packed.patch b/extra/qt3/arm_no_packed.patch new file mode 100644 index 000000000..383acaa52 --- /dev/null +++ b/extra/qt3/arm_no_packed.patch @@ -0,0 +1,69 @@ +--- a/src/qt-x11-free-3.3.8b/src/tools/qglobal.h ++++ b/src/qt-x11-free-3.3.8b/src/tools/qglobal.h +@@ -323,6 +323,13 @@ + # if __GNUC__ == 3 && __GNUC_MINOR__ >= 4 + # define Q_NO_PACKED_REFERENCE + # endif ++# if __GNUC__ == 4 && __GNUC_MINOR__ >= 0 ++# if __GNUC__ == 4 && __GNUC_MINOR__ >= 7 ++# define Q_NO_PACKED_ACCESS ++# else ++# define Q_NO_PACKED_POINTERS ++# endif ++# endif + # endif + # if !defined(__EXCEPTIONS) + # define Q_NO_EXCEPTIONS +--- a/src/qt-x11-free-3.3.8b/src/tools/qlocale.cpp ++++ b/src/qt-x11-free-3.3.8b/src/tools/qlocale.cpp +@@ -3293,7 +3293,11 @@ QString QLocalePrivate::doubleToString(double d, + + if (zero().unicode() != '0') { + for (uint i = 0; i < digits.length(); ++i) ++#ifdef Q_NO_PACKED_ACCESS ++ *digits.ref(i).unicodep() += zero().unicode() - '0'; ++#else + digits.ref(i).unicode() += zero().unicode() - '0'; ++#endif + } + + bool always_show_decpt = flags & Alternate; +--- a/src/qt-x11-free-3.3.8b/src/tools/qstring.cpp ++++ b/src/qt-x11-free-3.3.8b/src/tools/qstring.cpp +@@ -1933,7 +1933,11 @@ static QString replaceArgEscapes(const QString &s, const ArgEscapeData &d, int f + + if (field_width > 0) { // left padded + for (uint i = 0; i < pad_chars; ++i) ++#ifdef Q_NO_PACKED_ACCESS ++ *(rc++)->unicodep() = ' '; ++#else + (rc++)->unicode() = ' '; ++#endif + } + + if (locale_arg) { +@@ -1947,7 +1951,11 @@ static QString replaceArgEscapes(const QString &s, const ArgEscapeData &d, int f + + if (field_width < 0) { // right padded + for (uint i = 0; i < pad_chars; ++i) ++#ifdef Q_NO_PACKED_ACCESS ++ *(rc++)->unicodep() = ' '; ++#else + (rc++)->unicode() = ' '; ++#endif + } + + if (++repl_cnt == d.occurrences) { +--- a/src/qt-x11-free-3.3.8b/src/tools/qstring.h ++++ b/src/qt-x11-free-3.3.8b/src/tools/qstring.h +@@ -199,6 +199,10 @@ public: + ushort unicode() const { return ucs; } + #ifdef Q_NO_PACKED_REFERENCE + ushort &unicode() { return *(&ucs); } ++#elif defined Q_NO_PACKED_POINTERS ++ ushort &unicode() { ushort& tmp = ucs; return tmp; } ++#elif defined Q_NO_PACKED_ACCESS ++ ushort *unicodep() { return &ucs; } + #else + ushort &unicode() { return ucs; } + #endif