Fix inttypes.h circular include: use stdint.h+stddef.h instead of wchar.h

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.
This commit is contained in:
Red Bear OS
2026-06-27 14:31:34 +03:00
parent d28963d88e
commit a2e4cd27fe
+4 -2
View File
@@ -4,8 +4,10 @@
# - "The <inttypes.h> header shall include the <stdint.h> header."
# - "wchar_t As described in <stddef.h>."
#
# 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