From 1184b79381c4dd12a46ad1065becfa48203b1f4d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Wed, 8 Jul 2020 13:52:36 +0200 Subject: [PATCH] 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. Task-number: QTBUG-85279 Change-Id: Iac94f59a863c7be1860b51def0fc2de2d8812cf8 Reviewed-by: Timur Pocheptsov (cherry picked from commit b10f8ba3506c6c8c941826aee0225192aa4cd1af) Reviewed-by: Qt Cherry-pick Bot --- src/plugins/platforms/cocoa/qcocoahelpers.h | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/plugins/platforms/cocoa/qcocoahelpers.h b/src/plugins/platforms/cocoa/qcocoahelpers.h index 69aa7937b66..2aaff8c4ce9 100644 --- a/src/plugins/platforms/cocoa/qcocoahelpers.h +++ b/src/plugins/platforms/cocoa/qcocoahelpers.h @@ -254,14 +254,16 @@ template 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 }; @@ -281,6 +283,7 @@ ReturnType qt_msgSendSuper(id receiver, SEL selector, Args... args) return superFn(&sup, selector, args...); } +#if PLATFORM_USES_SEND_SUPER_STRET template ReturnType qt_msgSendSuper_stret(id receiver, SEL selector, Args... args) { @@ -295,6 +298,7 @@ ReturnType qt_msgSendSuper_stret(id receiver, SEL selector, Args... args) superStretFn(&ret, &sup, selector, args...); return ret; } +#endif template class QSendSuperHelper { @@ -335,11 +339,13 @@ private: return qt_msgSendSuper(m_receiver, m_selector, std::get(args)...); } +#if PLATFORM_USES_SEND_SUPER_STRET template if_requires_stret msgSendSuper(std::tuple& args, QtPrivate::IndexesList) { return qt_msgSendSuper_stret(m_receiver, m_selector, std::get(args)...); } +#endif template ReturnType msgSendSuper(std::tuple& args)