From a2e4cd27fef3a0aae30478ce576759e51c384d64 Mon Sep 17 00:00:00 2001 From: Red Bear OS Date: Sat, 27 Jun 2026 14:31:34 +0300 Subject: [PATCH] Fix inttypes.h circular include: use stdint.h+stddef.h instead of wchar.h MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit inttypes.h included wchar.h for wchar_t and stdint.h, but this created a circular dependency: wchar.h → stdint.h → gnulib inttypes.h → inttypes.h → wchar.h. When gnulib's wchar.h wrapper was re-entered during this cycle, wint_t and mbstate_t were not yet defined. POSIX spec says inttypes.h should include stdint.h directly and wchar_t comes from stddef.h. Using stdint.h + stddef.h breaks the circular chain at its source. --- src/header/inttypes/cbindgen.toml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/header/inttypes/cbindgen.toml b/src/header/inttypes/cbindgen.toml index 568f0cd552..b8c2b7e93b 100644 --- a/src/header/inttypes/cbindgen.toml +++ b/src/header/inttypes/cbindgen.toml @@ -4,8 +4,10 @@ # - "The header shall include the header." # - "wchar_t As described in ." # -# wchar.h brings in both stdint.h and stddef.h -sys_includes = ["wchar.h"] +# Include stdint.h and stddef.h directly per POSIX spec. +# Do NOT include wchar.h — it creates a circular dependency: +# wchar.h → stdint.h → gnulib inttypes.h → inttypes.h → wchar.h +sys_includes = ["stdint.h", "stddef.h"] include_guard = "_RELIBC_INTTYPES_H" trailer = """ #ifndef _RELIBC_BITS_INTTYPES_H