From e2fd33db405e2d95b44b5b2d49140c8b36ecb65e Mon Sep 17 00:00:00 2001 From: Jeremy Soller Date: Thu, 11 May 2023 11:26:55 -0600 Subject: [PATCH] Ensure wchar_t and wint_t definitions can coexist with GCC stddef.h --- include/bits/wchar.h | 29 +++++++++++++++++++++-------- 1 file changed, 21 insertions(+), 8 deletions(-) diff --git a/include/bits/wchar.h b/include/bits/wchar.h index 6eddf334de..6838142e81 100644 --- a/include/bits/wchar.h +++ b/include/bits/wchar.h @@ -1,18 +1,31 @@ #ifndef _BITS_WCHAR_H #define _BITS_WCHAR_H -// NULL, size_t -#define __need_size_t -#define __need_NULL -#include - // int32_t, uint32_t, WCHAR_MIN, WCHAR_MAX #include -#define WEOF (0xffffffffu) +#ifndef _WCHAR_T +#define _WCHAR_T + #ifndef __WCHAR_TYPE__ + #define __WCHAR_TYPE__ int32_t + #endif + typedef __WCHAR_TYPE__ wchar_t; +#endif // _WCHAR_T -typedef int32_t wchar_t; -typedef uint32_t wint_t; +#ifndef _WINT_T +#define _WINT_T + #ifndef __WINT_TYPE__ + #define __WINT_TYPE__ uint32_t + #endif + typedef __WINT_TYPE__ wint_t; +#endif // _WINT_T + +// NULL, size_t, must come after wchar_t and wint_t +#define __need_size_t +#define __need_NULL +#include + +#define WEOF (0xffffffffu) int wprintf(const wchar_t * fmt, ...); int fwprintf(FILE * stream, const wchar_t * fmt, ...);