[PATCH v3 1/4] include: Fix undefined char16_t in C11.

Kevin Puetz PuetzKevinA at johndeere.com
Thu Sep 24 11:07:17 CDT 2020


Since Jacek and I have now been back and forth with several different 
versons,
here's a little higher-level summary to save Alexandre some mental energy:

wine-5.2 added WINE_UNICUDE_CHAR16 
(c2679945dd1ffddbc8e8a43dc7263be7738d4a4e)
but only took only some parts of my original C++11 char16_t patch.
When we finally got 5.0.x working well, I started trying to keep
our patches rebased on master and submit more things upstream.
The two issues whose fix has been controversial are:

1. in C++11 you get can get overloading surprises if the TEXT macro uses 
u""
   (producing char16_t[]) but LPCWSTR/LPCTSTR are some other type.
2. defining WINE_UNICODE_CHAR16 in C or pre-C++11 would use char16_t
   without the #include that defines it.

v1: https://www.winehq.org/pipermail/wine-devel/2020-July/170227.html
This was just rebasing the original solutions we had been using in 
4.x/5.0.x

1. force a compile error (don't use u"") in TEXT without 
WINE_UNICODE_CHAR16
2. get the C11 definition of char16_t from <uchar.h>

v2: https://www.winehq.org/pipermail/wine-devel/2020-September/173888.html

1. use char16_t by default in c++11 (so u"" is then always right)
   Then there's no need for forcing a compile error.
2. use __CHAR16_TYPE__ to define WCHAR (and maybe TCHAR)
   This avoids using <uchar.h> or char16_t, but will be a compatible
   typedef if the user's code does so elsewhere.

v3: https://www.winehq.org/pipermail/wine-devel/2020-September/174356.html

1. Same as v2
2. Just keep `unsigned short`, yeilding to Jacek that this is what
   __CHAR16_TYPE__ would always be anyway. Accept that wine already
   makes a lot of assumptions about size of integer types,
   and doesn't benefit from trying hard to be pedantically portable.  




More information about the wine-devel mailing list