diff --git a/include/stdbool.h b/include/stdbool.h index 59cce7a961..66987b5737 100644 --- a/include/stdbool.h +++ b/include/stdbool.h @@ -2,12 +2,12 @@ #define _STDBOOL_H #ifndef __cplusplus -typedef _Bool bool; +#define bool _Bool #define true 1 #define false 0 #else /* __cplusplus */ -typedef bool _Bool; #if __cplusplus < 201103L +#define bool bool #define false false #define true true #endif /*__cplusplus < 201103L*/ diff --git a/src/header/wchar/cbindgen.toml b/src/header/wchar/cbindgen.toml index 0e1651836f..3ff662b0a3 100644 --- a/src/header/wchar/cbindgen.toml +++ b/src/header/wchar/cbindgen.toml @@ -1,17 +1,9 @@ -sys_includes = ["features.h", "stddef.h", "stdarg.h", "stdio.h"] +# wint_t defined before stddef.h to avoid conflict with GCC's __need_wint_t. +# wchar_t provided by bits/wchar-t.h → stddef.h (no local redefinition needed). +# mbstate_t defined before transitive includes to break circular chains: +# wchar.h → stdio.h → inttypes.h → wchar.h (gnulib-based: m4, bison, flex). 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 +#include // for uint32_t, WCHAR_MIN, WCHAR_MAX #ifndef _WINT_T #define _WINT_T @@ -21,32 +13,24 @@ after_includes = """ typedef __WINT_TYPE__ wint_t; #endif // _WINT_T -// Define mbstate_t before headers that may transitively re-include wchar.h. -// The circular chain wchar.h → stdio.h → inttypes.h → wchar.h (and also -// stdlib.h → wchar.h) would otherwise cause wint_t and mbstate_t to be -// undefined in gnulib's wchar.h wrapper, breaking m4, bison, and other -// gnulib-based packages. #ifndef _RELIBC_MBSTATE_T #define _RELIBC_MBSTATE_T typedef struct {} mbstate_t; #endif -// Now include headers that depend on wchar_t/wint_t/mbstate_t. -// These must come after the type definitions to break circular includes. -#include -#include - -// NULL, size_t, must come after wchar_t and wint_t +// wchar_t comes from stddef.h → bits/wchar-t.h #define __need_size_t #define __need_NULL #include +#include // for FILE +#include // for struct tm #define WEOF (0xffffffffu) """ include_guard = "_RELIBC_WCHAR_H" language = "C" style = "Type" -no_includes = false +no_includes = true cpp_compat = true [export]