[PATCH v2 3/4] include: _TEXT(...) should obey _UNICODE to match _TCHAR.
Kevin Puetz
PuetzKevinA at JohnDeere.com
Thu Sep 17 17:52:39 CDT 2020
This is, at least pedanticly, independent of the similar macro UNICODE
which controls <windef.h>, e.g. TEXT(), TCHAR, WINELIB_NAME_AW.
So _T(...) and _TEXT(...) can't reuse the implementation of TEXT(...).
Signed-off-by: Kevin Puetz <PuetzKevinA at JohnDeere.com>
---
https://devblogs.microsoft.com/oldnewthing/20040212-00/?p=40643
---
include/tchar.h | 14 +++++++++-----
1 file changed, 9 insertions(+), 5 deletions(-)
diff --git a/include/tchar.h b/include/tchar.h
index 5eb8972563..3f6db726af 100644
--- a/include/tchar.h
+++ b/include/tchar.h
@@ -231,10 +231,6 @@ extern "C" {
#endif /* tchar mappings */
-#define __T(x) __TEXT(x)
-#define _T(x) __T(x)
-#define _TEXT(x) __T(x)
-
#ifdef _UNICODE
#if !defined(_WINT_T_DEFINED) && !defined(__WINT_TYPE__)
typedef unsigned short wint_t;
@@ -247,14 +243,18 @@ typedef unsigned short wctype_t;
#ifndef __TCHAR_DEFINED
#if defined(WINE_UNICODE_NATIVE)
+#define __T(x) L##x
typedef wchar_t _TCHAR;
-#elif __cpp_unicode_literals >= 200710
+#else
+#define __T(x) u##x
+#if __cpp_unicode_literals >= 200710
typedef char16_t _TCHAR;
#elif defined(__CHAR16_TYPE__)
typedef __CHAR16_TYPE__ _TCHAR;
#else
typedef unsigned short _TCHAR;
#endif
+#endif
typedef _TCHAR _TUCHAR;
typedef _TCHAR _TSCHAR;
typedef _TCHAR _TXCHAR;
@@ -263,6 +263,7 @@ typedef _TCHAR _TINT;
#endif
#else /* _UNICODE */
+#define __T(x) x
#ifndef __TCHAR_DEFINED
typedef char _TCHAR;
typedef unsigned char _TUCHAR;
@@ -277,6 +278,9 @@ typedef unsigned int _TINT;
#endif
#endif
+#define _T(x) __T(x)
+#define _TEXT(x) __T(x)
+
#ifndef _TCHAR_DEFINED
typedef _TCHAR TCHAR, *PTCHAR;
#define _TCHAR_DEFINED
More information about the wine-devel
mailing list