diff --git a/src/header/wchar/cbindgen.toml b/src/header/wchar/cbindgen.toml index a31881ba..9e206fd1 100644 --- a/src/header/wchar/cbindgen.toml +++ b/src/header/wchar/cbindgen.toml @@ -1,17 +1,13 @@ sys_includes = [ - "stdio.h", - "time.h", + "stdarg.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 + #define __WCHAR_TYPE__ int #endif typedef __WCHAR_TYPE__ wchar_t; #endif // __cplusplus @@ -20,7 +16,7 @@ after_includes = """ #ifndef _WINT_T #define _WINT_T #ifndef __WINT_TYPE__ - #define __WINT_TYPE__ uint32_t + #define __WINT_TYPE__ unsigned int #endif typedef __WINT_TYPE__ wint_t; #endif // _WINT_T @@ -31,6 +27,15 @@ after_includes = """ #include #define WEOF (0xffffffffu) + +// FILE. Avoid including stdio.h from wchar.h: gnulib wrappers can reach wchar.h +// recursively through stdio.h -> stdint.h -> inttypes.h before wchar prerequisite +// types are visible. wchar.h only needs FILE as an opaque pointer type. +typedef struct FILE FILE; + +// Avoid including time.h from wchar.h for the same wrapper-recursion reason. +// wcsftime only needs struct tm as an opaque pointer type. +struct tm; """ include_guard = "_RELIBC_WCHAR_H" language = "C"