diff options
author | Thiago Macieira <thiago.macieira@intel.com> | 2018-07-10 10:02:05 -0700 |
---|---|---|
committer | Thiago Macieira <thiago.macieira@intel.com> | 2018-08-07 21:50:48 +0000 |
commit | 634e5dd9f2e03198a06269087ad3dd9b59ac87f1 (patch) | |
tree | 1081858195c99657fc26a550ce63482b00429efe /src/corelib/tools/qstringliteral.h | |
parent | 823acb069d92b68b36f1b2bb59575bb0595275b4 (diff) |
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 <samuel.gaist@idiap.ch>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Diffstat (limited to 'src/corelib/tools/qstringliteral.h')
-rw-r--r-- | src/corelib/tools/qstringliteral.h | 18 |
1 files changed, 1 insertions, 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<ushort> 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 }; \ |