diff --git a/src/header/wchar/cbindgen.toml b/src/header/wchar/cbindgen.toml index e5b52de4d8..15c2a51d33 100644 --- a/src/header/wchar/cbindgen.toml +++ b/src/header/wchar/cbindgen.toml @@ -1,11 +1,26 @@ -sys_includes = [ - "stdio.h", - "time.h", - "features.h", -] +# POSIX header spec: https://pubs.opengroup.org/onlinepubs/9799919799/basedefs/wchar.h.html +# +# Spec quotations relating to includes: +# - "FILE As described in ." +# - "locale_t As described in ." +# - "size_t As described in ." +# - "va_list As described in ." +# - "wchar_t As described in ." +# - "The tag tm shall be declared as naming an incomplete structure type, the contents of which are described in the header." +# - "WCHAR_MAX As described in ." +# - "WCHAR_MIN As described in ." +# - "NULL As described in ." +# - "Inclusion of the header may make visible all symbols from the headers , , , , , , and ." +# +# We use after_includes here instead of sys_includes to better order the includes while interspersing defines between them. +# +# stdint.h is permitted by POSIX to be fully included through the following chain: +# wchar.h > stdlib.h > fcntl.h > unistd.h > stdint.h +# relibc includes stdint.h here directly instead of indirectly because of how other header includes are defined +# time.h brings in bits/locale.h for locale_t +# time.h brings in features.h for deprecated annotations after_includes = """ -// uint32_t, WCHAR_MIN, WCHAR_MAX -#include +#include // for uint32_t, WCHAR_MIN, WCHAR_MAX #ifndef _WINT_T #define _WINT_T @@ -18,7 +33,10 @@ after_includes = """ // NULL, size_t, must come after wchar_t and wint_t #define __need_size_t #define __need_NULL -#include +#include // for size_t, wchar_t and NULL +#include // for va_list +#include // for FILE +#include // for tm #define WEOF (0xffffffffu) """