summaryrefslogtreecommitdiffstats
path: root/src/corelib/global
diff options
context:
space:
mode:
Diffstat (limited to 'src/corelib/global')
-rw-r--r--src/corelib/global/qcompilerdetection.h18
-rw-r--r--src/corelib/global/qfloat16.h17
-rw-r--r--src/corelib/global/qglobal.cpp24
-rw-r--r--src/corelib/global/qglobal.h18
-rw-r--r--src/corelib/global/qsysinfo.h1
5 files changed, 44 insertions, 34 deletions
diff --git a/src/corelib/global/qcompilerdetection.h b/src/corelib/global/qcompilerdetection.h
index fcfe020509..5fc7ac9c7e 100644
--- a/src/corelib/global/qcompilerdetection.h
+++ b/src/corelib/global/qcompilerdetection.h
@@ -172,7 +172,11 @@
/* Clang also masquerades as GCC */
# if defined(__apple_build_version__)
# /* http://en.wikipedia.org/wiki/Xcode#Toolchain_Versions */
-# if __apple_build_version__ >= 7000053
+# if __apple_build_version__ >= 8020041
+# define Q_CC_CLANG 309
+# elif __apple_build_version__ >= 8000038
+# define Q_CC_CLANG 308
+# elif __apple_build_version__ >= 7000053
# define Q_CC_CLANG 306
# elif __apple_build_version__ >= 6000051
# define Q_CC_CLANG 305
@@ -628,10 +632,7 @@
# define Q_COMPILER_ALIGNAS
# define Q_COMPILER_ALIGNOF
# define Q_COMPILER_INHERITING_CONSTRUCTORS
-# ifndef Q_OS_OSX
-// C++11 thread_local is broken on OS X (Clang doesn't support it either)
-# define Q_COMPILER_THREAD_LOCAL
-# endif
+# define Q_COMPILER_THREAD_LOCAL
# define Q_COMPILER_UDL
# endif
# ifdef _MSC_VER
@@ -993,6 +994,10 @@
# endif /* __cplusplus */
#endif /* Q_CC_MSVC */
+#ifdef Q_COMPILER_UNICODE_STRINGS
+# define Q_STDLIB_UNICODE_STRINGS
+#endif
+
#ifdef __cplusplus
# include <utility>
# if defined(Q_OS_QNX)
@@ -1015,8 +1020,9 @@
# undef Q_COMPILER_INITIALIZER_LISTS
# undef Q_COMPILER_RVALUE_REFS
# undef Q_COMPILER_REF_QUALIFIERS
-# undef Q_COMPILER_UNICODE_STRINGS
# undef Q_COMPILER_NOEXCEPT
+// Disable C++11 library features:
+# undef Q_STDLIB_UNICODE_STRINGS
# endif // !_HAS_CPP0X
# if !defined(_HAS_NULLPTR_T) || !_HAS_NULLPTR_T
# undef Q_COMPILER_NULLPTR
diff --git a/src/corelib/global/qfloat16.h b/src/corelib/global/qfloat16.h
index 05b88e0e92..b0272c51c3 100644
--- a/src/corelib/global/qfloat16.h
+++ b/src/corelib/global/qfloat16.h
@@ -81,18 +81,18 @@ private:
Q_DECLARE_TYPEINFO(qfloat16, Q_PRIMITIVE_TYPE);
-Q_CORE_EXPORT Q_REQUIRED_RESULT bool qIsInf(qfloat16 f) Q_DECL_NOTHROW; // complements qnumeric.h
-Q_CORE_EXPORT Q_REQUIRED_RESULT bool qIsNaN(qfloat16 f) Q_DECL_NOTHROW; // complements qnumeric.h
-Q_CORE_EXPORT Q_REQUIRED_RESULT bool qIsFinite(qfloat16 f) Q_DECL_NOTHROW; // complements qnumeric.h
+Q_REQUIRED_RESULT Q_CORE_EXPORT bool qIsInf(qfloat16 f) Q_DECL_NOTHROW; // complements qnumeric.h
+Q_REQUIRED_RESULT Q_CORE_EXPORT bool qIsNaN(qfloat16 f) Q_DECL_NOTHROW; // complements qnumeric.h
+Q_REQUIRED_RESULT Q_CORE_EXPORT bool qIsFinite(qfloat16 f) Q_DECL_NOTHROW; // complements qnumeric.h
// The remainder of these utility functions complement qglobal.h
-inline Q_REQUIRED_RESULT int qRound(qfloat16 d) Q_DECL_NOTHROW
+Q_REQUIRED_RESULT inline int qRound(qfloat16 d) Q_DECL_NOTHROW
{ return qRound(static_cast<float>(d)); }
-inline Q_REQUIRED_RESULT qint64 qRound64(qfloat16 d) Q_DECL_NOTHROW
+Q_REQUIRED_RESULT inline qint64 qRound64(qfloat16 d) Q_DECL_NOTHROW
{ return qRound64(static_cast<float>(d)); }
-inline Q_REQUIRED_RESULT bool qFuzzyCompare(qfloat16 p1, qfloat16 p2) Q_DECL_NOTHROW
+Q_REQUIRED_RESULT inline bool qFuzzyCompare(qfloat16 p1, qfloat16 p2) Q_DECL_NOTHROW
{
float f1 = static_cast<float>(p1);
float f2 = static_cast<float>(p2);
@@ -105,7 +105,7 @@ inline Q_REQUIRED_RESULT bool qFuzzyCompare(qfloat16 p1, qfloat16 p2) Q_DECL_NOT
return (qAbs(f1 - f2) * 102.5f <= qMin(qAbs(f1), qAbs(f2)));
}
-inline Q_REQUIRED_RESULT bool qIsNull(qfloat16 f) Q_DECL_NOTHROW
+Q_REQUIRED_RESULT inline bool qIsNull(qfloat16 f) Q_DECL_NOTHROW
{
return (f.b16 & static_cast<quint16>(0x7fff)) == 0;
}
@@ -115,6 +115,7 @@ inline int qIntCast(qfloat16 f) Q_DECL_NOTHROW
QT_WARNING_PUSH
QT_WARNING_DISABLE_CLANG("-Wc99-extensions")
+QT_WARNING_DISABLE_GCC("-Wold-style-cast")
inline qfloat16::qfloat16(float f) Q_DECL_NOTHROW
{
#if defined(QT_COMPILER_SUPPORTS_F16C) && (defined(__F16C__) || defined(__AVX2__))
@@ -246,7 +247,7 @@ QT_WARNING_POP
/*!
\internal
*/
-inline Q_REQUIRED_RESULT bool qFuzzyIsNull(qfloat16 f) Q_DECL_NOTHROW
+Q_REQUIRED_RESULT inline bool qFuzzyIsNull(qfloat16 f) Q_DECL_NOTHROW
{
return qAbs(static_cast<float>(f)) <= 0.001f;
}
diff --git a/src/corelib/global/qglobal.cpp b/src/corelib/global/qglobal.cpp
index e7bfbb2903..6de03d73b3 100644
--- a/src/corelib/global/qglobal.cpp
+++ b/src/corelib/global/qglobal.cpp
@@ -2643,12 +2643,14 @@ QString QSysInfo::kernelVersion()
to determine the distribution name and returns that. If determining the
distribution name failed, it returns "unknown".
- \b{Darwin, \macos, iOS, tvOS, and watchOS note}: this function returns
- "macos" for \macos systems, "ios" for iOS systems, "tvos" for tvOS systems,
- "watchos" for watchOS systems, and "darwin" in case the system could not
- be determined.
+ \b{\macos note}: this function returns "osx" for all \macos systems,
+ regardless of Apple naming convention. The returned string will be updated
+ for Qt 6. Note that this function erroneously returned "macos" for \macos
+ 10.12 in Qt versions 5.6.2, 5.7.1, and 5.8.0.
- \b{OS X note}: this function returns "osx" for versions of \macos prior to 10.12.
+ \b{Darwin, iOS, tvOS, and watchOS note}: this function returns "ios" for
+ iOS systems, "tvos" for tvOS systems, "watchos" for watchOS systems, and
+ "darwin" in case the system could not be determined.
\b{FreeBSD note}: this function returns "debian" for Debian/kFreeBSD and
"unknown" otherwise.
@@ -2681,10 +2683,12 @@ QString QSysInfo::productType()
#elif defined(Q_OS_WATCHOS)
return QStringLiteral("watchos");
#elif defined(Q_OS_MACOS)
- const auto version = QOperatingSystemVersion::current();
- if (version.majorVersion() == 10 && version.minorVersion() < 12)
- return QStringLiteral("osx");
+ // ### Qt6: remove fallback
+# if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
return QStringLiteral("macos");
+# else
+ return QStringLiteral("osx");
+# endif
#elif defined(Q_OS_DARWIN)
return QStringLiteral("darwin");
@@ -3198,12 +3202,16 @@ static QBasicMutex environmentMutex;
Returns the value of the environment variable with name \a
varName. To get the variable string, use QByteArray::constData().
+ To convert the data to a QString use QString::fromLocal8Bit().
\note qgetenv() was introduced because getenv() from the standard
C library was deprecated in VC2005 (and later versions). qgetenv()
uses the new replacement function in VC, and calls the standard C
library's implementation on all other platforms.
+ \warning Don't use qgetenv on Windows if the content may contain
+ non-US-ASCII characters, like file paths.
+
\sa qputenv(), qEnvironmentVariableIsSet(), qEnvironmentVariableIsEmpty()
*/
QByteArray qgetenv(const char *varName)
diff --git a/src/corelib/global/qglobal.h b/src/corelib/global/qglobal.h
index 49577caba2..e04d9fdefa 100644
--- a/src/corelib/global/qglobal.h
+++ b/src/corelib/global/qglobal.h
@@ -783,26 +783,22 @@ typedef void (*QFunctionPointer)();
# define Q_UNIMPLEMENTED() qWarning("Unimplemented code.")
#endif
-Q_DECL_CONSTEXPR static inline bool qFuzzyCompare(double p1, double p2) Q_REQUIRED_RESULT Q_DECL_UNUSED;
-Q_DECL_CONSTEXPR static inline bool qFuzzyCompare(double p1, double p2)
+Q_REQUIRED_RESULT Q_DECL_CONSTEXPR static inline Q_DECL_UNUSED bool qFuzzyCompare(double p1, double p2)
{
return (qAbs(p1 - p2) * 1000000000000. <= qMin(qAbs(p1), qAbs(p2)));
}
-Q_DECL_CONSTEXPR static inline bool qFuzzyCompare(float p1, float p2) Q_REQUIRED_RESULT Q_DECL_UNUSED;
-Q_DECL_CONSTEXPR static inline bool qFuzzyCompare(float p1, float p2)
+Q_REQUIRED_RESULT Q_DECL_CONSTEXPR static inline Q_DECL_UNUSED bool qFuzzyCompare(float p1, float p2)
{
return (qAbs(p1 - p2) * 100000.f <= qMin(qAbs(p1), qAbs(p2)));
}
-Q_DECL_CONSTEXPR static inline bool qFuzzyIsNull(double d) Q_REQUIRED_RESULT Q_DECL_UNUSED;
-Q_DECL_CONSTEXPR static inline bool qFuzzyIsNull(double d)
+Q_REQUIRED_RESULT Q_DECL_CONSTEXPR static inline Q_DECL_UNUSED bool qFuzzyIsNull(double d)
{
return qAbs(d) <= 0.000000000001;
}
-Q_DECL_CONSTEXPR static inline bool qFuzzyIsNull(float f) Q_REQUIRED_RESULT Q_DECL_UNUSED;
-Q_DECL_CONSTEXPR static inline bool qFuzzyIsNull(float f)
+Q_REQUIRED_RESULT Q_DECL_CONSTEXPR static inline Q_DECL_UNUSED bool qFuzzyIsNull(float f)
{
return qAbs(f) <= 0.00001f;
}
@@ -812,8 +808,7 @@ Q_DECL_CONSTEXPR static inline bool qFuzzyIsNull(float f)
check whether the actual value is 0 or close to 0, but whether
it is binary 0, disregarding sign.
*/
-static inline bool qIsNull(double d) Q_REQUIRED_RESULT Q_DECL_UNUSED;
-static inline bool qIsNull(double d)
+Q_REQUIRED_RESULT static inline Q_DECL_UNUSED bool qIsNull(double d)
{
union U {
double d;
@@ -829,8 +824,7 @@ static inline bool qIsNull(double d)
check whether the actual value is 0 or close to 0, but whether
it is binary 0, disregarding sign.
*/
-static inline bool qIsNull(float f) Q_REQUIRED_RESULT Q_DECL_UNUSED;
-static inline bool qIsNull(float f)
+Q_REQUIRED_RESULT static inline Q_DECL_UNUSED bool qIsNull(float f)
{
union U {
float f;
diff --git a/src/corelib/global/qsysinfo.h b/src/corelib/global/qsysinfo.h
index ff0a784ace..f443ab4b93 100644
--- a/src/corelib/global/qsysinfo.h
+++ b/src/corelib/global/qsysinfo.h
@@ -213,6 +213,7 @@ public:
QT_WARNING_PUSH
QT_WARNING_DISABLE_GCC("-Wdeprecated-declarations")
QT_WARNING_DISABLE_CLANG("-Wdeprecated-declarations")
+QT_WARNING_DISABLE_INTEL(1478)
QT_WARNING_DISABLE_INTEL(1786)
QT_WARNING_DISABLE_MSVC(4996)
#if defined(Q_OS_WIN) || defined(Q_OS_CYGWIN)