From 3b69b617a2b8056426d2c232a0c0d25ab32b680c Mon Sep 17 00:00:00 2001 From: auronandace Date: Sun, 29 Mar 2026 15:49:01 +0100 Subject: [PATCH 1/3] move wchar bits to cbindgen --- include/bits/wchar.h | 32 -------------------------------- src/header/wchar/cbindgen.toml | 32 +++++++++++++++++++++++++++++--- 2 files changed, 29 insertions(+), 35 deletions(-) delete mode 100644 include/bits/wchar.h diff --git a/include/bits/wchar.h b/include/bits/wchar.h deleted file mode 100644 index e271c72b32..0000000000 --- a/include/bits/wchar.h +++ /dev/null @@ -1,32 +0,0 @@ -#ifndef _BITS_WCHAR_H -#define _BITS_WCHAR_H - -// int32_t, 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__ - #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) - -#endif /* _BITS_WCHAR_H */ diff --git a/src/header/wchar/cbindgen.toml b/src/header/wchar/cbindgen.toml index 4a37b7e3d8..a31881baad 100644 --- a/src/header/wchar/cbindgen.toml +++ b/src/header/wchar/cbindgen.toml @@ -1,11 +1,37 @@ sys_includes = [ - "stddef.h", - "stdint.h", "stdio.h", "time.h", - "bits/wchar.h", "features.h", ] +after_includes = """ +// int32_t, 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__ + #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) +""" include_guard = "_RELIBC_WCHAR_H" language = "C" style = "Type" From 61eb827bc4874cf63175ddc81f9e80b2ff8df0d0 Mon Sep 17 00:00:00 2001 From: auronandace Date: Sun, 29 Mar 2026 16:05:33 +0100 Subject: [PATCH 2/3] fix inttypes after moving wchar bits --- src/header/inttypes/cbindgen.toml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/header/inttypes/cbindgen.toml b/src/header/inttypes/cbindgen.toml index 28710c9e1c..2bcb100765 100644 --- a/src/header/inttypes/cbindgen.toml +++ b/src/header/inttypes/cbindgen.toml @@ -4,10 +4,9 @@ # - "The header shall include the header." # - "wchar_t As described in ." # -# bits/wchar.h brings in both stdint.h and stddef.h -sys_includes = ["bits/wchar.h"] +# wchar.h brings in both stdint.h and stddef.h +sys_includes = ["wchar.h"] include_guard = "_RELIBC_INTTYPES_H" -trailer = "#include " language = "C" style = "Type" no_includes = true From 4130dbce237a8c724fcc970dc730d9d54a38bcc5 Mon Sep 17 00:00:00 2001 From: auronandace Date: Sun, 29 Mar 2026 16:07:58 +0100 Subject: [PATCH 3/3] readd trailer for inttypes bits --- src/header/inttypes/cbindgen.toml | 1 + 1 file changed, 1 insertion(+) diff --git a/src/header/inttypes/cbindgen.toml b/src/header/inttypes/cbindgen.toml index 2bcb100765..c584d5a909 100644 --- a/src/header/inttypes/cbindgen.toml +++ b/src/header/inttypes/cbindgen.toml @@ -7,6 +7,7 @@ # wchar.h brings in both stdint.h and stddef.h sys_includes = ["wchar.h"] include_guard = "_RELIBC_INTTYPES_H" +trailer = "#include " language = "C" style = "Type" no_includes = true