We'd then typedef WCHAR to unsigned short, like we usually do. uchar.h uses unsigned short as well, so the result should be the same without introducing an additional includes.
That could work too, especially since in C char16_t is not a distinct type (and there's no function-overload mangling). Once you have <uchar.h>, char16_t is "the same type as uint16_t", which is almost certainly unsigned short anyway. So it's just a different route to the same result. And, since u"" *is* a built-in, one could even still offer TEXT macros for C11 in the final #else.
e.g. a shape like the following
#if defined(WINE_UNICODE_NATIVE) typedef wchar_t WCHAR #define TEXT(x) L ## x #elif defined(WINE_UNICODE_CHAR16) && defined(__cplusplus) typedef char16_t WCHAR #define TEXT(x) u ## x #else typedef unsigned short WCHAR #if __STDC_UTF_16__ /* C11 */ #define TEXT(x) u ## x #endif #endif
It's a little less more complex (since you need to know how char16_t Is defined to argue that u"" matches this WCHAR), but I think it would work for any compiler that actually has a 16-bit unsigned integral type, and anything so exotic it doesn't can't really plausibly support wine.
Would you prefer that I redo this patch in the above shape? I think it would work, but I personally prefer it as it currently stands (consistently using char16_t in both C and C++). And I think there is sufficient opt-in; if you're on a pre-C11 platform lacking <uchar.h>, or you don’t want any extra utf16 symbols in scope, just don't define WINE_UNICODE_CHAR16.
Another option would be using __CHAR16_TYPE__, though that's gcc-specific. I originally had a version of "include: Fix conflicting definitions of wchar_t..." that used __WCHAR_TYPE__ in this fashion, before I settled on using <stddef.h> as a more portable solution and a path to also fixing my other ODR issue with NULL (e.g. windef.h's 0 is 32-bit, gcc <stddef.h> uses __null, which can be a 64-bit type).