summaryrefslogtreecommitdiffstats
path: root/src/corelib/global
diff options
context:
space:
mode:
Diffstat (limited to 'src/corelib/global')
-rw-r--r--src/corelib/global/qcompilerdetection.h1
-rw-r--r--src/corelib/global/qfloat16_f16c.c11
-rw-r--r--src/corelib/global/qglobal.cpp12
-rw-r--r--src/corelib/global/qglobal.h24
4 files changed, 31 insertions, 17 deletions
diff --git a/src/corelib/global/qcompilerdetection.h b/src/corelib/global/qcompilerdetection.h
index ebffe74188..412fea96b4 100644
--- a/src/corelib/global/qcompilerdetection.h
+++ b/src/corelib/global/qcompilerdetection.h
@@ -1371,6 +1371,7 @@
# undef QT_COMPILER_SUPPORTS_SSE4_2
# undef QT_COMPILER_SUPPORTS_AVX
# undef QT_COMPILER_SUPPORTS_AVX2
+# undef QT_COMPILER_SUPPORTS_F16C
#endif
#if !defined(Q_PROCESSOR_ARM)
# undef QT_COMPILER_SUPPORTS_NEON
diff --git a/src/corelib/global/qfloat16_f16c.c b/src/corelib/global/qfloat16_f16c.c
index ba1e16f481..d60a021bdb 100644
--- a/src/corelib/global/qfloat16_f16c.c
+++ b/src/corelib/global/qfloat16_f16c.c
@@ -40,13 +40,8 @@
#include "private/qsimd_p.h"
// The x86 F16C instructions operate on AVX registers, so AVX support is
-// required. We don't need to check for __F16C__ because we this file wouldn't
-// have been compiled if the support was missing in the first place, and not
-// all compilers define it. Technically, we didn't need to check for __AVX__
-// either.
-#if !QT_COMPILER_SUPPORTS_HERE(AVX)
-# error "AVX support required"
-#endif
+// required.
+#if QT_COMPILER_SUPPORTS_HERE(AVX)
#ifdef __cplusplus
QT_BEGIN_NAMESPACE
@@ -89,3 +84,5 @@ void qFloatFromFloat16_fast(float *out, const quint16 *in, qsizetype len) Q_DECL
} // extern "C"
QT_END_NAMESPACE
#endif
+
+#endif // QT_COMPILER_SUPPORTS_HERE(AVX)
diff --git a/src/corelib/global/qglobal.cpp b/src/corelib/global/qglobal.cpp
index fd8319aae0..ac2e85c51e 100644
--- a/src/corelib/global/qglobal.cpp
+++ b/src/corelib/global/qglobal.cpp
@@ -2264,7 +2264,17 @@ static const char *osVer_helper(QOperatingSystemVersion version = QOperatingSyst
case Q_WINVER(6, 3):
return workstation ? "8.1" : "Server 2012 R2";
case Q_WINVER(10, 0):
- return workstation ? "10" : "Server 2016";
+ if (workstation) {
+ if (osver.dwBuildNumber >= 22000)
+ return "11";
+ return "10";
+ }
+ // else: Server
+ if (osver.dwBuildNumber >= 20348)
+ return "Server 2022";
+ if (osver.dwBuildNumber >= 17763)
+ return "Server 2019";
+ return "Server 2016";
}
#undef Q_WINVER
// unknown, future version
diff --git a/src/corelib/global/qglobal.h b/src/corelib/global/qglobal.h
index 12ac48f3cb..450c1e586a 100644
--- a/src/corelib/global/qglobal.h
+++ b/src/corelib/global/qglobal.h
@@ -1102,13 +1102,16 @@ QForeachContainer<typename std::decay<T>::type> qMakeForeachContainer(T &&t)
}
+#define Q_FOREACH_JOIN(A, B) Q_FOREACH_JOIN_IMPL(A, B)
+#define Q_FOREACH_JOIN_IMPL(A, B) A ## B
+
#if __cplusplus >= 201703L
// Use C++17 if statement with initializer. User's code ends up in a else so
// scoping of different ifs is not broken
-#define Q_FOREACH(variable, container) \
-for (auto _container_ = QtPrivate::qMakeForeachContainer(container); \
- _container_.i != _container_.e; ++_container_.i) \
- if (variable = *_container_.i; false) {} else
+#define Q_FOREACH_IMPL(variable, name, container) \
+ for (auto name = QtPrivate::qMakeForeachContainer(container); \
+ name.i != name.e; ++name.i) \
+ if (variable = *name.i; false) {} else
#else
// Explanation of the control word:
// - it's initialized to 1
@@ -1119,12 +1122,15 @@ for (auto _container_ = QtPrivate::qMakeForeachContainer(container); \
// the outer loop to continue executing
// - if there was a break inside the inner loop, it will exit with control still
// set to 1; in that case, the outer loop will invert it to 0 and will exit too
-#define Q_FOREACH(variable, container) \
-for (auto _container_ = QtPrivate::qMakeForeachContainer(container); \
- _container_.control && _container_.i != _container_.e; \
- ++_container_.i, _container_.control ^= 1) \
- for (variable = *_container_.i; _container_.control; _container_.control = 0)
+#define Q_FOREACH_IMPL(variable, name, container) \
+for (auto name = QtPrivate::qMakeForeachContainer(container); \
+ name.control && name.i != name.e; \
+ ++name.i, name.control ^= 1) \
+ for (variable = *name.i; name.control; name.control = 0)
#endif
+
+#define Q_FOREACH(variable, container) \
+ Q_FOREACH_IMPL(variable, Q_FOREACH_JOIN(_container_, __LINE__), container)
#endif // QT_NO_FOREACH
#define Q_FOREVER for(;;)