Skip to contentSkip to conversation

qtbase: Use sched_yield instead of pthread_yield

PATCH New Khem Raj 1 participant 2 messages Aug 2, 2017

lore
Share & tools
lore

Khem Raj

author
#0 lore raw

PATCH 1/2 qtbase: Use sched_yield instead of pthread_yield

Makes it portable across glibc and musl

---
 ...11-Replace-pthread_yield-with-sched_yield.patch | 63 ++++++++++++++++++++++
 recipes-qt/qt5/qtbase_git.bb                       |  1 +
 2 files changed, 64 insertions(+)
 create mode 100644 recipes-qt/qt5/qtbase/0011-Replace-pthread_yield-with-sched_yield.patch
recipes-qt/qt5/qtbase/0011-Replace-pthread_yield-with-sched_yield.patch new file +63 -0
new file mode 100644
index 0000000..ed0d4bc
@@ -0,0 +1,63 @@
+From d1d4b520e29b58e427fc7bd336d34b82d0d2b1f3 Mon Sep 17 00:00:00 2001
+From: Khem Raj <[email protected]>
+Date: Thu, 27 Jul 2017 08:02:51 -0700
+Subject: [PATCH] Replace pthread_yield with sched_yield
+
+On Linux pthead_yield is same as sched_yield implementation wise
+and sched_yield is available on all libc
+implementations on Linux
+
+Signed-off-by: Khem Raj <[email protected]>
+---
+ tests/auto/corelib/kernel/qmetatype/tst_qmetatype.cpp   | 4 ++--
+ tests/auto/network/socket/qtcpsocket/tst_qtcpsocket.cpp | 5 +++--
+ 2 files changed, 5 insertions(+), 4 deletions(-)
+
+diff --git a/tests/auto/corelib/kernel/qmetatype/tst_qmetatype.cpp b/tests/auto/corelib/kernel/qmetatype/tst_qmetatype.cpp
+index 7d9f56ef38..bc115ef61d 100644
+--- a/tests/auto/corelib/kernel/qmetatype/tst_qmetatype.cpp
++++ b/tests/auto/corelib/kernel/qmetatype/tst_qmetatype.cpp
+@@ -34,7 +34,7 @@
+ #include "tst_qvariant_common.h"
+ 
+ #ifdef Q_OS_LINUX
+-# include <pthread.h>
++# include <sched.h>
+ #endif
+ 
+ #include <algorithm>
+@@ -197,7 +197,7 @@ protected:
+             const char *nm = name.constData();
+             int tp = qRegisterMetaType<Bar>(nm);
+ #if defined(Q_OS_LINUX) && !defined(Q_OS_ANDROID)
+-            pthread_yield();
++            sched_yield();
+ #endif
+             QMetaType info(tp);
+             if (!info.isValid()) {
+diff --git a/tests/auto/network/socket/qtcpsocket/tst_qtcpsocket.cpp b/tests/auto/network/socket/qtcpsocket/tst_qtcpsocket.cpp
+index fe1057bdde..e23e97b259 100644
+--- a/tests/auto/network/socket/qtcpsocket/tst_qtcpsocket.cpp
++++ b/tests/auto/network/socket/qtcpsocket/tst_qtcpsocket.cpp
+@@ -75,6 +75,7 @@
+ #include <stdlib.h>
+ #include <sys/stat.h>
+ #include <unistd.h>
++#include <sched.h>
+ #endif
+ 
+ #include "private/qhostinfo_p.h"
+@@ -2129,8 +2130,8 @@ public slots:
+ 
+ #if defined(Q_OS_MAC)
+         pthread_yield_np();
+-#elif defined Q_OS_LINUX && !defined Q_OS_ANDROID
+-        pthread_yield();
++#elif defined Q_OS_LINUX
++        sched_yield();
+ #endif
+         if (!sock->waitForConnected()) {
+             networkTimeout = true;
+-- 
+2.13.3
+
recipes-qt/qt5/qtbase_git.bb +1 -0
index c26a93b..9e652c3 100644
@@ -24,6 +24,7 @@ SRC_URI += "\
     file://0009-Disable-all-unknown-features-instead-of-erroring-out.patch \
     file://0010-Pretend-Qt5-wasn-t-found-if-OE_QMAKE_PATH_EXTERNAL_H.patch \
     file://0010-tst_qstring-Disable-Wformat-security-with-clang-as-w.patch \
+    file://0011-Replace-pthread_yield-with-sched_yield.patch \
 "
 
 # only for target qtbase
Signature · 1 line
2.13.3
author
#1 lore raw

PATCH 2/2 qtwebkit: Backport a patch to fix build with icu-59

---
 .../0004-Fix-compilation-with-ICU-59.patch         | 92 ++++++++++++++++++++++
 recipes-qt/qt5/qtwebkit_git.bb                     |  1 +
 2 files changed, 93 insertions(+)
 create mode 100644 recipes-qt/qt5/qtwebkit/0004-Fix-compilation-with-ICU-59.patch
recipes-qt/qt5/qtwebkit/0004-Fix-compilation-with-ICU-59.patch new file +92 -0
new file mode 100644
index 0000000..e4a108e
@@ -0,0 +1,92 @@
+From d8d9b1eb468f5e5d5d9f0b196fc0acb641998c8b Mon Sep 17 00:00:00 2001
+From: Konstantin Tokarev <[email protected]>
+Date: Thu, 4 May 2017 15:12:37 +0300
+Subject: [PATCH] Fix compilation with ICU 59
+
+Upstream fix: https://bugs.webkit.org/show_bug.cgi?id=171612
+
+Task-number: QTBUG-60532
+Change-Id: I6014feea213aa70ebe40b09d9d1a03fd1ed3c843
+Reviewed-by: Allan Sandfeld Jensen <[email protected]>
+---
+ Source/JavaScriptCore/API/JSStringRef.cpp        | 6 +++---
+ Source/JavaScriptCore/runtime/DateConversion.cpp | 3 ++-
+ Source/WTF/wtf/TypeTraits.h                      | 3 +++
+ Source/WebKit2/Shared/API/c/WKString.cpp         | 2 +-
+ 4 files changed, 9 insertions(+), 5 deletions(-)
+
+diff --git a/Source/JavaScriptCore/API/JSStringRef.cpp b/Source/JavaScriptCore/API/JSStringRef.cpp
+index 812f3d413..77a3fd0f4 100644
+--- a/Source/JavaScriptCore/API/JSStringRef.cpp
++++ b/Source/JavaScriptCore/API/JSStringRef.cpp
+@@ -37,7 +37,7 @@ using namespace WTF::Unicode;
+ JSStringRef JSStringCreateWithCharacters(const JSChar* chars, size_t numChars)
+ {
+     initializeThreading();
+-    return OpaqueJSString::create(chars, numChars).leakRef();
++    return OpaqueJSString::create(reinterpret_cast<const UChar*>(chars), numChars).leakRef();
+ }
+ 
+ JSStringRef JSStringCreateWithUTF8CString(const char* string)
+@@ -62,7 +62,7 @@ JSStringRef JSStringCreateWithUTF8CString(const char* string)
+ JSStringRef JSStringCreateWithCharactersNoCopy(const JSChar* chars, size_t numChars)
+ {
+     initializeThreading();
+-    return OpaqueJSString::create(StringImpl::createWithoutCopying(chars, numChars, WTF::DoesNotHaveTerminatingNullCharacter)).leakRef();
++    return OpaqueJSString::create(StringImpl::createWithoutCopying(reinterpret_cast<const UChar*>(chars), numChars, WTF::DoesNotHaveTerminatingNullCharacter)).leakRef();
+ }
+ 
+ JSStringRef JSStringRetain(JSStringRef string)
+@@ -83,7 +83,7 @@ size_t JSStringGetLength(JSStringRef string)
+ 
+ const JSChar* JSStringGetCharactersPtr(JSStringRef string)
+ {
+-    return string->characters();
++    return reinterpret_cast<const JSChar*>(string->characters());
+ }
+ 
+ size_t JSStringGetMaximumUTF8CStringSize(JSStringRef string)
+diff --git a/Source/JavaScriptCore/runtime/DateConversion.cpp b/Source/JavaScriptCore/runtime/DateConversion.cpp
+index 0b57f012d..05e27338b 100644
+--- a/Source/JavaScriptCore/runtime/DateConversion.cpp
++++ b/Source/JavaScriptCore/runtime/DateConversion.cpp
+@@ -107,7 +107,8 @@ String formatDateTime(const GregorianDateTime& t, DateTimeFormat format, bool as
+ #if OS(WINDOWS)
+             TIME_ZONE_INFORMATION timeZoneInformation;
+             GetTimeZoneInformation(&timeZoneInformation);
+-            const WCHAR* timeZoneName = t.isDST() ? timeZoneInformation.DaylightName : timeZoneInformation.StandardName;
++            const WCHAR* winTimeZoneName = t.isDST() ? timeZoneInformation.DaylightName : timeZoneInformation.StandardName;
++            String timeZoneName(reinterpret_cast<const UChar*>(winTimeZoneName));
+ #else
+             struct tm gtm = t;
+             char timeZoneName[70];
+diff --git a/Source/WTF/wtf/TypeTraits.h b/Source/WTF/wtf/TypeTraits.h
+index 9df2c95cf..f5d6121fd 100644
+--- a/Source/WTF/wtf/TypeTraits.h
++++ b/Source/WTF/wtf/TypeTraits.h
+@@ -72,6 +72,9 @@ namespace WTF {
+     template<> struct IsInteger<unsigned long>      { static const bool value = true; };
+     template<> struct IsInteger<long long>          { static const bool value = true; };
+     template<> struct IsInteger<unsigned long long> { static const bool value = true; };
++#if __cplusplus >= 201103L || defined(__GXX_EXPERIMENTAL_CXX0X__) || (defined(_HAS_CHAR16_T_LANGUAGE_SUPPORT) && _HAS_CHAR16_T_LANGUAGE_SUPPORT)
++    template<> struct IsInteger<char16_t>           { static const bool value = true; };
++#endif
+ #if !COMPILER(MSVC) || defined(_NATIVE_WCHAR_T_DEFINED)
+     template<> struct IsInteger<wchar_t>            { static const bool value = true; };
+ #endif
+diff --git a/Source/WebKit2/Shared/API/c/WKString.cpp b/Source/WebKit2/Shared/API/c/WKString.cpp
+index cbac67dd8..23400a64e 100644
+--- a/Source/WebKit2/Shared/API/c/WKString.cpp
++++ b/Source/WebKit2/Shared/API/c/WKString.cpp
+@@ -55,7 +55,7 @@ size_t WKStringGetLength(WKStringRef stringRef)
+ size_t WKStringGetCharacters(WKStringRef stringRef, WKChar* buffer, size_t bufferLength)
+ {
+     COMPILE_ASSERT(sizeof(WKChar) == sizeof(UChar), WKStringGetCharacters_sizeof_WKChar_matches_UChar);
+-    return (toImpl(stringRef)->getCharacters(static_cast<UChar*>(buffer), bufferLength));
++    return (toImpl(stringRef)->getCharacters(reinterpret_cast<UChar*>(buffer), bufferLength));
+ }
+ 
+ size_t WKStringGetMaximumUTF8CStringSize(WKStringRef stringRef)
+-- 
+2.13.3
+
recipes-qt/qt5/qtwebkit_git.bb +1 -0
index 4845d0f..3c52ef3 100644
@@ -22,6 +22,7 @@ SRC_URI += "\
     file://0001-qtwebkit-fix-QA-issue-bad-RPATH.patch \
     file://0002-Remove-TEXTREL-tag-in-x86.patch \
     file://0003-Exclude-backtrace-API-for-non-glibc-libraries.patch \
+    file://0004-Fix-compilation-with-ICU-59.patch \
 "
 
 PACKAGECONFIG ??= "gstreamer qtlocation qtmultimedia qtsensors qtwebchannel \
Signature · 1 line
2.13.3