split out wchar_t from stddef header

This commit is contained in:
auronandace
2026-06-04 11:17:36 +01:00
parent fafc4c2c00
commit d28a131ec5
5 changed files with 26 additions and 14 deletions
+1 -10
View File
@@ -3,16 +3,7 @@
// wchar_t should come before NULL and size_t
// according to comment in wchar cbindgen
#ifndef _WCHAR_T
#define _WCHAR_T
#ifndef __cplusplus
#ifndef __WCHAR_TYPE__
#define __WCHAR_TYPE__ int
#endif
typedef __WCHAR_TYPE__ wchar_t;
#endif // __cplusplus
#endif // _WCHAR_T
#include <bits/wchar-t.h>
#include <bits/size-t.h>
#include <bits/null.h>
+18
View File
@@ -0,0 +1,18 @@
# POSIX header spec: https://pubs.opengroup.org/onlinepubs/9799919799/basedefs/stddef.h.html
#
# This type is split out to prevent importing all of stddef.h into inttypes.h
include_guard = "_RELIBC_BITS_WCHAR_T_H"
after_includes = """
#ifndef _WCHAR_T
#define _WCHAR_T
#ifndef __cplusplus
#ifndef __WCHAR_TYPE__
#define __WCHAR_TYPE__ int
#endif
typedef __WCHAR_TYPE__ wchar_t;
#endif // __cplusplus
#endif // _WCHAR_T
"""
language = "C"
no_includes = true
cpp_compat = true
+1
View File
@@ -0,0 +1 @@
// `wchar_t` is defined in cbindgen
+4 -4
View File
@@ -3,10 +3,10 @@
# Spec quotations relating to includes:
# - "The <inttypes.h> header shall include the <stdint.h> header."
# - "wchar_t As described in <stddef.h>."
#
# TODO possibly split out wchar_t to avoid including all of stddef.h
# stddef.h also currently includes stdint.h but shouldn't according to the spec
sys_includes = ["stdint.h", "stddef.h"]
sys_includes = ["stdint.h"]
after_includes = """
#include <bits/wchar-t.h> // for wchar_t from stddef.h
"""
include_guard = "_RELIBC_INTTYPES_H"
trailer = """
#ifndef _RELIBC_BITS_INTTYPES_H
+2
View File
@@ -58,6 +58,8 @@ pub mod bits_timeval;
pub mod bits_uid_t;
#[path = "bits_useconds-t/mod.rs"]
pub mod bits_useconds_t;
#[path = "bits_wchar-t/mod.rs"]
pub mod bits_wchar_t;
pub mod bits_winsize;
// complex.h implemented in C (currently through openlibm)
pub mod cpio;