From 3d16b8a1b8a9562c63f4a559bff6a7a73bcf86bb Mon Sep 17 00:00:00 2001 From: auronandace Date: Tue, 12 May 2026 11:09:23 +0100 Subject: [PATCH] move wchar_t to stddef header --- include/stddef.h | 13 +++++++++++++ src/header/wchar/cbindgen.toml | 12 +----------- 2 files changed, 14 insertions(+), 11 deletions(-) diff --git a/include/stddef.h b/include/stddef.h index b9c936d26e..6f0449055b 100644 --- a/include/stddef.h +++ b/include/stddef.h @@ -1,6 +1,19 @@ #ifndef _STDDEF_H #define _STDDEF_H #include + +// wchar_t should come before NULL and size_t +// according to comment in wchar cbindgen +#ifndef _WCHAR_T +#define _WCHAR_T +#ifndef __cplusplus + #ifndef __WCHAR_TYPE__ + #define __WCHAR_TYPE__ int32_t + #endif + typedef __WCHAR_TYPE__ wchar_t; +#endif // __cplusplus +#endif // _WCHAR_T + #include #define NULL 0 diff --git a/src/header/wchar/cbindgen.toml b/src/header/wchar/cbindgen.toml index a31881baad..e5b52de4d8 100644 --- a/src/header/wchar/cbindgen.toml +++ b/src/header/wchar/cbindgen.toml @@ -4,19 +4,9 @@ sys_includes = [ "features.h", ] after_includes = """ -// int32_t, uint32_t, WCHAR_MIN, WCHAR_MAX +// uint32_t, WCHAR_MIN, WCHAR_MAX #include -#ifndef _WCHAR_T -#define _WCHAR_T -#ifndef __cplusplus - #ifndef __WCHAR_TYPE__ - #define __WCHAR_TYPE__ int32_t - #endif - typedef __WCHAR_TYPE__ wchar_t; -#endif // __cplusplus -#endif // _WCHAR_T - #ifndef _WINT_T #define _WINT_T #ifndef __WINT_TYPE__