Purge Q_{STDLIB,COMPILER}_UNICODE_STRINGS
These were now always defined, hence redundant. Leave the #define in place so that we can verify we actually do always define it, in a #else of an existing #if check on it. Change-Id: Iea4c3dbc8f9982268bcf81da5ef17fe2ebf5c462 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
parent
c4378b8620
commit
533df067e9
@ -14,9 +14,7 @@ defines += Q_QDOC \
|
||||
QT_DEPRECATED_* \
|
||||
Q_NO_USING_KEYWORD \
|
||||
Q_OS_.* \
|
||||
Q_STDLIB_UNICODE_STRINGS \
|
||||
Q_COMPILER_INITIALIZER_LISTS \
|
||||
Q_COMPILER_UNICODE_STRINGS \
|
||||
Q_COMPILER_UNIFORM_INIT \
|
||||
Q_COMPILER_RVALUE_REFS
|
||||
|
||||
@ -54,10 +52,8 @@ clangdefines += Q_QDOC \
|
||||
Q_COMPILER_RVALUE_REFS \
|
||||
Q_COMPILER_STATIC_ASSERT \
|
||||
Q_COMPILER_UNIFORM_INIT \
|
||||
Q_COMPILER_UNICODE_STRINGS \
|
||||
Q_COMPILER_VARIADIC_MACROS \
|
||||
Q_COMPILER_VARIADIC_TEMPLATES \
|
||||
Q_STDLIB_UNICODE_STRINGS \
|
||||
Q_ATOMIC_INT16_IS_SUPPORTED \
|
||||
Q_ATOMIC_INT64_IS_SUPPORTED \
|
||||
Q_ATOMIC_INT8_IS_SUPPORTED \
|
||||
|
@ -1,6 +1,6 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2016 The Qt Company Ltd.
|
||||
** Copyright (C) 2020 The Qt Company Ltd.
|
||||
** Copyright (C) 2016 Intel Corporation.
|
||||
** Contact: https://www.qt.io/licensing/
|
||||
**
|
||||
@ -991,6 +991,8 @@
|
||||
|
||||
#ifdef Q_COMPILER_UNICODE_STRINGS
|
||||
# define Q_STDLIB_UNICODE_STRINGS
|
||||
#elif defined(__cplusplus)
|
||||
# error "Qt6 requires Unicode string support in both the compiler and the standard library"
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
@ -2481,15 +2481,11 @@ QString QSysInfo::currentCpuArchitecture()
|
||||
*/
|
||||
QString QSysInfo::buildAbi()
|
||||
{
|
||||
#ifdef Q_COMPILER_UNICODE_STRINGS
|
||||
// ARCH_FULL is a concatenation of strings (incl. ARCH_PROCESSOR), which breaks
|
||||
// QStringLiteral on MSVC. Since the concatenation behavior we want is specified
|
||||
// the same C++11 paper as the Unicode strings, we'll use that macro and hope
|
||||
// that Microsoft implements the new behavior when they add support for Unicode strings.
|
||||
return QStringLiteral(ARCH_FULL);
|
||||
#else
|
||||
return QLatin1String(ARCH_FULL);
|
||||
#endif
|
||||
}
|
||||
|
||||
static QString unknownText()
|
||||
|
@ -129,10 +129,8 @@ public:
|
||||
inline QDebug &operator<<(char t) { stream->ts << t; return maybeSpace(); }
|
||||
inline QDebug &operator<<(signed short t) { stream->ts << t; return maybeSpace(); }
|
||||
inline QDebug &operator<<(unsigned short t) { stream->ts << t; return maybeSpace(); }
|
||||
#ifdef Q_COMPILER_UNICODE_STRINGS
|
||||
inline QDebug &operator<<(char16_t t) { return *this << QChar(ushort(t)); }
|
||||
inline QDebug &operator<<(char32_t t) { putUcs4(t); return maybeSpace(); }
|
||||
#endif
|
||||
inline QDebug &operator<<(signed int t) { stream->ts << t; return maybeSpace(); }
|
||||
inline QDebug &operator<<(unsigned int t) { stream->ts << t; return maybeSpace(); }
|
||||
inline QDebug &operator<<(signed long t) { stream->ts << t; return maybeSpace(); }
|
||||
|
@ -1,6 +1,6 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2019 The Qt Company Ltd.
|
||||
** Copyright (C) 2020 The Qt Company Ltd.
|
||||
** Contact: https://www.qt.io/licensing/
|
||||
**
|
||||
** This file is part of the QtCore module of the Qt Toolkit.
|
||||
@ -102,9 +102,7 @@ public:
|
||||
constexpr QChar(int rc) noexcept : ucs(char16_t(rc & 0xffff)) {}
|
||||
constexpr QChar(SpecialCharacter s) noexcept : ucs(char16_t(s)) {} // implicit
|
||||
constexpr QChar(QLatin1Char ch) noexcept : ucs(ch.unicode()) {} // implicit
|
||||
#if defined(Q_COMPILER_UNICODE_STRINGS)
|
||||
constexpr QChar(char16_t ch) noexcept : ucs(ch) {} // implicit
|
||||
#endif
|
||||
#if defined(Q_OS_WIN)
|
||||
static_assert(sizeof(wchar_t) == sizeof(char16_t));
|
||||
#endif
|
||||
|
@ -905,12 +905,10 @@ public:
|
||||
static inline QString fromStdWString(const std::wstring &s);
|
||||
inline std::wstring toStdWString() const;
|
||||
|
||||
#if defined(Q_STDLIB_UNICODE_STRINGS) || defined(Q_QDOC)
|
||||
static inline QString fromStdU16String(const std::u16string &s);
|
||||
inline std::u16string toStdU16String() const;
|
||||
static inline QString fromStdU32String(const std::u32string &s);
|
||||
inline std::u32string toStdU32String() const;
|
||||
#endif
|
||||
|
||||
#if defined(Q_OS_DARWIN) || defined(Q_QDOC)
|
||||
static QString fromCFString(CFStringRef string);
|
||||
@ -1380,7 +1378,6 @@ inline std::wstring QString::toStdWString() const
|
||||
inline QString QString::fromStdWString(const std::wstring &s)
|
||||
{ return fromWCharArray(s.data(), int(s.size())); }
|
||||
|
||||
#if defined(Q_STDLIB_UNICODE_STRINGS)
|
||||
inline QString QString::fromStdU16String(const std::u16string &s)
|
||||
{ return fromUtf16(s.data(), int(s.size())); }
|
||||
|
||||
@ -1398,7 +1395,6 @@ inline std::u32string QString::toStdU32String() const
|
||||
u32str.resize(len);
|
||||
return u32str;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if !defined(QT_NO_DATASTREAM) || (defined(QT_BOOTSTRAPPED) && !defined(QT_BUILD_QMAKE))
|
||||
Q_CORE_EXPORT QDataStream &operator<<(QDataStream &, const QString &);
|
||||
|
@ -187,7 +187,6 @@ template <> struct QConcatenable<char> : private QAbstractConcatenable
|
||||
{ *out++ = c; }
|
||||
};
|
||||
|
||||
#if defined(Q_COMPILER_UNICODE_STRINGS)
|
||||
template <> struct QConcatenable<char16_t> : private QAbstractConcatenable
|
||||
{
|
||||
typedef char16_t type;
|
||||
@ -197,7 +196,6 @@ template <> struct QConcatenable<char16_t> : private QAbstractConcatenable
|
||||
static inline void appendTo(char16_t c, QChar *&out)
|
||||
{ *out++ = c; }
|
||||
};
|
||||
#endif
|
||||
|
||||
template <> struct QConcatenable<QLatin1Char>
|
||||
{
|
||||
@ -329,7 +327,6 @@ template <> struct QConcatenable<char *> : QConcatenable<const char*>
|
||||
typedef char *type;
|
||||
};
|
||||
|
||||
#if defined(Q_COMPILER_UNICODE_STRINGS)
|
||||
template <int N> struct QConcatenable<const char16_t[N]> : private QAbstractConcatenable
|
||||
{
|
||||
using type = const char16_t[N];
|
||||
@ -367,7 +364,6 @@ template <> struct QConcatenable<char16_t *> : QConcatenable<const char16_t*>
|
||||
{
|
||||
typedef char16_t *type;
|
||||
};
|
||||
#endif // UNICODE_STRINGS
|
||||
|
||||
template <> struct QConcatenable<QByteArray> : private QAbstractConcatenable
|
||||
{
|
||||
|
@ -1705,9 +1705,7 @@ static_assert(sizeof(QAtomicInteger<long>));
|
||||
static_assert(sizeof(QAtomicInteger<unsigned long>));
|
||||
static_assert(sizeof(QAtomicInteger<quintptr>));
|
||||
static_assert(sizeof(QAtomicInteger<qptrdiff>));
|
||||
#ifdef Q_COMPILER_UNICODE_STRINGS
|
||||
static_assert(sizeof(QAtomicInteger<char32_t>));
|
||||
#endif
|
||||
|
||||
#ifdef Q_ATOMIC_INT16_IS_SUPPORTED
|
||||
static_assert(sizeof(QAtomicInteger<short>));
|
||||
@ -1715,9 +1713,7 @@ static_assert(sizeof(QAtomicInteger<unsigned short>));
|
||||
# if WCHAR_MAX < 0x10000
|
||||
static_assert(sizeof(QAtomicInteger<wchar_t>));
|
||||
# endif
|
||||
# ifdef Q_COMPILER_UNICODE_STRINGS
|
||||
static_assert(sizeof(QAtomicInteger<char16_t>));
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifdef Q_ATOMIC_INT64_IS_SUPPORTED
|
||||
|
@ -78,14 +78,10 @@ private slots:
|
||||
|
||||
void tst_QChar::fromChar16_t()
|
||||
{
|
||||
#if defined(Q_COMPILER_UNICODE_STRINGS)
|
||||
QChar aUmlaut = u'\u00E4'; // German small letter a-umlaut
|
||||
QCOMPARE(aUmlaut, QChar(0xE4));
|
||||
QChar replacementCharacter = u'\uFFFD';
|
||||
QCOMPARE(replacementCharacter, QChar(QChar::ReplacementCharacter));
|
||||
#else
|
||||
QSKIP("This test requires C++11 char16_t support enabled in the compiler.");
|
||||
#endif
|
||||
}
|
||||
|
||||
void tst_QChar::fromUcs4_data()
|
||||
|
@ -541,7 +541,8 @@ private slots:
|
||||
void split_regularexpression();
|
||||
void fromUtf16_data();
|
||||
void fromUtf16();
|
||||
void fromUtf16_char16_data();
|
||||
void fromUtf16_char16_data() { fromUtf16_data(); }
|
||||
|
||||
void fromUtf16_char16();
|
||||
void latin1String();
|
||||
void nanAndInf();
|
||||
@ -4506,7 +4507,6 @@ void tst_QString::fromUcs4()
|
||||
QVERIFY( !s.isNull() );
|
||||
QCOMPARE( s.size(), 2 );
|
||||
|
||||
#ifdef Q_COMPILER_UNICODE_STRINGS
|
||||
static const char32_t str1[] = U"Hello Unicode World";
|
||||
s = QString::fromUcs4(str1, sizeof(str1) / sizeof(str1[0]) - 1);
|
||||
QCOMPARE(s, QString("Hello Unicode World"));
|
||||
@ -4519,7 +4519,6 @@ void tst_QString::fromUcs4()
|
||||
|
||||
s = QString::fromUcs4(U"\u221212\U000020AC\U00010000");
|
||||
QCOMPARE(s, QString::fromUtf8("\342\210\222" "12" "\342\202\254" "\360\220\200\200"));
|
||||
#endif
|
||||
|
||||
// QTBUG-62011: don't mistake ZWNBS for BOM
|
||||
// Start with one BOM, to ensure we use the right endianness:
|
||||
@ -5687,29 +5686,17 @@ void tst_QString::fromUtf16()
|
||||
QCOMPARE(QString::fromUtf16(ucs2.utf16(), len), res);
|
||||
}
|
||||
|
||||
void tst_QString::fromUtf16_char16_data()
|
||||
{
|
||||
#ifdef Q_COMPILER_UNICODE_STRINGS
|
||||
fromUtf16_data();
|
||||
#else
|
||||
QSKIP("Compiler does not support C++11 unicode strings");
|
||||
#endif
|
||||
}
|
||||
|
||||
void tst_QString::fromUtf16_char16()
|
||||
{
|
||||
#ifdef Q_COMPILER_UNICODE_STRINGS
|
||||
QFETCH(QString, ucs2);
|
||||
QFETCH(QString, res);
|
||||
QFETCH(int, len);
|
||||
|
||||
QCOMPARE(QString::fromUtf16(reinterpret_cast<const char16_t *>(ucs2.utf16()), len), res);
|
||||
#endif
|
||||
}
|
||||
|
||||
void tst_QString::unicodeStrings()
|
||||
{
|
||||
#ifdef Q_STDLIB_UNICODE_STRINGS
|
||||
QString s1, s2;
|
||||
static const std::u16string u16str1(u"Hello Unicode World");
|
||||
static const std::u32string u32str1(U"Hello Unicode World");
|
||||
@ -5723,9 +5710,6 @@ void tst_QString::unicodeStrings()
|
||||
|
||||
s1 = QString::fromStdU32String(std::u32string(U"\u221212\U000020AC\U00010000"));
|
||||
QCOMPARE(s1, QString::fromUtf8("\342\210\222" "12" "\342\202\254" "\360\220\200\200"));
|
||||
#else
|
||||
QSKIP("Standard Library does not support C++11 unicode strings");
|
||||
#endif
|
||||
}
|
||||
|
||||
void tst_QString::latin1String()
|
||||
|
@ -38,12 +38,10 @@
|
||||
#define UTF8_LITERAL_LEN (sizeof(UTF8_LITERAL)-1)
|
||||
#define UTF8_LITERAL_EXTRA "s\xc3\xb6m\xc3\xab l\xc3\xaft\xc3\xabr\xc3\xa4l" "EXTRA"
|
||||
|
||||
#ifdef Q_COMPILER_UNICODE_STRINGS
|
||||
// "some literal", but replacing all vocals by their umlauted UTF-8 string :)
|
||||
#define UNICODE_LITERAL u"s\u00f6m\u00eb l\u00eft\u00ebr\u00e4l"
|
||||
#define UNICODE_LITERAL_LEN ((sizeof(UNICODE_LITERAL) - 1) / 2)
|
||||
#define UNICODE_LITERAL_EXTRA u"s\u00f6m\u00eb l\u00eft\u00ebr\u00e4l" "EXTRA"
|
||||
#endif
|
||||
|
||||
#ifndef P
|
||||
# error You need to define P
|
||||
@ -64,11 +62,9 @@ template <> QString toQString(const QLatin1String &l) { return l; }
|
||||
template <> QString toQString(const QLatin1Char &l) { return QChar(l); }
|
||||
template <> QString toQString(const QChar &c) { return c; }
|
||||
template <> QString toQString(const QChar::SpecialCharacter &c) { return QChar(c); }
|
||||
#ifdef Q_COMPILER_UNICODE_STRINGS
|
||||
template <> QString toQString(char16_t * const &p) { return QStringView(p).toString(); }
|
||||
template <size_t N> QString toQString(const char16_t (&a)[N]) { return QStringView(a).toString(); }
|
||||
template <> QString toQString(const char16_t &c) { return QChar(c); }
|
||||
#endif
|
||||
|
||||
template <typename T> QByteArray toQByteArray(const T &t);
|
||||
|
||||
@ -87,12 +83,10 @@ void runScenario()
|
||||
QLatin1Char lchar('c');
|
||||
QChar qchar(lchar);
|
||||
QChar::SpecialCharacter special(QChar::Nbsp);
|
||||
#ifdef Q_COMPILER_UNICODE_STRINGS
|
||||
char16_t u16char = UNICODE_LITERAL[0];
|
||||
char16_t u16chararray[] = { u's', 0xF6, u'm', 0xEB, u' ', u'l', 0xEF, u't', 0xEB, u'r', 0xE4, u'l', 0x00 };
|
||||
QCOMPARE(QStringView(u16chararray), QStringView(UNICODE_LITERAL));
|
||||
char16_t *u16charstar = u16chararray;
|
||||
#endif
|
||||
|
||||
#define CHECK(QorP, a1, a2) \
|
||||
do { \
|
||||
@ -214,11 +208,9 @@ void runScenario()
|
||||
r = lchar + r;
|
||||
QCOMPARE(r, QString(lchar P stringview));
|
||||
|
||||
#ifdef Q_COMPILER_UNICODE_STRINGS
|
||||
r = QStringLiteral(UNICODE_LITERAL);
|
||||
r = r Q QStringLiteral(UNICODE_LITERAL);
|
||||
QCOMPARE(r, r3);
|
||||
#endif
|
||||
|
||||
#ifndef QT_NO_CAST_FROM_ASCII
|
||||
r = string P LITERAL;
|
||||
|
@ -177,10 +177,8 @@ void tst_QAtomicInt::warningFreeHelper()
|
||||
warningFreeHelperTemplate<unsigned int, QBasicAtomicInteger<unsigned int> >();
|
||||
constexprFunctionsHelperTemplate<QBasicAtomicInteger<int> >();
|
||||
constexprFunctionsHelperTemplate<QBasicAtomicInteger<unsigned int> >();
|
||||
# ifdef Q_COMPILER_UNICODE_STRINGS
|
||||
warningFreeHelperTemplate<qint16, QBasicAtomicInteger<char32_t> >();
|
||||
constexprFunctionsHelperTemplate<QBasicAtomicInteger<char32_t> >();
|
||||
# endif
|
||||
|
||||
// pointer-sized integers are always supported:
|
||||
warningFreeHelperTemplate<int, QBasicAtomicInteger<qptrdiff> >();
|
||||
@ -199,10 +197,8 @@ void tst_QAtomicInt::warningFreeHelper()
|
||||
warningFreeHelperTemplate<quint16, QBasicAtomicInteger<quint16> >();
|
||||
constexprFunctionsHelperTemplate<QBasicAtomicInteger<qint16> >();
|
||||
constexprFunctionsHelperTemplate<QBasicAtomicInteger<quint16> >();
|
||||
# ifdef Q_COMPILER_UNICODE_STRINGS
|
||||
warningFreeHelperTemplate<qint16, QBasicAtomicInteger<char16_t> >();
|
||||
constexprFunctionsHelperTemplate<QBasicAtomicInteger<char16_t> >();
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifdef Q_ATOMIC_INT8_IS_SUPPORTED
|
||||
|
@ -75,9 +75,7 @@
|
||||
|| (defined(WCHAR_MAX) && (WCHAR_MAX-0 > 0x10000))
|
||||
# define TYPE_SUPPORTED_wchar_t 1
|
||||
#endif
|
||||
#ifdef Q_COMPILER_UNICODE_STRINGS
|
||||
# define TYPE_SUPPORTED_char32_t 1
|
||||
#endif
|
||||
#define TYPE_SUPPORTED_char32_t 1
|
||||
|
||||
#ifdef Q_ATOMIC_INT8_IS_SUPPORTED
|
||||
# define TYPE_SUPPORTED_char 1
|
||||
@ -87,9 +85,7 @@
|
||||
#ifdef Q_ATOMIC_INT16_IS_SUPPORTED
|
||||
# define TYPE_SUPPORTED_short 1
|
||||
# define TYPE_SUPPORTED_ushort 1
|
||||
# ifdef Q_COMPILER_UNICODE_STRINGS
|
||||
# define TYPE_SUPPORTED_char16_t 1
|
||||
# endif
|
||||
# define TYPE_SUPPORTED_char16_t 1
|
||||
# ifndef TYPE_SUPPORTED_wchar_t
|
||||
# define TYPE_SUPPORTED_wchar_t 1
|
||||
# endif
|
||||
|
@ -1311,9 +1311,6 @@ void tst_Compiler::cxx11_udl()
|
||||
|
||||
void tst_Compiler::cxx11_unicode_strings()
|
||||
{
|
||||
#ifndef Q_COMPILER_UNICODE_STRINGS
|
||||
QSKIP("Compiler does not support C++11 feature");
|
||||
#else
|
||||
static const char16_t u[] = u"\u200BHello\u00A0World";
|
||||
QCOMPARE(u[0], char16_t(0x200B));
|
||||
|
||||
@ -1322,7 +1319,6 @@ void tst_Compiler::cxx11_unicode_strings()
|
||||
|
||||
QCOMPARE(u"\U00010000"[0], char16_t(0xD800));
|
||||
QCOMPARE(u"\U00010000"[1], char16_t(0xDC00));
|
||||
#endif
|
||||
}
|
||||
|
||||
static void noop(QPair<int, int>) {}
|
||||
|
Loading…
Reference in New Issue
Block a user