summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--doc/global/qt-cpp-defines.qdocconf2
-rw-r--r--src/corelib/global/qcompilerdetection.h7
-rw-r--r--src/corelib/io/qdebug.h2
-rw-r--r--src/corelib/tools/qstring.h4
-rw-r--r--tests/auto/corelib/tools/qstring/tst_qstring.cpp4
5 files changed, 13 insertions, 6 deletions
diff --git a/doc/global/qt-cpp-defines.qdocconf b/doc/global/qt-cpp-defines.qdocconf
index 5068ae8be8..957bf1cc4f 100644
--- a/doc/global/qt-cpp-defines.qdocconf
+++ b/doc/global/qt-cpp-defines.qdocconf
@@ -14,6 +14,7 @@ defines += Q_QDOC \
QT_DEPRECATED_* \
Q_NO_USING_KEYWORD \
__cplusplus \
+ Q_STDLIB_UNICODE_STRINGS \
Q_COMPILER_INITIALIZER_LISTS \
Q_COMPILER_UNICODE_STRINGS \
Q_COMPILER_UNIFORM_INIT \
@@ -57,6 +58,7 @@ clangdefines += __cplusplus \
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 \
diff --git a/src/corelib/global/qcompilerdetection.h b/src/corelib/global/qcompilerdetection.h
index 5497b9e14a..5fc7ac9c7e 100644
--- a/src/corelib/global/qcompilerdetection.h
+++ b/src/corelib/global/qcompilerdetection.h
@@ -994,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)
@@ -1016,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/io/qdebug.h b/src/corelib/io/qdebug.h
index 61059dd694..186722b69b 100644
--- a/src/corelib/io/qdebug.h
+++ b/src/corelib/io/qdebug.h
@@ -139,7 +139,7 @@ public:
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(t); }
+ 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(); }
diff --git a/src/corelib/tools/qstring.h b/src/corelib/tools/qstring.h
index f81a58813d..109b68c544 100644
--- a/src/corelib/tools/qstring.h
+++ b/src/corelib/tools/qstring.h
@@ -756,7 +756,7 @@ public:
static inline QString fromStdWString(const std::wstring &s);
inline std::wstring toStdWString() const;
-#if defined(Q_COMPILER_UNICODE_STRINGS) || defined(Q_QDOC)
+#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);
@@ -1339,7 +1339,7 @@ inline std::wstring QString::toStdWString() const
inline QString QString::fromStdWString(const std::wstring &s)
{ return fromWCharArray(s.data(), int(s.size())); }
-#if defined(Q_COMPILER_UNICODE_STRINGS)
+#if defined(Q_STDLIB_UNICODE_STRINGS)
inline QString QString::fromStdU16String(const std::u16string &s)
{ return fromUtf16(s.data(), int(s.size())); }
diff --git a/tests/auto/corelib/tools/qstring/tst_qstring.cpp b/tests/auto/corelib/tools/qstring/tst_qstring.cpp
index 03436375dd..24f16b9911 100644
--- a/tests/auto/corelib/tools/qstring/tst_qstring.cpp
+++ b/tests/auto/corelib/tools/qstring/tst_qstring.cpp
@@ -5850,7 +5850,7 @@ void tst_QString::fromUtf16_char16()
void tst_QString::unicodeStrings()
{
-#ifdef Q_COMPILER_UNICODE_STRINGS
+#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");
@@ -5865,7 +5865,7 @@ 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("Compiler does not support C++11 unicode strings");
+ QSKIP("Standard Library does not support C++11 unicode strings");
#endif
}