diff options
author | Thiago Macieira <thiago.macieira@intel.com> | 2021-03-21 13:57:48 -0700 |
---|---|---|
committer | Qt Cherry-pick Bot <cherrypick_bot@qt-project.org> | 2021-04-20 19:33:00 +0000 |
commit | 8bae441d902f28db2f34a8eafff1d481ebc7d6e6 (patch) | |
tree | 079a0f7b871ea38e79a535ac865698933cf8bf13 /src/corelib/text/qstringalgorithms.h | |
parent | b1f956106cf0fc41eb12d76bb3625fae7687e5f3 (diff) |
QUtf8StringView: ensure binary compatibility throughout 6.x
We can't depend on whether the user compiles with -std=c++17 or
-std=c++20. So select what we can depend on and make that permanent.
Prior to this change:
$ cat /tmp/test.cpp
#include <QtCore/QUtf8StringView>
void f(QUtf8StringView) {}
$ qcd include
$ g++ -S -o - -I. /tmp/test.cpp | grep globl | c++filt
.globl f(QBasicUtf8StringView<false>)
$ g++ -fPIC -std=c++20 -S -o - -I. /tmp/test.cpp | grep globl | c++filt
.globl f(QBasicUtf8StringView<true>)
After this change, they're both "false". QUtf8StringView should have
been a concrete class that derived from QBsicUtf8StringView<whichever>
and inherited all its constructors. We'd cause ODR violations in C++20,
but nothing worse than what we usually do for BC reasons.
That solution is too late for Qt 6.x. Let's revisit in 7.0.
Change-Id: I6bcbe88c072a438b8b4efffd166e77199ecb39e3
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
(cherry picked from commit c7deb3400faa1d9389137fe63ffbffade8203850)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Diffstat (limited to 'src/corelib/text/qstringalgorithms.h')
-rw-r--r-- | src/corelib/text/qstringalgorithms.h | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/corelib/text/qstringalgorithms.h b/src/corelib/text/qstringalgorithms.h index 5805e4c439..68d47b2893 100644 --- a/src/corelib/text/qstringalgorithms.h +++ b/src/corelib/text/qstringalgorithms.h @@ -48,7 +48,7 @@ QT_BEGIN_NAMESPACE -#ifdef __cpp_char8_t +#if QT_VERSION >= QT_VERSION_CHECK(7, 0, 0) # define QT_BEGIN_HAS_CHAR8_T_NAMESPACE inline namespace q_has_char8_t { # define QT_BEGIN_NO_CHAR8_T_NAMESPACE namespace q_no_char8_t { #else |