diff options
author | Tor Arne Vestbø <tor.arne.vestbo@qt.io> | 2020-07-08 13:52:36 +0200 |
---|---|---|
committer | Tor Arne Vestbø <tor.arne.vestbo@qt.io> | 2020-07-08 19:18:02 +0200 |
commit | b10f8ba3506c6c8c941826aee0225192aa4cd1af (patch) | |
tree | cc4e756454cc7430ea2f8aa9259ef8237fd3681c /src/plugins/platforms/cocoa | |
parent | 03de9a41da039f79b9a8881e9c8c476b008d4d07 (diff) |
macOS: Don't assume platform has objc_msgSendSuper_stret
It's not used on arm64, and the template magic is not enough to
avoid compilation failures due to references to the undefined
function.
Pick-to: 5.15
Pick-to: 5.12
Task-number: QTBUG-85279
Change-Id: Iac94f59a863c7be1860b51def0fc2de2d8812cf8
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
Diffstat (limited to 'src/plugins/platforms/cocoa')
-rw-r--r-- | src/plugins/platforms/cocoa/qcocoahelpers.h | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/src/plugins/platforms/cocoa/qcocoahelpers.h b/src/plugins/platforms/cocoa/qcocoahelpers.h index 2e84abd739..bb187c9fa7 100644 --- a/src/plugins/platforms/cocoa/qcocoahelpers.h +++ b/src/plugins/platforms/cocoa/qcocoahelpers.h @@ -269,14 +269,16 @@ template <typename T> struct objc_msgsend_requires_stret { static const bool value = #if defined(Q_PROCESSOR_X86) + #define PLATFORM_USES_SEND_SUPER_STRET 1 // Any return value larger than two registers on i386/x86_64 sizeof(T) > sizeof(void*) * 2; #elif defined(Q_PROCESSOR_ARM_32) + #define PLATFORM_USES_SEND_SUPER_STRET 1 // Any return value larger than a single register on arm - sizeof(T) > sizeof(void*); + sizeof(T) > sizeof(void*); #elif defined(Q_PROCESSOR_ARM_64) - // Stret not used on arm64 - false; + #define PLATFORM_USES_SEND_SUPER_STRET 0 + false; // Stret not used on arm64 #endif }; @@ -296,6 +298,7 @@ ReturnType qt_msgSendSuper(id receiver, SEL selector, Args... args) return superFn(&sup, selector, args...); } +#if PLATFORM_USES_SEND_SUPER_STRET template <typename ReturnType, typename... Args> ReturnType qt_msgSendSuper_stret(id receiver, SEL selector, Args... args) { @@ -310,6 +313,7 @@ ReturnType qt_msgSendSuper_stret(id receiver, SEL selector, Args... args) superStretFn(&ret, &sup, selector, args...); return ret; } +#endif template<typename... Args> class QSendSuperHelper { @@ -350,11 +354,13 @@ private: return qt_msgSendSuper<ReturnType>(m_receiver, m_selector, std::get<Is>(args)...); } +#if PLATFORM_USES_SEND_SUPER_STRET template <typename ReturnType, int... Is> if_requires_stret<ReturnType, true> msgSendSuper(std::tuple<Args...>& args, QtPrivate::IndexesList<Is...>) { return qt_msgSendSuper_stret<ReturnType>(m_receiver, m_selector, std::get<Is>(args)...); } +#endif template <typename ReturnType> ReturnType msgSendSuper(std::tuple<Args...>& args) |