From 634e5dd9f2e03198a06269087ad3dd9b59ac87f1 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Tue, 10 Jul 2018 10:02:05 -0700 Subject: QStringLiteral: remove the wchar_t fallback for Windows This isn't necessary anymore, since MSVC 2015 does have Unicode string support and MinGW (GCC) has had it for a long time. More importantly, we must remove this macro: # define QT_UNICODE_LITERAL_II(str) L##str As the updated MSVC preprocessor will no longer support it. See "Behavior 2" in [1] [1] https://blogs.msdn.microsoft.com/vcblog/2018/07/06/msvc-preprocessor-progress-towards-conformance/ Change-Id: Id59bdd8f1a804b809e22fffd15401099a67175d3 Reviewed-by: Samuel Gaist Reviewed-by: Lars Knoll --- src/corelib/tools/qstringliteral.h | 18 +----------------- 1 file changed, 1 insertion(+), 17 deletions(-) diff --git a/src/corelib/tools/qstringliteral.h b/src/corelib/tools/qstringliteral.h index 6a1a74a80e..64296b89fc 100644 --- a/src/corelib/tools/qstringliteral.h +++ b/src/corelib/tools/qstringliteral.h @@ -51,33 +51,17 @@ QT_BEGIN_NAMESPACE typedef QTypedArrayData QStringData; -#if defined(Q_OS_WIN) && !defined(Q_COMPILER_UNICODE_STRINGS) -// fall back to wchar_t if the a Windows compiler does not -// support Unicode string literals, assuming wchar_t is 2 bytes -// on that platform (sanity-checked by static_assert further below) - -#if defined(Q_CC_MSVC) -# define QT_UNICODE_LITERAL_II(str) L##str -#else -# define QT_UNICODE_LITERAL_II(str) L"" str -#endif -typedef wchar_t qunicodechar; - -#else // all our supported compilers support Unicode string literals, // even if their Q_COMPILER_UNICODE_STRING has been revoked due // to lacking stdlib support. But QStringLiteral only needs the // core language feature, so just use u"" here unconditionally: -#define QT_UNICODE_LITERAL_II(str) u"" str typedef char16_t qunicodechar; -#endif - Q_STATIC_ASSERT_X(sizeof(qunicodechar) == 2, "qunicodechar must typedef an integral type of size 2"); -#define QT_UNICODE_LITERAL(str) QT_UNICODE_LITERAL_II(str) +#define QT_UNICODE_LITERAL(str) u"" str #define QStringLiteral(str) \ ([]() Q_DECL_NOEXCEPT -> QString { \ enum { Size = sizeof(QT_UNICODE_LITERAL(str))/2 - 1 }; \ -- cgit v1.2.3