[PATCH 3/5] include: _TEXT(...) should obey _UNICODE to match _TCHAR

Puetz Kevin A PuetzKevinA at JohnDeere.com
Thu Jul 16 20:11:23 CDT 2020


This is, at least pedantically, 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>
---
 include/tchar.h | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/include/tchar.h b/include/tchar.h
index 33db74c7ee..519a9f1002 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;
@@ -248,11 +244,13 @@ typedef unsigned short wctype_t;
 #ifndef __TCHAR_DEFINED
 #if defined(WINE_UNICODE_NATIVE)
 typedef wchar_t       _TCHAR;
+#define __T(x) L##x
 #elif defined(WINE_UNICODE_CHAR16)
 # if !defined(__cplusplus) && !defined(RC_INVOKED)
 #  include <uchar.h> /* Bring in char16_t and char32_t for C */
 # endif
 typedef char16_t      _TCHAR;
+#define __T(x) u##x
 #else
 typedef unsigned short _TCHAR;
 #endif
@@ -264,6 +262,7 @@ typedef _TCHAR        _TINT;
 #endif
 
 #else /* _UNICODE */
+#define __T(x) x
 #ifndef __TCHAR_DEFINED
 typedef char          _TCHAR;
 typedef unsigned char _TUCHAR;
@@ -278,6 +277,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
-- 
2.27.0.windows.1




More information about the wine-devel mailing list