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>
This commit is contained in:
parent
5b0f59c73d
commit
5081fd6887
@ -1169,18 +1169,9 @@ bool qSharedBuild() Q_DECL_NOTHROW
|
||||
\macro Q_OS_DARWIN
|
||||
\relates <QtGlobal>
|
||||
|
||||
Defined on Darwin-based operating systems such as OS X and iOS,
|
||||
including any open source version(s) of Darwin.
|
||||
Defined on Darwin-based operating systems such as OS X and iOS.
|
||||
*/
|
||||
|
||||
/*!
|
||||
\macro Q_OS_MAC
|
||||
\relates <QtGlobal>
|
||||
|
||||
Defined on Darwin-based operating systems distributed by Apple, which
|
||||
currently includes OS X and iOS, but not the open source versions of Darwin.
|
||||
*/
|
||||
|
||||
/*!
|
||||
\macro Q_OS_OSX
|
||||
\relates <QtGlobal>
|
||||
|
@ -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>
|
||||
|
Loading…
Reference in New Issue
Block a user