diff options
author | Tor Arne Vestbø <tor.arne.vestbo@qt.io> | 2018-08-24 15:41:42 +0200 |
---|---|---|
committer | Tor Arne Vestbø <tor.arne.vestbo@qt.io> | 2018-08-31 12:35:45 +0000 |
commit | b02fe1bfe7bc5daa503dc3a274570aad0d8dca5a (patch) | |
tree | fe7ee1d385fd4da060d48569df721554f94db56e /src/corelib | |
parent | 29c0377f07f4942f9957ea87d59c252148dc9e5b (diff) |
Remove codepaths and checks for unsupported Apple platforms
We no longer support macOS 10.11, iOS/tvOS 10, or watchOS 3.
Change-Id: Ide03d8fac06185ef4162ba75ee54a0adf6916905
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
Diffstat (limited to 'src/corelib')
-rw-r--r-- | src/corelib/global/qlogging.cpp | 3 | ||||
-rw-r--r-- | src/corelib/io/qfilesystemengine_unix.cpp | 32 | ||||
-rw-r--r-- | src/corelib/kernel/qcore_mac_p.h | 79 |
3 files changed, 28 insertions, 86 deletions
diff --git a/src/corelib/global/qlogging.cpp b/src/corelib/global/qlogging.cpp index 2aabaa2ffb..9f47b8eb98 100644 --- a/src/corelib/global/qlogging.cpp +++ b/src/corelib/global/qlogging.cpp @@ -1768,8 +1768,7 @@ static void qDefaultMessageHandler(QtMsgType type, const QMessageLogContext &con # elif defined(Q_OS_ANDROID) && !defined(Q_OS_ANDROID_EMBEDDED) handledStderr |= android_default_message_handler(type, context, message); # elif defined(QT_USE_APPLE_UNIFIED_LOGGING) - if (__builtin_available(macOS 10.12, iOS 10, tvOS 10, watchOS 3, *)) - handledStderr |= AppleUnifiedLogger::messageHandler(type, context, message); + handledStderr |= AppleUnifiedLogger::messageHandler(type, context, message); # elif defined Q_OS_WASM handledStderr |= wasm_default_message_handler(type, context, message); # endif diff --git a/src/corelib/io/qfilesystemengine_unix.cpp b/src/corelib/io/qfilesystemengine_unix.cpp index eebf36416e..0159bc4128 100644 --- a/src/corelib/io/qfilesystemengine_unix.cpp +++ b/src/corelib/io/qfilesystemengine_unix.cpp @@ -76,9 +76,7 @@ #endif #if defined(Q_OS_DARWIN) -# if QT_DARWIN_PLATFORM_SDK_EQUAL_OR_ABOVE(101200, 100000, 100000, 30000) -# include <sys/clonefile.h> -# endif +# include <sys/clonefile.h> # include <copyfile.h> // We cannot include <Foundation/Foundation.h> (it's an Objective-C header), but // we need these declarations: @@ -1258,20 +1256,18 @@ bool QFileSystemEngine::createLink(const QFileSystemEntry &source, const QFileSy //static bool QFileSystemEngine::copyFile(const QFileSystemEntry &source, const QFileSystemEntry &target, QSystemError &error) { -#if QT_DARWIN_PLATFORM_SDK_EQUAL_OR_ABOVE(101200, 100000, 100000, 30000) - if (__builtin_available(macOS 10.12, iOS 10, tvOS 10, watchOS 3, *)) { - if (::clonefile(source.nativeFilePath().constData(), - target.nativeFilePath().constData(), 0) == 0) - return true; - error = QSystemError(errno, QSystemError::StandardLibraryError); - return false; - } +#if defined(Q_OS_DARWIN) + if (::clonefile(source.nativeFilePath().constData(), + target.nativeFilePath().constData(), 0) == 0) + return true; + error = QSystemError(errno, QSystemError::StandardLibraryError); + return false; #else Q_UNUSED(source); Q_UNUSED(target); -#endif error = QSystemError(ENOSYS, QSystemError::StandardLibraryError); //Function not implemented return false; +#endif } //static @@ -1295,13 +1291,11 @@ bool QFileSystemEngine::renameFile(const QFileSystemEntry &source, const QFileSy } #endif #if defined(Q_OS_DARWIN) && defined(RENAME_EXCL) - if (__builtin_available(macOS 10.12, iOS 10, tvOS 10, watchOS 3, *)) { - if (renameatx_np(AT_FDCWD, srcPath, AT_FDCWD, tgtPath, RENAME_EXCL) == 0) - return true; - if (errno != ENOTSUP) { - error = QSystemError(errno, QSystemError::StandardLibraryError); - return false; - } + if (renameatx_np(AT_FDCWD, srcPath, AT_FDCWD, tgtPath, RENAME_EXCL) == 0) + return true; + if (errno != ENOTSUP) { + error = QSystemError(errno, QSystemError::StandardLibraryError); + return false; } #endif diff --git a/src/corelib/kernel/qcore_mac_p.h b/src/corelib/kernel/qcore_mac_p.h index 8f2714aa12..b14a494296 100644 --- a/src/corelib/kernel/qcore_mac_p.h +++ b/src/corelib/kernel/qcore_mac_p.h @@ -59,36 +59,6 @@ // -------------------------------------------------------------------------- -#if !defined(QT_BOOTSTRAPPED) && (QT_MACOS_PLATFORM_SDK_EQUAL_OR_ABOVE(__MAC_10_12) || !defined(Q_OS_MACOS)) -#define QT_USE_APPLE_ACTIVITIES - -#if defined(OS_ACTIVITY_OBJECT_API) -#error The file <os/activity.h> has already been included -#endif - -// We runtime-check all use of the activity APIs, so we can safely build -// with them included, even if the deployment target is macOS 10.11 -#if QT_MACOS_DEPLOYMENT_TARGET_BELOW(__MAC_10_12) -#undef __MAC_OS_X_VERSION_MIN_REQUIRED -#define __MAC_OS_X_VERSION_MIN_REQUIRED __MAC_10_12 -#define DID_OVERRIDE_DEPLOYMENT_TARGET -#endif - -#include <os/activity.h> -#if !OS_ACTIVITY_OBJECT_API -#error "Expected activity API to be available" -#endif - -#if defined(DID_OVERRIDE_DEPLOYMENT_TARGET) -#undef __MAC_OS_X_VERSION_MIN_REQUIRED -#define __MAC_OS_X_VERSION_MIN_REQUIRED __MAC_10_11 -#undef DID_OVERRIDE_DEPLOYMENT_TARGET -#endif - -#endif - -// -------------------------------------------------------------------------- - #if defined(QT_BOOTSTRAPPED) #include <ApplicationServices/ApplicationServices.h> #else @@ -220,41 +190,31 @@ Q_CORE_EXPORT AppleApplication *qt_apple_sharedApplication(); // -------------------------------------------------------------------------- -#if !defined(QT_BOOTSTRAPPED) && (QT_MACOS_PLATFORM_SDK_EQUAL_OR_ABOVE(__MAC_10_12) || !defined(Q_OS_MACOS)) +#if !defined(QT_BOOTSTRAPPED) #define QT_USE_APPLE_UNIFIED_LOGGING QT_END_NAMESPACE #include <os/log.h> - -// The compiler isn't smart enough to realize that we're calling these functions -// guarded by __builtin_available, so we need to also tag each function with the -// runtime requirements. -#include <os/availability.h> -#define OS_LOG_AVAILABILITY API_AVAILABLE(macos(10.12), ios(10.0), tvos(10.0), watchos(3.0)) QT_BEGIN_NAMESPACE class Q_CORE_EXPORT AppleUnifiedLogger { public: static bool messageHandler(QtMsgType msgType, const QMessageLogContext &context, const QString &message, - const QString &subsystem = QString()) OS_LOG_AVAILABILITY; + const QString &subsystem = QString()); private: - static os_log_type_t logTypeForMessageType(QtMsgType msgType) OS_LOG_AVAILABILITY; - static os_log_t cachedLog(const QString &subsystem, const QString &category) OS_LOG_AVAILABILITY; + static os_log_type_t logTypeForMessageType(QtMsgType msgType); + static os_log_t cachedLog(const QString &subsystem, const QString &category); }; -#undef OS_LOG_AVAILABILITY - #endif // -------------------------------------------------------------------------- -#if defined(QT_USE_APPLE_ACTIVITIES) +#if !defined(QT_BOOTSTRAPPED) QT_END_NAMESPACE -#include <os/availability.h> -#define OS_ACTIVITY_AVAILABILITY API_AVAILABLE(macos(10.12), ios(10.0), tvos(10.0), watchos(3.0)) -#define OS_ACTIVITY_AVAILABILITY_CHECK __builtin_available(macOS 10.12, iOS 10, tvOS 10, watchOS 3, *) +#include <os/activity.h> QT_BEGIN_NAMESPACE template <typename T> using QAppleOsType = QAppleRefCounted<T, void *, os_retain, os_release>; @@ -263,7 +223,7 @@ class Q_CORE_EXPORT QAppleLogActivity { public: QAppleLogActivity() : activity(nullptr) {} - QAppleLogActivity(os_activity_t activity) OS_ACTIVITY_AVAILABILITY : activity(activity) {} + QAppleLogActivity(os_activity_t activity) : activity(activity) {} ~QAppleLogActivity() { if (activity) leave(); } QAppleLogActivity(const QAppleLogActivity &) = delete; @@ -284,21 +244,17 @@ public: QAppleLogActivity&& enter() { - if (activity) { - if (OS_ACTIVITY_AVAILABILITY_CHECK) - os_activity_scope_enter(static_cast<os_activity_t>(*this), &state); - } + if (activity) + os_activity_scope_enter(static_cast<os_activity_t>(*this), &state); return std::move(*this); } void leave() { - if (activity) { - if (OS_ACTIVITY_AVAILABILITY_CHECK) - os_activity_scope_leave(&state); - } + if (activity) + os_activity_scope_leave(&state); } - operator os_activity_t() OS_ACTIVITY_AVAILABILITY + operator os_activity_t() { return reinterpret_cast<os_activity_t>(static_cast<void *>(activity)); } @@ -312,9 +268,7 @@ private: #define QT_APPLE_LOG_ACTIVITY_CREATE(condition, description, parent) []() { \ if (!(condition)) \ return QAppleLogActivity(); \ - if (OS_ACTIVITY_AVAILABILITY_CHECK) \ - return QAppleLogActivity(os_activity_create(description, parent, OS_ACTIVITY_FLAG_DEFAULT)); \ - return QAppleLogActivity(); \ + return QAppleLogActivity(os_activity_create(description, parent, OS_ACTIVITY_FLAG_DEFAULT)); \ }() #define QT_VA_ARGS_CHOOSE(_1, _2, _3, _4, _5, _6, _7, _8, _9, N, ...) N @@ -335,12 +289,7 @@ QT_MAC_WEAK_IMPORT(_os_activity_current); #define QT_APPLE_SCOPED_LOG_ACTIVITY(...) QAppleLogActivity scopedLogActivity = QT_APPLE_LOG_ACTIVITY(__VA_ARGS__).enter(); -#else -// No-ops for macOS 10.11. We don't need to provide QT_APPLE_SCOPED_LOG_ACTIVITY, -// as all the call sites for that are in code that's only built on 10.12 and above. -#define QT_APPLE_LOG_ACTIVITY_WITH_PARENT(...) -#define QT_APPLE_LOG_ACTIVITY(...) -#endif // QT_DARWIN_PLATFORM_SDK_EQUAL_OR_ABOVE +#endif // !defined(QT_BOOTSTRAPPED) // ------------------------------------------------------------------------- |