summaryrefslogtreecommitdiffstats
path: root/src/corelib/global
diff options
context:
space:
mode:
Diffstat (limited to 'src/corelib/global')
-rw-r--r--src/corelib/global/minimum-linux_p.h27
-rw-r--r--src/corelib/global/q20algorithm.h116
-rw-r--r--src/corelib/global/q20functional.h (renamed from src/corelib/global/minimum-linux.S)75
-rw-r--r--src/corelib/global/qcompilerdetection.h44
-rw-r--r--src/corelib/global/qconfig-bootstrapped.h2
-rw-r--r--src/corelib/global/qconfig.cpp.in4
-rw-r--r--src/corelib/global/qendian.h4
-rw-r--r--src/corelib/global/qfloat16.cpp42
-rw-r--r--src/corelib/global/qfloat16.h2
-rw-r--r--src/corelib/global/qfloat16_f16c.c88
-rw-r--r--src/corelib/global/qglobal.cpp194
-rw-r--r--src/corelib/global/qglobal.h31
-rw-r--r--src/corelib/global/qglobal_p.h5
-rw-r--r--src/corelib/global/qglobalstatic.h5
-rw-r--r--src/corelib/global/qlibraryinfo.cpp34
-rw-r--r--src/corelib/global/qlogging.cpp42
-rw-r--r--src/corelib/global/qnamespace.h1
-rw-r--r--src/corelib/global/qnamespace.qdoc15
-rw-r--r--src/corelib/global/qnativeinterface.h8
-rw-r--r--src/corelib/global/qoperatingsystemversion.cpp7
-rw-r--r--src/corelib/global/qoperatingsystemversion_win.cpp16
-rw-r--r--src/corelib/global/qprocessordetection.h4
-rw-r--r--src/corelib/global/qrandom.cpp4
-rw-r--r--src/corelib/global/qsimd_p.h5
-rw-r--r--src/corelib/global/qt_pch.h2
-rw-r--r--src/corelib/global/qtypeinfo.h19
-rw-r--r--src/corelib/global/qversiontagging.cpp1
27 files changed, 443 insertions, 354 deletions
diff --git a/src/corelib/global/minimum-linux_p.h b/src/corelib/global/minimum-linux_p.h
index 5112015663..291e6965b8 100644
--- a/src/corelib/global/minimum-linux_p.h
+++ b/src/corelib/global/minimum-linux_p.h
@@ -83,24 +83,25 @@ QT_BEGIN_NAMESPACE
// falls back to stat() for us.
// (Using QT_CONFIG(glibc) instead of __GLIBC__ because the macros aren't
// defined in assembler mode)
-# define MINLINUX_MAJOR 4
-# define MINLINUX_MINOR 11
-# define MINLINUX_PATCH 0
+# define QT_ELF_NOTE_OS_MAJOR 4
+# define QT_ELF_NOTE_OS_MINOR 11
+# define QT_ELF_NOTE_OS_PATCH 0
#elif QT_CONFIG(getentropy)
-# define MINLINUX_MAJOR 3
-# define MINLINUX_MINOR 17
-# define MINLINUX_PATCH 0
+# define QT_ELF_NOTE_OS_MAJOR 3
+# define QT_ELF_NOTE_OS_MINOR 17
+# define QT_ELF_NOTE_OS_PATCH 0
#elif QT_CONFIG(renameat2)
-# define MINLINUX_MAJOR 3
-# define MINLINUX_MINOR 16
-# define MINLINUX_PATCH 0
+# define QT_ELF_NOTE_OS_MAJOR 3
+# define QT_ELF_NOTE_OS_MINOR 16
+# define QT_ELF_NOTE_OS_PATCH 0
#else
-# define MINLINUX_MAJOR 2
-# define MINLINUX_MINOR 6
-# define MINLINUX_PATCH 28
+# define QT_ELF_NOTE_OS_MAJOR 2
+# define QT_ELF_NOTE_OS_MINOR 6
+# define QT_ELF_NOTE_OS_PATCH 28
#endif
-#define MINIMUM_LINUX_VERSION QT_VERSION_CHECK(MINLINUX_MAJOR, MINLINUX_MINOR, MINLINUX_PATCH)
+/* you must include <elf.h> */
+#define QT_ELF_NOTE_OS_TYPE ELF_NOTE_OS_LINUX
QT_END_NAMESPACE
diff --git a/src/corelib/global/q20algorithm.h b/src/corelib/global/q20algorithm.h
new file mode 100644
index 0000000000..3024e89c6d
--- /dev/null
+++ b/src/corelib/global/q20algorithm.h
@@ -0,0 +1,116 @@
+/****************************************************************************
+**
+** Copyright (C) 2021 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com, author Marc Mutz <marc.mutz@kdab.com>
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the QtCore module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#ifndef Q20ALGORITHM_H
+#define Q20ALGORITHM_H
+
+#include <QtCore/qglobal.h>
+
+#include <algorithm>
+#include <QtCore/q20functional.h>
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. Types and functions defined
+// in this file will behave exactly as their std counterparts. You
+// may use these definitions in your own code, but be aware that we
+// will remove them once Qt depends on the C++ version that supports
+// them in namespace std. There will be NO deprecation warning, the
+// definitions will JUST go away.
+//
+// If you can't agree to these terms, don't use these definitions!
+//
+// We mean it.
+//
+
+QT_BEGIN_NAMESPACE
+
+namespace q20::ranges {
+// like std::ranges::{any,all,none}_of, just unconstrained, so no range-overload
+#ifdef __cpp_lib_ranges
+using std::ranges::any_of;
+using std::ranges::all_of;
+using std::ranges::none_of;
+#else
+[[maybe_unused]] inline constexpr struct { // Niebloid
+ template <typename InputIterator, typename Sentinel,
+ typename Predicate, typename Projection = q20::identity>
+ constexpr bool operator()(InputIterator first, Sentinel last, Predicate pred, Projection proj = {}) const
+ {
+ while (first != last) {
+ if (std::invoke(pred, std::invoke(proj, *first)))
+ return true;
+ ++first;
+ }
+ return false;
+ }
+} any_of;
+[[maybe_unused]] inline constexpr struct { // Niebloid
+ template <typename InputIterator, typename Sentinel,
+ typename Predicate, typename Projection = q20::identity>
+ constexpr bool operator()(InputIterator first, Sentinel last, Predicate pred, Projection proj = {}) const
+ {
+ while (first != last) {
+ if (!std::invoke(pred, std::invoke(proj, *first)))
+ return false;
+ ++first;
+ }
+ return true;
+ }
+} all_of;
+[[maybe_unused]] inline constexpr struct { // Niebloid
+ template <typename InputIterator, typename Sentinel,
+ typename Predicate, typename Projection = q20::identity>
+ constexpr bool operator()(InputIterator first, Sentinel last, Predicate pred, Projection proj = {}) const
+ {
+ while (first != last) {
+ if (std::invoke(pred, std::invoke(proj, *first)))
+ return false;
+ ++first;
+ }
+ return true;
+ }
+} none_of;
+#endif // __cpp_lib_ranges
+} // namespace q20::ranges
+
+QT_END_NAMESPACE
+
+#endif /* Q20ALGORITHM_H */
diff --git a/src/corelib/global/minimum-linux.S b/src/corelib/global/q20functional.h
index e324379efc..300c4b8dd8 100644
--- a/src/corelib/global/minimum-linux.S
+++ b/src/corelib/global/q20functional.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2017 Intel Corporation.
-** Contact: https://www.qt.io/licensing/
+** Copyright (C) 2021 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com, author Marc Mutz <marc.mutz@kdab.com>
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtCore module of the Qt Toolkit.
**
@@ -36,46 +36,45 @@
** $QT_END_LICENSE$
**
****************************************************************************/
+#ifndef Q20FUNCTIONAL_H
+#define Q20FUNCTIONAL_H
-#include "minimum-linux_p.h"
+#include <QtCore/qglobal.h>
-/* Copied from #include <elf.h>:
- */
-#define ELF_NOTE_GNU "GNU"
-#define NT_GNU_ABI_TAG 1
-#define ELF_NOTE_OS_LINUX 0
+#include <functional>
-#ifdef __arm__
-# define progbits %progbits
-# define note %note
-#else
-# define progbits @progbits
-# define note @note
-#endif
-
-/* Add information for the ELF dynamic linker what the minimum Linux version
- * required for Qt is.
- *
- * The .note.ABI-tag note section is defined at
- * https://refspecs.linuxfoundation.org/LSB_5.0.0/LSB-Core-generic/LSB-Core-generic/noteabitag.html
- */
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. Types and functions defined
+// in this file will behave exactly as their std counterparts. You
+// may use these definitions in your own code, but be aware that we
+// will remove them once Qt depends on the C++ version that supports
+// them in namespace std. There will be NO deprecation warning, the
+// definitions will JUST go away.
+//
+// If you can't agree to these terms, don't use these definitions!
+//
+// We mean it.
+//
- .section ".note.GNU-stack", "", progbits
- .section ".note.ABI-tag", "a", note
- .balign 4 /* we have 32-bit data */
+QT_BEGIN_NAMESPACE
-/* * For the format of the note section's contents, see Elf32_Nhdr / Elf64_Nhdr */
- .long .Lnameend-.Lname /* n_namesz */
- .long 16 /* n_descsz(16 bytes, normative) */
- .long NT_GNU_ABI_TAG /* n_type */
-
-.Lname:
- .asciz ELF_NOTE_GNU
-.Lnameend:
+namespace q20 {
+// like std::identity
+#ifdef __cpp_lib_ranges
+using std::identity;
+#else
+struct identity
+{
+ struct is_transparent {};
+ template <typename T>
+ constexpr T &&operator()(T&& t) const noexcept { return std::forward<T>(t); }
+};
+#endif // __cpp_lib_ranges
+} // namespace q20
-/* Operating systems: */
- .long ELF_NOTE_OS_LINUX
+QT_END_NAMESPACE
- .long MINLINUX_MAJOR
- .long MINLINUX_MINOR
- .long MINLINUX_PATCH
+#endif /* Q20FUNCTIONAL_H */
diff --git a/src/corelib/global/qcompilerdetection.h b/src/corelib/global/qcompilerdetection.h
index 584f1f79b9..bfa4f89105 100644
--- a/src/corelib/global/qcompilerdetection.h
+++ b/src/corelib/global/qcompilerdetection.h
@@ -409,15 +409,6 @@
documentation. It also follows conventions like _BOOL and this documented */
# elif defined(sinix)
# define Q_CC_CDS
-
-/* The MIPSpro compiler defines __EDG */
-# elif defined(__sgi)
-# define Q_CC_MIPS
-# define Q_NO_TEMPLATE_FRIENDS
-# if defined(_COMPILER_VERSION) && (_COMPILER_VERSION >= 740)
-# define Q_OUTOFLINE_TEMPLATE inline
-# pragma set woff 3624,3625,3649 /* turn off some harmless warnings */
-# endif
# endif
/* VxWorks' DIAB toolchain has an additional EDG type C++ compiler
@@ -446,9 +437,6 @@
# if __SUNPRO_CC >= 0x550
# define Q_DECL_EXPORT __global
# endif
-# if __SUNPRO_CC < 0x5a0
-# define Q_NO_TEMPLATE_FRIENDS
-# endif
# if !defined(_BOOL)
# error "Compiler not supported"
# endif
@@ -467,26 +455,6 @@
# endif
# define Q_BROKEN_TEMPLATE_SPECIALIZATION
-#elif defined(Q_OS_HPUX)
-/* __HP_aCC was not defined in first aCC releases */
-# if defined(__HP_aCC) || __cplusplus >= 199707L
-# define Q_NO_TEMPLATE_FRIENDS
-# define Q_CC_HPACC
-# define Q_FUNC_INFO __PRETTY_FUNCTION__
-# if __HP_aCC-0 < 060000
-# define QT_NO_TEMPLATE_TEMPLATE_PARAMETERS
-# define Q_DECL_EXPORT __declspec(dllexport)
-# define Q_DECL_IMPORT __declspec(dllimport)
-# endif
-# if __HP_aCC-0 >= 062000
-# define Q_DECL_EXPORT __attribute__((visibility("default")))
-# define Q_DECL_HIDDEN __attribute__((visibility("hidden")))
-# define Q_DECL_IMPORT Q_DECL_EXPORT
-# endif
-# else
-# error "Compiler not supported"
-# endif
-
#else
# error "Qt has not been tested with this compiler - see http://www.qt-project.org/"
#endif
@@ -1146,10 +1114,8 @@
# define Q_DECL_DEPRECATED_X(x) [[deprecated(x)]]
#endif
-#if defined(__cpp_enumerator_attributes) && __cpp_enumerator_attributes >= 201411
-# define Q_DECL_ENUMERATOR_DEPRECATED Q_DECL_DEPRECATED
-# define Q_DECL_ENUMERATOR_DEPRECATED_X(x) Q_DECL_DEPRECATED_X(x)
-#endif
+#define Q_DECL_ENUMERATOR_DEPRECATED Q_DECL_DEPRECATED
+#define Q_DECL_ENUMERATOR_DEPRECATED_X(x) Q_DECL_DEPRECATED_X(x)
/*
* Fallback macros to certain compiler features
@@ -1185,12 +1151,6 @@
#ifndef Q_DECL_DEPRECATED_X
# define Q_DECL_DEPRECATED_X(text) Q_DECL_DEPRECATED
#endif
-#ifndef Q_DECL_ENUMERATOR_DEPRECATED
-# define Q_DECL_ENUMERATOR_DEPRECATED
-#endif
-#ifndef Q_DECL_ENUMERATOR_DEPRECATED_X
-# define Q_DECL_ENUMERATOR_DEPRECATED_X(x)
-#endif
#ifndef Q_DECL_EXPORT
# define Q_DECL_EXPORT
#endif
diff --git a/src/corelib/global/qconfig-bootstrapped.h b/src/corelib/global/qconfig-bootstrapped.h
index 4d3f88e071..090dde8312 100644
--- a/src/corelib/global/qconfig-bootstrapped.h
+++ b/src/corelib/global/qconfig-bootstrapped.h
@@ -136,6 +136,8 @@
#define QT_NO_TRANSLATION
#define QT_FEATURE_translation -1
+#define QT_NO_COMPRESS
+
// rcc.pro will DEFINES+= this
#ifndef QT_FEATURE_zstd
#define QT_FEATURE_zstd -1
diff --git a/src/corelib/global/qconfig.cpp.in b/src/corelib/global/qconfig.cpp.in
index e6a85feffd..f6ce335599 100644
--- a/src/corelib/global/qconfig.cpp.in
+++ b/src/corelib/global/qconfig.cpp.in
@@ -1,6 +1,6 @@
/* This file is used to generate the Qt configuration info for the Core library.
* The 'qt_generate_qconfig_cpp' cmake routine
- * contains variables that replace '@' entires in this file. It's important to
+ * contains variables that replace '@' entries in this file. It's important to
* align these values with the following:
*
* - QLibraryInfo::LibraryPath enum in qtbase/src/corelib/global/qlibraryinfo.h
@@ -10,8 +10,6 @@
* qt_configure_strs. Also qtConfEntries are strongly bound to QLibraryInfo::LibraryPath.
*/
-/* Installation date */
-static const char qt_configure_installation [12+11] = "qt_instdate=2012-12-20";
/* Installation Info */
static const char qt_configure_prefix_path_str [12+256] = "qt_prfxpath=@QT_CONFIGURE_PREFIX_PATH_STR@";
static const short qt_configure_str_offsets[] = {
diff --git a/src/corelib/global/qendian.h b/src/corelib/global/qendian.h
index c874c5e47a..759b3b09ec 100644
--- a/src/corelib/global/qendian.h
+++ b/src/corelib/global/qendian.h
@@ -127,7 +127,7 @@ inline constexpr quint8 qbswap_helper(quint8 source)
/*
* T qbswap(T source).
- * Changes the byte order of a value from big endian to little endian or vice versa.
+ * Changes the byte order of a value from big-endian to little-endian or vice versa.
* This function can be used if you are not concerned about alignment issues,
* and it is therefore a bit more convenient and in most cases more efficient.
*/
@@ -164,7 +164,7 @@ inline double qbswap(double source)
/*
* qbswap(const T src, const void *dest);
- * Changes the byte order of \a src from big endian to little endian or vice versa
+ * Changes the byte order of \a src from big-endian to little-endian or vice versa
* and stores the result in \a dest.
* There is no alignment requirements for \a dest.
*/
diff --git a/src/corelib/global/qfloat16.cpp b/src/corelib/global/qfloat16.cpp
index 9ef197b3a1..834d82e0ea 100644
--- a/src/corelib/global/qfloat16.cpp
+++ b/src/corelib/global/qfloat16.cpp
@@ -197,17 +197,36 @@ static inline bool hasFastF16()
return qCpuHasFeature(F16C) && qCpuHasFeature(AVX);
}
-extern "C" {
-#ifdef QFLOAT16_INCLUDE_FAST
-# define f16cextern static
-#else
-# define f16cextern extern
-#endif
-
-f16cextern void qFloatToFloat16_fast(quint16 *out, const float *in, qsizetype len) noexcept;
-f16cextern void qFloatFromFloat16_fast(float *out, const quint16 *in, qsizetype len) noexcept;
+QT_FUNCTION_TARGET(F16C)
+void qFloatToFloat16_fast(quint16 *out, const float *in, qsizetype len) Q_DECL_NOEXCEPT
+{
+ qsizetype i = 0;
+ int epilog_i;
+ for (; i < len - 7; i += 8)
+ _mm_storeu_si128((__m128i *)(out + i), _mm256_cvtps_ph(_mm256_loadu_ps(in + i), 0));
+ if (i < len - 3) {
+ _mm_storel_epi64((__m128i *)(out + i), _mm_cvtps_ph(_mm_loadu_ps(in + i), 0));
+ i += 4;
+ }
+ // Inlining "qfloat16::qfloat16(float f)":
+ for (epilog_i = 0; i < len && epilog_i < 3; ++i, ++epilog_i)
+ out[i] = _mm_extract_epi16(_mm_cvtps_ph(_mm_set_ss(in[i]), 0), 0);
+}
-#undef f16cextern
+QT_FUNCTION_TARGET(F16C)
+void qFloatFromFloat16_fast(float *out, const quint16 *in, qsizetype len) Q_DECL_NOEXCEPT
+{
+ qsizetype i = 0;
+ int epilog_i;
+ for (; i < len - 7; i += 8)
+ _mm256_storeu_ps(out + i, _mm256_cvtph_ps(_mm_loadu_si128((const __m128i *)(in + i))));
+ if (i < len - 3) {
+ _mm_storeu_ps(out + i, _mm_cvtph_ps(_mm_loadl_epi64((const __m128i *)(in + i))));
+ i += 4;
+ }
+ // Inlining "qfloat16::operator float()":
+ for (epilog_i = 0; i < len && epilog_i < 3; ++i, ++epilog_i)
+ out[i] = _mm_cvtss_f32(_mm_cvtph_ps(_mm_cvtsi32_si128(in[i])));
}
#elif defined(__ARM_FP16_FORMAT_IEEE) && defined(__ARM_NEON__) && (__ARM_FP & 2)
@@ -292,6 +311,3 @@ Q_CORE_EXPORT void qFloatFromFloat16(float *out, const qfloat16 *in, qsizetype l
QT_END_NAMESPACE
#include "qfloat16tables.cpp"
-#ifdef QFLOAT16_INCLUDE_FAST
-# include "qfloat16_f16c.c"
-#endif
diff --git a/src/corelib/global/qfloat16.h b/src/corelib/global/qfloat16.h
index c2e5379eb4..59739fdcc1 100644
--- a/src/corelib/global/qfloat16.h
+++ b/src/corelib/global/qfloat16.h
@@ -333,7 +333,7 @@ template <> inline auto qHypot(qfloat16 x, qfloat16 y)
return qfloat16(qHypot(float(x), float(y)));
#endif
}
-#if __cpp_lib_hypot >= 201603L // Expected to be true
+#if defined(__cpp_lib_hypot) && __cpp_lib_hypot >= 201603L // Expected to be true
// If any are not qfloat16, convert each qfloat16 to float:
/* (The following splits the some-but-not-all-qfloat16 cases up, using
(X|Y|Z)&~(X&Y&Z) = X ? ~(Y&Z) : Y|Z = X&~(Y&Z) | ~X&Y | ~X&~Y&Z,
diff --git a/src/corelib/global/qfloat16_f16c.c b/src/corelib/global/qfloat16_f16c.c
deleted file mode 100644
index d60a021bdb..0000000000
--- a/src/corelib/global/qfloat16_f16c.c
+++ /dev/null
@@ -1,88 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtCore module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "private/qsimd_p.h"
-
-// The x86 F16C instructions operate on AVX registers, so AVX support is
-// required.
-#if QT_COMPILER_SUPPORTS_HERE(AVX)
-
-#ifdef __cplusplus
-QT_BEGIN_NAMESPACE
-extern "C" {
-#endif
-
-QT_FUNCTION_TARGET(F16C)
-void qFloatToFloat16_fast(quint16 *out, const float *in, qsizetype len) Q_DECL_NOEXCEPT
-{
- qsizetype i = 0;
- int epilog_i;
- for (; i < len - 7; i += 8)
- _mm_storeu_si128((__m128i *)(out + i), _mm256_cvtps_ph(_mm256_loadu_ps(in + i), 0));
- if (i < len - 3) {
- _mm_storel_epi64((__m128i *)(out + i), _mm_cvtps_ph(_mm_loadu_ps(in + i), 0));
- i += 4;
- }
- // Inlining "qfloat16::qfloat16(float f)":
- for (epilog_i = 0; i < len && epilog_i < 3; ++i, ++epilog_i)
- out[i] = _mm_extract_epi16(_mm_cvtps_ph(_mm_set_ss(in[i]), 0), 0);
-}
-
-QT_FUNCTION_TARGET(F16C)
-void qFloatFromFloat16_fast(float *out, const quint16 *in, qsizetype len) Q_DECL_NOEXCEPT
-{
- qsizetype i = 0;
- int epilog_i;
- for (; i < len - 7; i += 8)
- _mm256_storeu_ps(out + i, _mm256_cvtph_ps(_mm_loadu_si128((const __m128i *)(in + i))));
- if (i < len - 3) {
- _mm_storeu_ps(out + i, _mm_cvtph_ps(_mm_loadl_epi64((const __m128i *)(in + i))));
- i += 4;
- }
- // Inlining "qfloat16::operator float()":
- for (epilog_i = 0; i < len && epilog_i < 3; ++i, ++epilog_i)
- out[i] = _mm_cvtss_f32(_mm_cvtph_ps(_mm_cvtsi32_si128(in[i])));
-}
-
-#ifdef __cplusplus
-} // 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 00538d6798..d455f887ed 100644
--- a/src/corelib/global/qglobal.cpp
+++ b/src/corelib/global/qglobal.cpp
@@ -40,6 +40,7 @@
#include "qplatformdefs.h"
#include "qstring.h"
+#include "qbytearrayview.h"
#include "qlist.h"
#include "qdir.h"
#include "qdatetime.h"
@@ -78,7 +79,7 @@
# include <envLib.h>
#endif
-#if defined(Q_OS_ANDROID) && !defined(Q_OS_ANDROID_EMBEDDED)
+#ifdef Q_OS_ANDROID
#include <qjniobject.h>
#endif
@@ -353,7 +354,7 @@ static_assert(sizeof(qint64) == 8, "Internal error, qint64 is misdefined");
/*!
\fn template <typename Enum> QFlags &QFlags<Enum>::operator=(const QFlags &other)
- Assigns \a other to this object and returns a reference to this
+ Assigns \e other to this object and returns a reference to this
object.
*/
@@ -582,7 +583,7 @@ static_assert(sizeof(qint64) == 8, "Internal error, qint64 is misdefined");
\relates QFlags
Calculates the hash for the flags \a flags, using \a seed
- to seed the calcualtion.
+ to seed the calculation.
*/
/*!
@@ -767,7 +768,7 @@ static_assert(sizeof(qint64) == 8, "Internal error, qint64 is misdefined");
the value rounded up to the nearest integer and 64-bit integer
respectively, the qInstallMessageHandler() function which installs
the given QtMessageHandler, and the qVersion() function which
- returns the version number of Qt at run-time as a string.
+ returns the version number of Qt at runtime as a string.
\section1 Macros
@@ -800,9 +801,9 @@ static_assert(sizeof(qint64) == 8, "Internal error, qint64 is misdefined");
The QT_POINTER_SIZE macro expands to the size of a pointer in bytes.
- The macros QT_VERSION and QT_VERSION_STR expand to a numeric value
- or a string, respectively, that specifies the version of Qt that the
- application is compiled against.
+ The macros QT_VERSION and QT_VERSION_STR expand to a numeric value or a
+ string, respectively. These identify the version of Qt that the application
+ is compiled with.
\sa <QtAlgorithms>, QSysInfo
*/
@@ -1301,17 +1302,24 @@ static_assert(sizeof(qint64) == 8, "Internal error, qint64 is misdefined");
*/
/*!
- \macro QT_VERSION_CHECK
+ \macro QT_VERSION_CHECK(major, minor, patch)
\relates <QtGlobal>
- Turns the major, minor and patch numbers of a version into an
- integer, 0xMMNNPP (MM = major, NN = minor, PP = patch). This can
- be compared with another similarly processed version id.
+ Turns the \a major, \a minor and \a patch numbers of a version into an
+ integer that encodes all three. When expressed in hexadecimal, this integer
+ is of form \c 0xMMNNPP wherein \c{0xMM ==} \a major, \c{0xNN ==} \a minor,
+ and \c{0xPP ==} \a patch. This can be compared with another similarly
+ processed version ID.
Example:
\snippet code/src_corelib_global_qglobal.cpp qt-version-check
+ \note the parameters are read as integers in the normal way, so should
+ normally be written in decimal (so a \c 0x prefix must be used if writing
+ them in hexadecimal). Thuse \c{QT_VERSION_CHECK(5, 15, 0)} is equal to \c
+ 0x050e00, which could equally be written \c{QT_VERSION_CHECK(5, 0xe, 0)}.
+
\sa QT_VERSION
*/
@@ -1319,28 +1327,32 @@ static_assert(sizeof(qint64) == 8, "Internal error, qint64 is misdefined");
\macro QT_VERSION
\relates <QtGlobal>
- This macro expands a numeric value of the form 0xMMNNPP (MM =
- major, NN = minor, PP = patch) that specifies Qt's version
- number. For example, if you compile your application against Qt
- 4.1.2, the QT_VERSION macro will expand to 0x040102.
+ This macro expands to a numeric value of the same form as \l
+ QT_VERSION_CHECK() constructs, that specifies the version of Qt with which
+ code using it is compiled. For example, if you compile your application with
+ Qt 6.1.2, the QT_VERSION macro will expand to \c 0x060102, the same as
+ \c{QT_VERSION_CHECK(6, 1, 2)}. Note that this need not agree with the
+ version the application will find itself using at \e runtime.
- You can use QT_VERSION to use the latest Qt features where
- available.
+ You can use QT_VERSION to select the latest Qt features where available
+ while falling back to older implementations otherwise. Using
+ QT_VERSION_CHECK() for the value to compare with is recommended.
Example:
\snippet code/src_corelib_global_qglobal.cpp 16
- \sa QT_VERSION_STR, qVersion()
+ \sa QT_VERSION_STR, QT_VERSION_CHECK(), qVersion()
*/
/*!
\macro QT_VERSION_STR
\relates <QtGlobal>
- This macro expands to a string that specifies Qt's version number
- (for example, "4.1.2"). This is the version against which the
- application is compiled.
+ This macro expands to a string that specifies Qt's version number (for
+ example, "6.1.2"). This is the version with which the application is
+ compiled. This may be a different version than the version the application
+ will find itself using at \e runtime.
\sa qVersion(), QT_VERSION
*/
@@ -1348,9 +1360,9 @@ static_assert(sizeof(qint64) == 8, "Internal error, qint64 is misdefined");
/*!
\relates <QtGlobal>
- Returns the version number of Qt at run-time as a string (for
- example, "4.1.2"). This may be a different version than the
- version the application was compiled against.
+ Returns the version number of Qt at runtime as a string (for example,
+ "6.1.2"). This may be a different version than the version the application
+ was \e compiled with.
\sa QT_VERSION_STR, QLibraryInfo::version()
*/
@@ -1423,42 +1435,42 @@ bool qSharedBuild() noexcept
\relates <QtGlobal>
Deprecated synonym for \c Q_OS_DARWIN. Do not use.
- */
+*/
/*!
\macro Q_OS_OSX
\relates <QtGlobal>
Deprecated synonym for \c Q_OS_MACOS. Do not use.
- */
+*/
/*!
\macro Q_OS_MACOS
\relates <QtGlobal>
Defined on \macos.
- */
+*/
/*!
\macro Q_OS_IOS
\relates <QtGlobal>
Defined on iOS.
- */
+*/
/*!
\macro Q_OS_WATCHOS
\relates <QtGlobal>
Defined on watchOS.
- */
+*/
/*!
\macro Q_OS_TVOS
\relates <QtGlobal>
Defined on tvOS.
- */
+*/
/*!
\macro Q_OS_WIN
@@ -2064,14 +2076,15 @@ bool qSharedBuild() noexcept
a specified version of Qt or any earlier version. The default version number is 5.0,
meaning that functions deprecated in or before Qt 5.0 will not be included.
- For instance, when using a future release of Qt 5, set
- \c{QT_DISABLE_DEPRECATED_BEFORE=0x050100} to disable functions deprecated in
- Qt 5.1 and earlier. In any release, set
- \c{QT_DISABLE_DEPRECATED_BEFORE=0x000000} to enable all functions, including
- the ones deprecated in Qt 5.0.
+ For instance, when preparing to upgrade to Qt 6.3, setting
+ \c{QT_DISABLE_DEPRECATED_BEFORE=0x0602ff} will disable functions deprecated in
+ Qt 6.2 and earlier, making it easy to find changes worth making before the
+ upgrade. In any release, set \c{QT_DISABLE_DEPRECATED_BEFORE=0x000000} to
+ enable all functions, including the ones deprecated in Qt 5.0 (although most
+ of those have by now been removed entirely).
\sa QT_DEPRECATED_WARNINGS
- */
+*/
/*!
@@ -2083,7 +2096,7 @@ bool qSharedBuild() noexcept
deprecated by Qt is used.
\sa QT_DISABLE_DEPRECATED_BEFORE, QT_NO_DEPRECATED_WARNINGS
- */
+*/
/*!
\macro QT_NO_DEPRECATED_WARNINGS
@@ -2202,7 +2215,17 @@ static const char *osVer_helper(QOperatingSystemVersion version = QOperatingSyst
#define Q_WINVER(major, minor) (major << 8 | minor)
switch (Q_WINVER(osver.dwMajorVersion, osver.dwMinorVersion)) {
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
@@ -2407,7 +2430,7 @@ static bool findUnixOsVersion(QUnixOSVersion &v)
# endif // USE_ETC_OS_RELEASE
#endif // Q_OS_UNIX
-#if defined(Q_OS_ANDROID) && !defined(Q_OS_ANDROID_EMBEDDED)
+#ifdef Q_OS_ANDROID
static const char *osVer_helper(QOperatingSystemVersion)
{
/* Data:
@@ -2438,7 +2461,7 @@ Marshmallow
Nougat
Nougat
Oreo
- */
+*/
static const char versions_string[] =
"\0"
"Cupcake\0"
@@ -2538,7 +2561,7 @@ QString QSysInfo::buildCpuArchitecture()
\endlist
\sa QSysInfo::buildAbi(), QSysInfo::buildCpuArchitecture()
- */
+*/
QString QSysInfo::currentCpuArchitecture()
{
#if defined(Q_OS_WIN)
@@ -2874,7 +2897,7 @@ QString QSysInfo::productVersion()
*/
QString QSysInfo::prettyProductName()
{
-#if (defined(Q_OS_ANDROID) && !defined(Q_OS_ANDROID_EMBEDDED)) || defined(Q_OS_DARWIN) || defined(Q_OS_WIN)
+#if defined(Q_OS_ANDROID) || defined(Q_OS_DARWIN) || defined(Q_OS_WIN)
const auto version = QOperatingSystemVersion::current();
const int majorVersion = version.majorVersion();
const QString versionString = QString::number(majorVersion) + QLatin1Char('.')
@@ -2924,7 +2947,7 @@ QString QSysInfo::prettyProductName()
This function returns the same as QHostInfo::localHostName().
\sa QHostInfo::localDomainName, machineUniqueId()
- */
+*/
QString QSysInfo::machineHostName()
{
// the hostname can change, so we can't cache it
@@ -3231,7 +3254,7 @@ QByteArray QSysInfo::bootUniqueId()
\tt{const TInputType& myMin(const TInputType&, const TInputType&) [with TInputType = int] was called with value1: 3 value2: 4}
If this macro is used outside a function, the behavior is undefined.
- */
+*/
/*!
\internal
@@ -3346,6 +3369,35 @@ time_t qMkTime(struct tm *when)
return mktime(when);
}
+void qAbort()
+{
+#ifdef Q_OS_WIN
+ // std::abort() in the MSVC runtime will call _exit(3) if the abort
+ // behavior is _WRITE_ABORT_MSG - see also _set_abort_behavior(). This is
+ // the default for a debug-mode build of the runtime. Worse, MinGW's
+ // std::abort() implementation (in msvcrt.dll) is basically a call to
+ // _exit(3) too. Unfortunately, _exit() and _Exit() *do* run the static
+ // destructors of objects in DLLs, a violation of the C++ standard (see
+ // [support.start.term]). So we bypass std::abort() and directly
+ // terminate the application.
+
+# if defined(Q_CC_MSVC) && !defined(Q_CC_INTEL)
+ if (IsProcessorFeaturePresent(PF_FASTFAIL_AVAILABLE))
+ __fastfail(FAST_FAIL_FATAL_APP_EXIT);
+# else
+ RaiseFailFastException(nullptr, nullptr, 0);
+# endif
+
+ // Fallback
+ TerminateProcess(GetCurrentProcess(), STATUS_FATAL_APP_EXIT);
+
+ // Tell the compiler the application has stopped.
+ Q_UNREACHABLE_IMPL();
+#else // !Q_OS_WIN
+ std::abort();
+#endif
+}
+
// Also specified to behave as if they call tzset():
// localtime() -- but not localtime_r(), which we use when threaded
// strftime() -- not used (except in tests)
@@ -3529,6 +3581,7 @@ int qEnvironmentVariableIntValue(const char *varName, bool *ok) noexcept
(std::numeric_limits<uint>::digits + NumBinaryDigitsPerOctalDigit - 1) / NumBinaryDigitsPerOctalDigit;
const auto locker = qt_scoped_lock(environmentMutex);
+ size_t size;
#ifdef Q_CC_MSVC
// we provide a buffer that can hold any int value:
char buffer[MaxDigitsForOctalInt + 2]; // +1 for NUL +1 for optional '-'
@@ -3538,45 +3591,16 @@ int qEnvironmentVariableIntValue(const char *varName, bool *ok) noexcept
*ok = false;
return 0;
}
+ size = strlen(buffer);
#else
const char * const buffer = ::getenv(varName);
- if (!buffer || strlen(buffer) > MaxDigitsForOctalInt + 2) {
+ if (!buffer || (size = strlen(buffer)) > MaxDigitsForOctalInt + 2) {
if (ok)
*ok = false;
return 0;
}
#endif
- bool ok_ = true;
- const char *endptr;
- const qlonglong value = qstrtoll(buffer, &endptr, 0, &ok_);
-
- // Keep the following checks in sync with QByteArray::toInt()
- if (!ok_) {
- if (ok)
- *ok = false;
- return 0;
- }
-
- if (*endptr != '\0') {
- while (ascii_isspace(*endptr))
- ++endptr;
- }
-
- if (*endptr != '\0') {
- // we stopped at a non-digit character after converting some digits
- if (ok)
- *ok = false;
- return 0;
- }
-
- if (int(value) != value) {
- if (ok)
- *ok = false;
- return 0;
- } else if (ok) {
- *ok = ok_;
- }
- return int(value);
+ return QByteArrayView(buffer, size).toInt(ok, 0);
}
/*!
@@ -4180,7 +4204,7 @@ bool qunsetenv(const char *varName)
Qt will try to detect the class of a type using
\l {https://en.cppreference.com/w/cpp/types/is_trivial} {std::is_trivial_v<T>}
- to indentify primitive
+ to identify primitive
types and it will require both
\l {https://en.cppreference.com/w/cpp/types/is_trivially_copyable} {std::is_trivially_copyable_v<T>}
and
@@ -4446,7 +4470,7 @@ bool QInternal::activateCallbacks(Callback cb, void **parameters)
The two numbers are compared in a relative way, where the
exactness is stronger the smaller the numbers are.
- */
+*/
/*!
\fn bool qFuzzyCompare(float p1, float p2)
@@ -4459,7 +4483,7 @@ bool QInternal::activateCallbacks(Callback cb, void **parameters)
The two numbers are compared in a relative way, where the
exactness is stronger the smaller the numbers are.
- */
+*/
/*!
\fn bool qFuzzyIsNull(double d)
@@ -4484,14 +4508,14 @@ bool QInternal::activateCallbacks(Callback cb, void **parameters)
\relates <QtGlobal>
This macro can be used to ensure that the application is run
- against a recent enough version of Qt. This is especially useful
+ with a recent enough version of Qt. This is especially useful
if your application depends on a specific bug fix introduced in a
- bug-fix release (e.g., 4.0.2).
+ bug-fix release (for example, 6.1.2).
The \a argc and \a argv parameters are the \c main() function's
\c argc and \c argv parameters. The \a version parameter is a
string literal that specifies which version of Qt the application
- requires (e.g., "4.0.2").
+ requires (for example, "6.1.2").
Example:
@@ -4574,7 +4598,7 @@ bool QInternal::activateCallbacks(Callback cb, void **parameters)
puts a single space between each item, and outputs a newline at
the end. It supports many C++ and Qt types.
- To suppress the output at run-time, install your own message handler
+ To suppress the output at runtime, install your own message handler
with qInstallMessageHandler().
\sa qInfo(), qWarning(), qCritical(), qFatal(), qInstallMessageHandler(),
@@ -4612,8 +4636,8 @@ bool QInternal::activateCallbacks(Callback cb, void **parameters)
puts a single space between each item, and outputs a newline at
the end. It supports many C++ and Qt types.
- To suppress the output at run-time, install your own message handler
- with qInstallMessageHandler().
+ To suppress the output at runtime, install your own message handler
+ using qInstallMessageHandler().
\sa qDebug(), qWarning(), qCritical(), qFatal(), qInstallMessageHandler(),
{Debugging Techniques}
diff --git a/src/corelib/global/qglobal.h b/src/corelib/global/qglobal.h
index 8bc7181633..dd137c879a 100644
--- a/src/corelib/global/qglobal.h
+++ b/src/corelib/global/qglobal.h
@@ -53,11 +53,11 @@
#endif
/*
- QT_VERSION is (major << 16) + (minor << 8) + patch.
+ QT_VERSION is (major << 16) | (minor << 8) | patch.
*/
#define QT_VERSION QT_VERSION_CHECK(QT_VERSION_MAJOR, QT_VERSION_MINOR, QT_VERSION_PATCH)
/*
- can be used like #if (QT_VERSION >= QT_VERSION_CHECK(4, 4, 0))
+ can be used like #if (QT_VERSION >= QT_VERSION_CHECK(6, 4, 0))
*/
#define QT_VERSION_CHECK(major, minor, patch) ((major<<16)|(minor<<8)|(patch))
@@ -97,6 +97,15 @@
# endif
#endif // __cplusplus
+#if defined(__cplusplus) && defined(Q_CC_MSVC)
+// On MSVC we require /permissive- set by user code. Check that we are
+// under its rules -- for instance, check that std::nullptr_t->bool is
+// not an implicit conversion, as per
+// https://docs.microsoft.com/en-us/cpp/overview/cpp-conformance-improvements?view=msvc-160#nullptr_t-is-only-convertible-to-bool-as-a-direct-initialization
+static_assert(!std::is_convertible_v<std::nullptr_t, bool>,
+ "On MSVC you must pass the /permissive- option to the compiler.");
+#endif
+
#if defined (__ELF__)
# define Q_OF_ELF
#endif
@@ -459,7 +468,7 @@ typedef double qreal;
// removed_api/some.cpp
#define QT_BUILD_REMOVED_API
- #include <qglobal.h>
+ #include <QtCore/qglobal.h>
#include <someheader.h>
@@ -859,7 +868,7 @@ constexpr inline QTypeTraits::Promoted<T, U> qBound(const U &min, const T &val,
# ifdef __OBJC__
# define Q_FORWARD_DECLARE_OBJC_CLASS(classname) @class classname
# else
-# define Q_FORWARD_DECLARE_OBJC_CLASS(classname) typedef struct objc_object classname
+# define Q_FORWARD_DECLARE_OBJC_CLASS(classname) class classname
# endif
#endif
#ifndef Q_FORWARD_DECLARE_CF_TYPE
@@ -1204,6 +1213,7 @@ void qAsConst(const T &&) = delete;
// like std::exchange
template <typename T, typename U = T>
constexpr T qExchange(T &t, U &&newValue)
+noexcept(std::conjunction_v<std::is_nothrow_move_constructible<T>, std::is_nothrow_assignable<T &, U>>)
{
T old = std::move(t);
t = std::forward<U>(newValue);
@@ -1280,10 +1290,15 @@ QForeachContainer<typename std::decay<T>::type> qMakeForeachContainer(T &&t)
// 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
+
+#define Q_FOREACH_JOIN(A, B) Q_FOREACH_JOIN_IMPL(A, B)
+#define Q_FOREACH_JOIN_IMPL(A, B) A ## B
+
+#define Q_FOREACH(variable, container) \
+ Q_FOREACH_IMPL(variable, Q_FOREACH_JOIN(_container_, __LINE__), container)
#endif // QT_NO_FOREACH
#define Q_FOREVER for(;;)
diff --git a/src/corelib/global/qglobal_p.h b/src/corelib/global/qglobal_p.h
index 5ab84fa8be..49927ef30f 100644
--- a/src/corelib/global/qglobal_p.h
+++ b/src/corelib/global/qglobal_p.h
@@ -72,6 +72,11 @@ QT_BEGIN_NAMESPACE
Q_CORE_EXPORT void qTzSet();
Q_CORE_EXPORT time_t qMkTime(struct tm *when);
+#if !defined(Q_CC_MSVC)
+Q_NORETURN
+#endif
+Q_CORE_EXPORT void qAbort();
+
QT_END_NAMESPACE
#if !__has_builtin(__builtin_available)
diff --git a/src/corelib/global/qglobalstatic.h b/src/corelib/global/qglobalstatic.h
index 4aa496e7f6..49cebe1e61 100644
--- a/src/corelib/global/qglobalstatic.h
+++ b/src/corelib/global/qglobalstatic.h
@@ -122,6 +122,8 @@ struct QGlobalStatic
};
#define Q_GLOBAL_STATIC_WITH_ARGS(TYPE, NAME, ARGS) \
+ QT_WARNING_PUSH \
+ QT_WARNING_DISABLE_CLANG("-Wunevaluated-expression") \
namespace { namespace Q_QGS_ ## NAME { \
typedef TYPE Type; \
QBasicAtomicInt guard = Q_BASIC_ATOMIC_INITIALIZER(QtGlobalStatic::Uninitialized); \
@@ -129,7 +131,8 @@ struct QGlobalStatic
} } \
static QGlobalStatic<TYPE, \
Q_QGS_ ## NAME::innerFunction, \
- Q_QGS_ ## NAME::guard> NAME;
+ Q_QGS_ ## NAME::guard> NAME; \
+ QT_WARNING_POP
#define Q_GLOBAL_STATIC(TYPE, NAME) \
Q_GLOBAL_STATIC_WITH_ARGS(TYPE, NAME, ())
diff --git a/src/corelib/global/qlibraryinfo.cpp b/src/corelib/global/qlibraryinfo.cpp
index 625fab75f7..18a429fb6d 100644
--- a/src/corelib/global/qlibraryinfo.cpp
+++ b/src/corelib/global/qlibraryinfo.cpp
@@ -244,8 +244,10 @@ QLibraryInfo::QLibraryInfo()
# define COMPILER_STRING "MSVC 2015"
# elif _MSC_VER < 1917
# define COMPILER_STRING "MSVC 2017"
-# elif _MSC_VER < 2000
+# elif _MSC_VER < 1930
# define COMPILER_STRING "MSVC 2019"
+# elif _MSC_VER < 2000
+# define COMPILER_STRING "MSVC 2022"
# else
# define COMPILER_STRING "MSVC _MSC_VER " QT_STRINGIFY(_MSC_VER)
# endif
@@ -683,6 +685,7 @@ QStringList QLibraryInfo::platformPluginArguments(const QString &platformName)
QT_END_NAMESPACE
#if defined(Q_CC_GNU) && defined(ELF_INTERPRETER)
+# include <elf.h>
# include <stdio.h>
# include <stdlib.h>
@@ -692,6 +695,35 @@ QT_WARNING_DISABLE_GCC("-Wattributes")
QT_WARNING_DISABLE_CLANG("-Wattributes")
QT_WARNING_DISABLE_INTEL(2621)
+# if defined(Q_OS_LINUX)
+# include "minimum-linux_p.h"
+# endif
+# ifdef QT_ELF_NOTE_OS_TYPE
+struct ElfNoteAbiTag
+{
+ static_assert(sizeof(Elf32_Nhdr) == sizeof(Elf64_Nhdr),
+ "The size of an ELF note is wrong (should be 12 bytes)");
+ struct Payload {
+ Elf32_Word ostype = QT_ELF_NOTE_OS_TYPE;
+ Elf32_Word major = QT_ELF_NOTE_OS_MAJOR;
+ Elf32_Word minor = QT_ELF_NOTE_OS_MINOR;
+# ifdef QT_ELF_NOTE_OS_PATCH
+ Elf32_Word patch = QT_ELF_NOTE_OS_PATCH;
+# endif
+ };
+
+ Elf32_Nhdr header = {
+ .n_namesz = sizeof(name),
+ .n_descsz = sizeof(Payload),
+ .n_type = NT_GNU_ABI_TAG
+ };
+ char name[sizeof ELF_NOTE_GNU] = ELF_NOTE_GNU; // yes, include the null terminator
+ Payload payload = {};
+};
+__attribute__((section(".note.ABI-tag"), aligned(4), used))
+extern constexpr ElfNoteAbiTag QT_MANGLE_NAMESPACE(qt_abi_tag) = {};
+# endif
+
extern const char qt_core_interpreter[] __attribute__((section(".interp")))
= ELF_INTERPRETER;
diff --git a/src/corelib/global/qlogging.cpp b/src/corelib/global/qlogging.cpp
index 9bb15d21be..fd38a9d6c4 100644
--- a/src/corelib/global/qlogging.cpp
+++ b/src/corelib/global/qlogging.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2016 The Qt Company Ltd.
+** Copyright (C) 2021 The Qt Company Ltd.
** Copyright (C) 2016 Olivier Goffart <ogoffart@woboq.com>
** Copyright (C) 2018 Intel Corporation.
** Contact: https://www.qt.io/licensing/
@@ -1090,7 +1090,7 @@ struct QMessagePattern
QString backtraceSeparator;
int backtraceDepth;
};
- QList<BacktraceParams> backtraceArgs; // backtrace argumens in sequence of %{backtrace
+ QList<BacktraceParams> backtraceArgs; // backtrace arguments in sequence of %{backtrace
#endif
bool fromEnvironment;
@@ -1497,7 +1497,7 @@ static QBasicAtomicPointer<void (QtMsgType, const QMessageLogContext &, const QS
// ------------------------ Alternate logging sinks -------------------------
#if defined(QT_BOOTSTRAPPED)
- // Boostrapped tools always print to stderr, so no need for alternate sinks
+ // Bootstrapped tools always print to stderr, so no need for alternate sinks
#else
#if QT_CONFIG(slog2)
@@ -1632,7 +1632,7 @@ static bool syslog_default_message_handler(QtMsgType type, const QMessageLogCont
}
#endif
-#if defined(Q_OS_ANDROID) && !defined(Q_OS_ANDROID_EMBEDDED)
+#ifdef Q_OS_ANDROID
static bool android_default_message_handler(QtMsgType type,
const QMessageLogContext &context,
const QString &message)
@@ -1775,7 +1775,7 @@ static void qDefaultMessageHandler(QtMsgType type, const QMessageLogContext &con
handledStderr |= systemd_default_message_handler(type, context, message);
# elif QT_CONFIG(syslog)
handledStderr |= syslog_default_message_handler(type, context, message);
-# elif defined(Q_OS_ANDROID) && !defined(Q_OS_ANDROID_EMBEDDED)
+# elif defined(Q_OS_ANDROID)
handledStderr |= android_default_message_handler(type, context, message);
# elif defined(QT_USE_APPLE_UNIFIED_LOGGING)
handledStderr |= AppleUnifiedLogger::messageHandler(type, context, message);
@@ -1872,31 +1872,7 @@ static void qt_message_fatal(QtMsgType, const QMessageLogContext &context, const
Q_UNUSED(message);
#endif
-#ifdef Q_OS_WIN
- // std::abort() in the MSVC runtime will call _exit(3) if the abort
- // behavior is _WRITE_ABORT_MSG - see also _set_abort_behavior(). This is
- // the default for a debug-mode build of the runtime. Worse, MinGW's
- // std::abort() implementation (in msvcrt.dll) is basically a call to
- // _exit(3) too. Unfortunately, _exit() and _Exit() *do* run the static
- // destructors of objects in DLLs, a violation of the C++ standard (see
- // [support.start.term]). So we bypass std::abort() and directly
- // terminate the application.
-
-# if defined(Q_CC_MSVC) && !defined(Q_CC_INTEL)
- if (IsProcessorFeaturePresent(PF_FASTFAIL_AVAILABLE))
- __fastfail(FAST_FAIL_FATAL_APP_EXIT);
-# else
- RaiseFailFastException(nullptr, nullptr, 0);
-# endif
-
- // Fallback
- TerminateProcess(GetCurrentProcess(), STATUS_FATAL_APP_EXIT);
-
- // Tell the compiler the application has stopped.
- Q_UNREACHABLE_IMPL();
-#else // !Q_OS_WIN
- std::abort();
-#endif
+ qAbort();
}
@@ -2045,13 +2021,17 @@ void qErrnoWarning(int code, const char *msg, ...)
environment variable; if both \l qSetMessagePattern() is called and QT_MESSAGE_PATTERN is
set, the environment variable takes precedence.
+ \note The information for the placeholders \c category, \c file, \c function and \c line is
+ only recorded in debug builds. Alternatively, \c QT_MESSAGELOGCONTEXT can be defined
+ explicitly. For more information refer to the QMessageLogContext documentation.
+
\note The message pattern only applies to unstructured logging, such as the default
\c stderr output. Structured logging such as systemd will record the message as is,
along with as much structured information as can be captured.
Custom message handlers can use qFormatLogMessage() to take \a pattern into account.
- \sa qInstallMessageHandler(), {Debugging Techniques}, {QLoggingCategory}
+ \sa qInstallMessageHandler(), {Debugging Techniques}, {QLoggingCategory}, QMessageLogContext
*/
QtMessageHandler qInstallMessageHandler(QtMessageHandler h)
diff --git a/src/corelib/global/qnamespace.h b/src/corelib/global/qnamespace.h
index 48bbba655e..6052234545 100644
--- a/src/corelib/global/qnamespace.h
+++ b/src/corelib/global/qnamespace.h
@@ -1460,6 +1460,7 @@ namespace Qt {
enum LayoutDirection {
LeftToRight,
RightToLeft,
+ // ### Qt 7: make auto the first one (with value 0)
LayoutDirectionAuto
};
diff --git a/src/corelib/global/qnamespace.qdoc b/src/corelib/global/qnamespace.qdoc
index 0ad279f16c..59a479d3d4 100644
--- a/src/corelib/global/qnamespace.qdoc
+++ b/src/corelib/global/qnamespace.qdoc
@@ -1126,10 +1126,10 @@
e.g., when a hidden widget was resized. This flag is set or cleared by the
Qt kernel.
- \value WA_QuitOnClose Makes Qt quit the application when the last widget
- with the attribute set has accepted closeEvent(). This behavior can be
- modified with the QApplication::quitOnLastWindowClosed property. By default
- this attribute is set for all widgets of type Qt::Window.
+ \value WA_QuitOnClose Indicates that the widget should be taken into account
+ when deciding whether to quit the application when the last window is closed.
+ This behavior can be modified with the QGuiApplication::quitOnLastWindowClosed
+ property. By default this attribute is set for all widgets of type Qt::Window.
\value WA_Resized Indicates that the widget has an explicit size. This flag
is set or cleared by QWidget::resize() and QWidget::setGeometry().
@@ -2659,7 +2659,8 @@
\value ImCursorRectangle The rectangle covering the area of the input cursor in widget coordinates.
\value ImFont The currently used font for text input.
\value ImCursorPosition The logical position of the cursor within the text surrounding the input area
- (see \c ImSurroundingText).
+ (see \c ImSurroundingText). The position does not incorporate the offset of
+ the cursor within the preedit area, as controlled by QInputMethodEvent::Cursor.
\value ImSurroundingText The plain text around the input area, for example the current paragraph.
\value ImCurrentSelection The currently selected text.
\value ImMaximumTextLength The maximum number of characters that the widget can hold. If there is no limit,
@@ -2670,7 +2671,9 @@
\value ImHints The hints for input method on expected input. (See Qt::InputMethodHints)
\value ImPreferredLanguage The preferred input language.
\value ImPlatformData Platform specific data for input method.
- \value ImAbsolutePosition The logical position of the cursor within the entire document.
+ \value ImAbsolutePosition The logical position of the cursor within the entire document. The position does
+ not incorporate the offset of the cursor within the preedit area, as controlled
+ by QInputMethodEvent::Cursor.
\value ImTextBeforeCursor The plain text before the cursor. The widget can decide how much text to return,
but \b{must} not return an empty string unless the cursor is at the start of the document.
\value ImTextAfterCursor The plain text after the cursor. The widget can decide how much text to return,
diff --git a/src/corelib/global/qnativeinterface.h b/src/corelib/global/qnativeinterface.h
index 5e5c78beec..56805d5a6e 100644
--- a/src/corelib/global/qnativeinterface.h
+++ b/src/corelib/global/qnativeinterface.h
@@ -69,6 +69,8 @@ QT_BEGIN_NAMESPACE
template <typename> \
friend struct QNativeInterface::Private::TypeInfo; \
public: \
+ NativeInterface() = default; \
+ Q_DISABLE_COPY_MOVE(NativeInterface)
// Revisioned interfaces only make sense when exposed through a base
// type via QT_DECLARE_NATIVE_INTERFACE_ACCESSOR, as the revision
@@ -163,6 +165,11 @@ namespace QNativeInterface::Private {
} // QNativeInterface::Private
// Declares an accessor for the native interface
+#ifdef Q_QDOC
+#define QT_DECLARE_NATIVE_INTERFACE_ACCESSOR(T) \
+ template <typename QNativeInterface> \
+ QNativeInterface *nativeInterface() const;
+#else
#define QT_DECLARE_NATIVE_INTERFACE_ACCESSOR(T) \
template <typename NativeInterface, typename TypeInfo = QNativeInterface::Private::NativeInterface<NativeInterface>, \
typename BaseType = T, std::enable_if_t<TypeInfo::template isCompatibleWith<T>, bool> = true> \
@@ -174,6 +181,7 @@ namespace QNativeInterface::Private {
protected: \
void *resolveInterface(const char *name, int revision) const; \
public:
+#endif
// Provides a definition for the interface destructor
#define QT_DEFINE_NATIVE_INTERFACE_2(Namespace, InterfaceClass) \
diff --git a/src/corelib/global/qoperatingsystemversion.cpp b/src/corelib/global/qoperatingsystemversion.cpp
index 3603852c82..61f64306e2 100644
--- a/src/corelib/global/qoperatingsystemversion.cpp
+++ b/src/corelib/global/qoperatingsystemversion.cpp
@@ -49,7 +49,7 @@
#include <qversionnumber.h>
#include <qdebug.h>
-#if defined(Q_OS_ANDROID) && !defined(Q_OS_ANDROID_EMBEDDED)
+#ifdef Q_OS_ANDROID
#include <QJniObject>
#endif
@@ -93,7 +93,8 @@ QT_BEGIN_NAMESPACE
\row
\li Windows
\li dwMajorVersion, dwMinorVersion, and dwBuildNumber from
- \l{https://msdn.microsoft.com/en-us/library/mt723418.aspx}{RtlGetVersion} -
+ \l{https://docs.microsoft.com/en-us/windows/win32/devnotes/rtlgetversion}
+ {RtlGetVersion} -
note that this function ALWAYS return the version number of the
underlying operating system, as opposed to the shim underneath
GetVersionEx that hides the real version number if the
@@ -155,7 +156,7 @@ QOperatingSystemVersion QOperatingSystemVersion::current()
{
QOperatingSystemVersion version;
version.m_os = currentType();
-#if defined(Q_OS_ANDROID) && !defined(Q_OS_ANDROID_EMBEDDED)
+#ifdef Q_OS_ANDROID
#ifndef QT_BOOTSTRAPPED
const QVersionNumber v = QVersionNumber::fromString(QJniObject::getStaticObjectField(
"android/os/Build$VERSION", "RELEASE", "Ljava/lang/String;").toString());
diff --git a/src/corelib/global/qoperatingsystemversion_win.cpp b/src/corelib/global/qoperatingsystemversion_win.cpp
index eb58b60788..c514aaf54d 100644
--- a/src/corelib/global/qoperatingsystemversion_win.cpp
+++ b/src/corelib/global/qoperatingsystemversion_win.cpp
@@ -90,25 +90,13 @@ OSVERSIONINFOEX qWindowsVersionInfo()
result.wServicePackMinor = 0;
const QByteArray winVerOverride = qgetenv("QT_WINVER_OVERRIDE");
- if (winVerOverride == "WINDOWS7" || winVerOverride == "2008_R2") {
- result.dwMajorVersion = 6;
- result.dwMinorVersion = 1;
- } else if (winVerOverride == "WINDOWS8" || winVerOverride == "2012") {
- result.dwMajorVersion = 6;
- result.dwMinorVersion = 2;
- } else if (winVerOverride == "WINDOWS8_1" || winVerOverride == "2012_R2") {
- result.dwMajorVersion = 6;
- result.dwMinorVersion = 3;
- } else if (winVerOverride == "WINDOWS10" || winVerOverride == "2016") {
+ if (winVerOverride == "WINDOWS10" || winVerOverride == "2016") {
result.dwMajorVersion = 10;
} else {
return realResult;
}
- if (winVerOverride == "2008_R2"
- || winVerOverride == "2012"
- || winVerOverride == "2012_R2"
- || winVerOverride == "2016") {
+ if (winVerOverride == "2016") {
// If the current host OS is a domain controller and the override OS
// is also a server type OS, preserve that information
if (result.wProductType == VER_NT_WORKSTATION)
diff --git a/src/corelib/global/qprocessordetection.h b/src/corelib/global/qprocessordetection.h
index f7bca43345..72cc0b4ad4 100644
--- a/src/corelib/global/qprocessordetection.h
+++ b/src/corelib/global/qprocessordetection.h
@@ -340,6 +340,10 @@
# define Q_PROCESSOR_WASM
# define Q_BYTE_ORDER Q_LITTLE_ENDIAN
# define Q_PROCESSOR_WORDSIZE 8
+#ifdef QT_COMPILER_SUPPORTS_SSE2
+# define Q_PROCESSOR_X86 6 // enables SIMD support
+#endif
+
#endif
/*
diff --git a/src/corelib/global/qrandom.cpp b/src/corelib/global/qrandom.cpp
index b699dcbece..34df85133b 100644
--- a/src/corelib/global/qrandom.cpp
+++ b/src/corelib/global/qrandom.cpp
@@ -231,7 +231,7 @@ static void fallback_fill(quint32 *ptr, qsizetype left) noexcept
static QBasicAtomicInteger<unsigned> seed = Q_BASIC_ATOMIC_INITIALIZER(0U);
static void fallback_update_seed(unsigned value)
{
- // Update the seed to be used for the fallback mechansim, if we need to.
+ // Update the seed to be used for the fallback mechanism, if we need to.
// We can't use QtPrivate::QHashCombine here because that is not an atomic
// operation. A simple XOR will have to do then.
seed.fetchAndXorRelaxed(value);
@@ -671,7 +671,7 @@ inline QRandomGenerator::SystemGenerator &QRandomGenerator::SystemGenerator::sel
position in the deterministic sequence as the \a other object was. Both
objects will generate the same sequence from this point on.
- For that reason, it is not adviseable to create a copy of
+ For that reason, it is not advisable to create a copy of
QRandomGenerator::global(). If one needs an exclusive deterministic
generator, consider instead using securelySeeded() to obtain a new object
that shares no relationship with the QRandomGenerator::global().
diff --git a/src/corelib/global/qsimd_p.h b/src/corelib/global/qsimd_p.h
index 35979176fa..118a62e6ac 100644
--- a/src/corelib/global/qsimd_p.h
+++ b/src/corelib/global/qsimd_p.h
@@ -190,10 +190,13 @@
# define __SSE__ 1
# endif
-# if defined(Q_CC_GNU) && !defined(Q_CC_INTEL)
+# if defined(Q_CC_GNU) && !defined(Q_CC_INTEL) && !defined(Q_OS_WASM)
// GCC 4.4 and Clang 2.8 added a few more intrinsics there
# include <x86intrin.h>
# endif
+#ifdef Q_OS_WASM
+# include <immintrin.h>
+# endif
# if defined(__SSE4_2__) && defined(QT_COMPILER_SUPPORTS_SIMD_ALWAYS) && (defined(Q_CC_INTEL) || defined(Q_CC_MSVC))
// POPCNT instructions:
diff --git a/src/corelib/global/qt_pch.h b/src/corelib/global/qt_pch.h
index 6108b075f0..eccb7ba169 100644
--- a/src/corelib/global/qt_pch.h
+++ b/src/corelib/global/qt_pch.h
@@ -72,7 +72,7 @@ __declspec(selectany) auto *__wmemchr_symbol_loader_value = wmemchr(L"", L'0', 0
# include <qcoreevent.h>
# include <qiodevice.h>
# include <qlist.h>
-# include <qvariant.h> /* All moc genereated code has this include */
+# include <qvariant.h> /* All moc generated code has this include */
# include <qobject.h>
# if QT_CONFIG(regularexpression)
# include <qregularexpression.h>
diff --git a/src/corelib/global/qtypeinfo.h b/src/corelib/global/qtypeinfo.h
index 58f20b7be4..7759eff370 100644
--- a/src/corelib/global/qtypeinfo.h
+++ b/src/corelib/global/qtypeinfo.h
@@ -311,6 +311,8 @@ using expand_operator_less_than_recursive = std::conjunction<expand_operator_les
template<typename T>
struct expand_operator_less_than_tuple : has_operator_less_than<T> {};
+template<typename T>
+struct expand_operator_less_than_tuple<std::optional<T>> : has_operator_less_than<T> {};
template<typename T1, typename T2>
struct expand_operator_less_than_tuple<std::pair<T1, T2>> : expand_operator_less_than_recursive<T1, T2> {};
template<typename ...T>
@@ -335,17 +337,29 @@ struct has_operator_equal : detail::expand_operator_equal<T> {};
template<typename T>
inline constexpr bool has_operator_equal_v = has_operator_equal<T>::value;
+template <typename Container, typename T>
+using has_operator_equal_container = std::disjunction<std::is_base_of<Container, T>, QTypeTraits::has_operator_equal<T>>;
+
template<typename T>
struct has_operator_less_than : detail::expand_operator_less_than<T> {};
template<typename T>
inline constexpr bool has_operator_less_than_v = has_operator_less_than<T>::value;
+template <typename Container, typename T>
+using has_operator_less_than_container = std::disjunction<std::is_base_of<Container, T>, QTypeTraits::has_operator_less_than<T>>;
+
template <typename ...T>
using compare_eq_result = std::enable_if_t<std::conjunction_v<QTypeTraits::has_operator_equal<T>...>, bool>;
+template <typename Container, typename ...T>
+using compare_eq_result_container = std::enable_if_t<std::conjunction_v<QTypeTraits::has_operator_equal_container<Container, T>...>, bool>;
+
template <typename ...T>
using compare_lt_result = std::enable_if_t<std::conjunction_v<QTypeTraits::has_operator_less_than<T>...>, bool>;
+template <typename Container, typename ...T>
+using compare_lt_result_container = std::enable_if_t<std::conjunction_v<QTypeTraits::has_operator_less_than_container<Container, T>...>, bool>;
+
namespace detail {
template<typename T>
@@ -363,6 +377,9 @@ struct has_ostream_operator<Stream, T, std::void_t<decltype(detail::reference<St
template <typename Stream, typename T>
inline constexpr bool has_ostream_operator_v = has_ostream_operator<Stream, T>::value;
+template <typename Stream, typename Container, typename T>
+using has_ostream_operator_container = std::disjunction<std::is_base_of<Container, T>, QTypeTraits::has_ostream_operator<Stream, T>>;
+
template <typename Stream, typename, typename = void>
struct has_istream_operator : std::false_type {};
template <typename Stream, typename T>
@@ -370,6 +387,8 @@ struct has_istream_operator<Stream, T, std::void_t<decltype(detail::reference<St
: std::true_type {};
template <typename Stream, typename T>
inline constexpr bool has_istream_operator_v = has_istream_operator<Stream, T>::value;
+template <typename Stream, typename Container, typename T>
+using has_istream_operator_container = std::disjunction<std::is_base_of<Container, T>, QTypeTraits::has_istream_operator<Stream, T>>;
template <typename Stream, typename T>
inline constexpr bool has_stream_operator_v = has_ostream_operator_v<Stream, T> && has_istream_operator_v<Stream, T>;
diff --git a/src/corelib/global/qversiontagging.cpp b/src/corelib/global/qversiontagging.cpp
index b5e524bf4c..a0d15ae871 100644
--- a/src/corelib/global/qversiontagging.cpp
+++ b/src/corelib/global/qversiontagging.cpp
@@ -102,7 +102,6 @@ make_versioned_symbol(SYM, QT_VERSION_MAJOR, 14, "@");
make_versioned_symbol(SYM, QT_VERSION_MAJOR, 15, "@");
#endif
#if QT_VERSION_MINOR > 16
-// We don't expect there will be a Qt 5.17
# error "Please update this file with more Qt versions."
#endif