summaryrefslogtreecommitdiffstats
path: root/src/corelib/global/qsystemdetection.h
diff options
context:
space:
mode:
authorJake Petroules <jake.petroules@theqtcompany.com>2015-09-10 00:59:29 -0700
committerJake Petroules <jake.petroules@theqtcompany.com>2015-09-15 07:04:16 +0000
commit5081fd68870b71ba4f2a31cff475b0c46a75f364 (patch)
treeab693f4c1c00ef9bd35c2c4c7f6e3d9d4fde6015 /src/corelib/global/qsystemdetection.h
parent5b0f59c73d46bae10c5c22b270c0f7ef6ffff20c (diff)
Deprecate Q_OS_MAC.
Justification: intuition indicates that Q_OS_MAC refers to OS X. Reality indicates it refers to OS X, iOS, watchOS, and tvOS. Technical correctness requires that it match reality. Backwards compatibility dictates it can't be changed anyways. Conclusion: an extremely confusing macro that no one knows how to use properly. When Q_OS_MACX was repurposed for OS X (and later, Q_OS_OSX introduced), Q_OS_MAC was kept around to allow differentation between Q_OS_DARWIN (the grandfather OS of everything - OS X, iOS, watchOS, tvOS, and theoretically "open source Darwin derivative"). However, given that every attempt at a non-Apple Darwin based operating system has failed and sees virtually no interest at scale, this distinction is not useful in Qt for the confusion it causes in return, especially considering that there are several cases in Qt where Q_OS_MAC should be Q_OS_DARWIN or vice versa, and sometimes the correct macro is not even entirely clear. Therefore, Q_OS_MAC can be deprecated. In the extremely unlikely case that differentiation between Darwin core, and commercial Darwin-based operating systems from Apple is required, I suggest introducing Q_OS_APPLE (a superset of Q_OS_DARWIN, and subset of Q_OS_OSX, Q_OS_IOS, Q_OS_WATCHOS, and Q_OS_TVOS). Until it is needed, Darwin, OS X, iOS, watchOS, and tvOS defines should be perfectly sufficient for every real-world use case. Change-Id: Id6df8c1102010b61cfe001ed41a76809bc166863 Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@theqtcompany.com> Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@theqtcompany.com> Reviewed-by: Morten Johan Sørvig <morten.sorvig@theqtcompany.com>
Diffstat (limited to 'src/corelib/global/qsystemdetection.h')
-rw-r--r--src/corelib/global/qsystemdetection.h45
1 files changed, 27 insertions, 18 deletions
diff --git a/src/corelib/global/qsystemdetection.h b/src/corelib/global/qsystemdetection.h
index 562427e4b9..6d942a7217 100644
--- a/src/corelib/global/qsystemdetection.h
+++ b/src/corelib/global/qsystemdetection.h
@@ -41,8 +41,7 @@
/*
The operating system, must be one of: (Q_OS_x)
- DARWIN - Any Darwin system
- MAC - OS X and iOS
+ DARWIN - Any Darwin system (OS X, iOS)
OSX - OS X
IOS - iOS
MSDOS - MS-DOS and Windows
@@ -87,6 +86,8 @@
*/
#if defined(__APPLE__) && (defined(__GNUC__) || defined(__xlC__) || defined(__xlc__))
+# include <TargetConditionals.h>
+# if defined(TARGET_OS_MAC) && TARGET_OS_MAC
# define Q_OS_DARWIN
# define Q_OS_BSD4
# ifdef __LP64__
@@ -94,6 +95,16 @@
# else
# define Q_OS_DARWIN32
# endif
+# if defined(TARGET_OS_IPHONE) && TARGET_OS_IPHONE
+# define Q_OS_IOS
+# else
+# // there is no "real" OS X define (rdar://22640089),
+# // assume any non iOS-based platform is OS X for now
+# define Q_OS_OSX
+# endif
+# else
+# error "Qt has not been ported to this Apple platform - see http://www.qt.io/developers"
+# endif
#elif defined(ANDROID)
# define Q_OS_ANDROID
# define Q_OS_LINUX
@@ -181,28 +192,26 @@
# define Q_OS_WIN
#endif
-#if defined(Q_OS_DARWIN)
-# define Q_OS_MAC
-# if defined(Q_OS_DARWIN64)
-# define Q_OS_MAC64
-# elif defined(Q_OS_DARWIN32)
-# define Q_OS_MAC32
-# endif
-# include <TargetConditionals.h>
-# if defined(TARGET_OS_IPHONE) && TARGET_OS_IPHONE
-# define Q_OS_IOS
-# elif defined(TARGET_OS_MAC) && TARGET_OS_MAC
-# define Q_OS_OSX
-# define Q_OS_MACX // compatibility synonym
-# endif
-#endif
-
#if defined(Q_OS_WIN)
# undef Q_OS_UNIX
#elif !defined(Q_OS_UNIX)
# define Q_OS_UNIX
#endif
+// Compatibility synonyms
+#ifdef Q_OS_DARWIN
+#define Q_OS_MAC
+#endif
+#ifdef Q_OS_DARWIN32
+#define Q_OS_MAC32
+#endif
+#ifdef Q_OS_DARWIN64
+#define Q_OS_MAC64
+#endif
+#ifdef Q_OS_OSX
+#define Q_OS_MACX
+#endif
+
#ifdef Q_OS_DARWIN
# include <Availability.h>
# include <AvailabilityMacros.h>