diff options
Diffstat (limited to 'src/corelib/global')
-rw-r--r-- | src/corelib/global/global.pri | 1 | ||||
-rw-r--r-- | src/corelib/global/qcompilerdetection.h | 67 | ||||
-rw-r--r-- | src/corelib/global/qglobal.cpp | 25 | ||||
-rw-r--r-- | src/corelib/global/qglobalstatic.qdoc (renamed from src/corelib/global/qglobalstatic.cpp) | 2 | ||||
-rw-r--r-- | src/corelib/global/qlogging.cpp | 2 | ||||
-rw-r--r-- | src/corelib/global/qoperatingsystemversion.cpp | 8 | ||||
-rw-r--r-- | src/corelib/global/qoperatingsystemversion.h | 1 |
7 files changed, 51 insertions, 55 deletions
diff --git a/src/corelib/global/global.pri b/src/corelib/global/global.pri index b95cdaa014..a087452d06 100644 --- a/src/corelib/global/global.pri +++ b/src/corelib/global/global.pri @@ -29,7 +29,6 @@ HEADERS += \ SOURCES += \ global/archdetect.cpp \ global/qglobal.cpp \ - global/qglobalstatic.cpp \ global/qlibraryinfo.cpp \ global/qmalloc.cpp \ global/qnumeric.cpp \ diff --git a/src/corelib/global/qcompilerdetection.h b/src/corelib/global/qcompilerdetection.h index c221115e8f..9ffd164b61 100644 --- a/src/corelib/global/qcompilerdetection.h +++ b/src/corelib/global/qcompilerdetection.h @@ -1061,6 +1061,37 @@ #endif /* + * SG10's SD-6 feature detection and some useful extensions from Clang and GCC + * https://isocpp.org/std/standing-documents/sd-6-sg10-feature-test-recommendations + * http://clang.llvm.org/docs/LanguageExtensions.html#feature-checking-macros + */ +#ifdef __has_builtin +# define QT_HAS_BUILTIN(x) __has_builtin(x) +#else +# define QT_HAS_BUILTIN(x) 0 +#endif +#ifdef __has_attribute +# define QT_HAS_ATTRIBUTE(x) __has_attribute(x) +#else +# define QT_HAS_ATTRIBUTE(x) 0 +#endif +#ifdef __has_cpp_attribute +# define QT_HAS_CPP_ATTRIBUTE(x) __has_cpp_attribute(x) +#else +# define QT_HAS_CPP_ATTRIBUTE(x) 0 +#endif +#ifdef __has_include +# define QT_HAS_INCLUDE(x) __has_include(x) +#else +# define QT_HAS_INCLUDE(x) 0 +#endif +#ifdef __has_include_next +# define QT_HAS_INCLUDE_NEXT(x) __has_include_next(x) +#else +# define QT_HAS_INCLUDE_NEXT(x) 0 +#endif + +/* * C++11 keywords and expressions */ #ifdef Q_COMPILER_NULLPTR @@ -1141,6 +1172,11 @@ # define Q_DECL_ALIGN(n) alignas(n) #endif +#if QT_HAS_CPP_ATTRIBUTE(nodiscard) // P0188R1 +# undef Q_REQUIRED_RESULT +# define Q_REQUIRED_RESULT [[nodiscard]] +#endif + /* * Fallback macros to certain compiler features */ @@ -1215,37 +1251,6 @@ #ifndef QT_MAKE_CHECKED_ARRAY_ITERATOR # define QT_MAKE_CHECKED_ARRAY_ITERATOR(x, N) (x) #endif - -/* - * SG10's SD-6 feature detection and some useful extensions from Clang and GCC - * https://isocpp.org/std/standing-documents/sd-6-sg10-feature-test-recommendations - * http://clang.llvm.org/docs/LanguageExtensions.html#feature-checking-macros - */ -#ifdef __has_builtin -# define QT_HAS_BUILTIN(x) __has_builtin(x) -#else -# define QT_HAS_BUILTIN(x) 0 -#endif -#ifdef __has_attribute -# define QT_HAS_ATTRIBUTE(x) __has_attribute(x) -#else -# define QT_HAS_ATTRIBUTE(x) 0 -#endif -#ifdef __has_cpp_attribute -# define QT_HAS_CPP_ATTRIBUTE(x) __has_cpp_attribute(x) -#else -# define QT_HAS_CPP_ATTRIBUTE(x) 0 -#endif -#ifdef __has_include -# define QT_HAS_INCLUDE(x) __has_include(x) -#else -# define QT_HAS_INCLUDE(x) 0 -#endif -#ifdef __has_include_next -# define QT_HAS_INCLUDE_NEXT(x) __has_include_next(x) -#else -# define QT_HAS_INCLUDE_NEXT(x) 0 -#endif #ifdef __has_feature # define QT_HAS_FEATURE(x) __has_feature(x) #else diff --git a/src/corelib/global/qglobal.cpp b/src/corelib/global/qglobal.cpp index 4c1b210489..9c05b9650c 100644 --- a/src/corelib/global/qglobal.cpp +++ b/src/corelib/global/qglobal.cpp @@ -85,12 +85,6 @@ # include <sys/systeminfo.h> #endif -#if defined(Q_OS_DARWIN) -# include <mach/machine.h> -# include <sys/sysctl.h> -# include <sys/types.h> -#endif - #ifdef Q_OS_UNIX #include <sys/utsname.h> #include <private/qcore_unix_p.h> @@ -2057,6 +2051,8 @@ static const char *osVer_helper(QOperatingSystemVersion version = QOperatingSyst return "El Capitan"; case 12: return "Sierra"; + case 13: + return "High Sierra"; } } // unknown, future version @@ -2489,20 +2485,9 @@ QString QSysInfo::currentCpuArchitecture() case PROCESSOR_ARCHITECTURE_IA64: return QStringLiteral("ia64"); } -#elif defined(Q_OS_DARWIN) - cpu_type_t type; - size_t size = sizeof(type); - sysctlbyname("hw.cputype", &type, &size, NULL, 0); - switch (type) { - case CPU_TYPE_X86: - return QStringLiteral("i386"); - case CPU_TYPE_X86_64: - return QStringLiteral("x86_64"); - case CPU_TYPE_ARM: - return QStringLiteral("arm"); - case CPU_TYPE_ARM64: - return QStringLiteral("arm64"); - } +#elif defined(Q_OS_DARWIN) && !defined(Q_OS_MACOS) + // iOS-based OSes do not return the architecture on uname(2)'s result. + return buildCpuArchitecture(); #elif defined(Q_OS_UNIX) long ret = -1; struct utsname u; diff --git a/src/corelib/global/qglobalstatic.cpp b/src/corelib/global/qglobalstatic.qdoc index d1c522a79a..8c34739d38 100644 --- a/src/corelib/global/qglobalstatic.cpp +++ b/src/corelib/global/qglobalstatic.qdoc @@ -37,8 +37,6 @@ ** ****************************************************************************/ -#include "qglobalstatic.h" - /*! \macro Q_GLOBAL_STATIC(Type, VariableName) \since 5.1 diff --git a/src/corelib/global/qlogging.cpp b/src/corelib/global/qlogging.cpp index a52f0de9f0..6602d53b08 100644 --- a/src/corelib/global/qlogging.cpp +++ b/src/corelib/global/qlogging.cpp @@ -274,7 +274,7 @@ Q_CORE_EXPORT bool qt_logging_to_console() \sa QMessageLogContext, qDebug(), qInfo(), qWarning(), qCritical(), qFatal() */ -#ifdef Q_OS_WIN +#if defined(Q_CC_MSVC) && defined(QT_DEBUG) && defined(_DEBUG) && defined(_CRT_ERROR) static inline void convert_to_wchar_t_elided(wchar_t *d, size_t space, const char *s) Q_DECL_NOEXCEPT { size_t len = qstrlen(s); diff --git a/src/corelib/global/qoperatingsystemversion.cpp b/src/corelib/global/qoperatingsystemversion.cpp index bed08f0000..244f294312 100644 --- a/src/corelib/global/qoperatingsystemversion.cpp +++ b/src/corelib/global/qoperatingsystemversion.cpp @@ -413,6 +413,14 @@ const QOperatingSystemVersion QOperatingSystemVersion::MacOSSierra = QOperatingSystemVersion(QOperatingSystemVersion::MacOS, 10, 12); /*! + \variable QOperatingSystemVersion::MacOSHighSierra + \brief a version corresponding to macOS High Sierra (version 10.13). + \since 5.9.1 + */ +const QOperatingSystemVersion QOperatingSystemVersion::MacOSHighSierra = + QOperatingSystemVersion(QOperatingSystemVersion::MacOS, 10, 13); + +/*! \variable QOperatingSystemVersion::AndroidJellyBean \brief a version corresponding to Android Jelly Bean (version 4.1, API level 16). \since 5.9 diff --git a/src/corelib/global/qoperatingsystemversion.h b/src/corelib/global/qoperatingsystemversion.h index cc14d701e1..295365aad1 100644 --- a/src/corelib/global/qoperatingsystemversion.h +++ b/src/corelib/global/qoperatingsystemversion.h @@ -69,6 +69,7 @@ public: static const QOperatingSystemVersion OSXYosemite; static const QOperatingSystemVersion OSXElCapitan; static const QOperatingSystemVersion MacOSSierra; + static const QOperatingSystemVersion MacOSHighSierra; static const QOperatingSystemVersion AndroidJellyBean; static const QOperatingSystemVersion AndroidJellyBean_MR1; |