[PATCH 5/5] include: Fix conflicting definitions of NULL, wchar_t, wint_t, wctype_t.
Puetz Kevin A
PuetzKevinA at JohnDeere.com
Tue Jul 21 15:10:14 CDT 2020
> When <basetyps.h> defines wchar_t, it must obey -f(no-)short-wchar by
> referring to __WCHAR_TYPE__ which may not be `unsigned short`.
> Similarly, windef.h defining NULL may need to use GCC's __null.
> Otherwise one-definition-rule problems arise depending on whether wine or
> libc headers are included first.
> Implementing these by deferring to the C89-specified libc headers, (or
> msvcrt's versions with -mno-cygwin) ensures matching definitions.
Per the apparent concern about using <uchar.h> in windows headers...
If it helps, stddef.h is a gcc header, not a glibc one i.e., in C89 (and up)
it's part of the "freestanding implementation". So even with a different libc
(or no libc), this header should still be provided by the underlying compiler.
The use of __need_* is GCC-specific, but if those don't work we'll still
get the needed types, just maybe with some extras too.
C89 Section 1.7: A conforming freestanding implementation shall accept any
strictly conforming program in which the use of the features specified in the
library section ($4) is confined to the contents of the standard headers
<float.h> , <limits.h> , <stdarg.h> ,and <stddef.h> .
And jacek pointed out in IRC that tchar.h already includes <wchar.h>.
Not sure how I overlooked that, but I'll clean that up and send v2 patches
once we agree on how to address with the char16_t part.
More information about the wine-devel