split out sizt_t from stddef header

This commit is contained in:
auronandace
2026-05-08 14:59:27 +01:00
parent 4596d71bf5
commit dc28f2faef
5 changed files with 55 additions and 4 deletions
+1 -2
View File
@@ -1,6 +1,7 @@
#ifndef _STDDEF_H
#define _STDDEF_H
#include <stdint.h>
#include <bits/size-t.h>
#define NULL 0
@@ -9,8 +10,6 @@
#endif
typedef __PTRDIFF_TYPE__ ptrdiff_t;
typedef long unsigned int size_t;
typedef struct { long long __ll; long double __ld; } max_align_t;
#define offsetof(type, member) __builtin_offsetof(type, member)
+44
View File
@@ -0,0 +1,44 @@
# 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 other headers.
#
# POSIX headers that require size_t:
# - aio.h
# - devctl.h (TODO not present in relibc)
# - dirent.h
# - glob.h
# - grp.h
# - iconv.h (external libiconv (gettext dependency))
# - monetary.h
# - mqueue.h (TODO not present in relibc)
# - nbdm.h (TODO not present in relibc)
# - pwd.h
# - regex.h
# - search.h (TODO not present in relibc)
# - signal.h
# - stdio.h
# - stdlib.h
# - string.h
# - strings.h
# - sys/mman.h
# - sys/msg.h (TODO not present in relibc)
# - sys/sem.h (TODO not present in relibc)
# - sys/shm.h (TODO not present in relibc)
# - sys/socket.h
# - sys/types.h (should be re-exported)
# - sys/uio.h
# - time.h
# - uchar.h (TODO not present in relibc)
# - unistd.h
# - wchar.h
# - wordexp.h (TODO not present in relibc)
sys_includes = []
include_guard = "_RELIBC_BITS_SIZE_T_H"
language = "C"
style = "type"
no_includes = true
cpp_compat = true
[export]
include = ["size_t"]
[enum]
prefix_with_name = true
+5
View File
@@ -0,0 +1,5 @@
use crate::platform::types::c_ulong;
/// Unsigned integer type of the result of the sizeof operator.
#[allow(non_camel_case_types)]
pub type size_t = c_ulong;
+4 -2
View File
@@ -13,6 +13,8 @@ pub mod bits_pthread;
pub mod bits_safamily_t;
#[path = "bits_sigset-t/mod.rs"]
pub mod bits_sigset_t;
#[path = "bits_size-t/mod.rs"]
pub mod bits_size_t;
#[path = "bits_socklen-t/mod.rs"]
pub mod bits_socklen_t;
#[path = "bits_ssize-t/mod.rs"]
@@ -23,7 +25,7 @@ pub mod bits_suseconds_t;
pub mod bits_time_t;
pub mod bits_timespec;
pub mod bits_timeval;
// complex.h implemented in C
// complex.h implemented in C (currently through openlibm)
pub mod cpio;
pub mod crypt;
pub mod ctype;
@@ -134,7 +136,7 @@ pub mod sys_wait;
pub mod tar;
// TODO: term.h (deprecated)
pub mod termios;
// TODO: tgmath.h (likely C implementation)
// TODO: tgmath.h (likely C implementation currenly through openlibm)
// TODO: threads.h
pub mod time;
// TODO: uchar.h
@@ -1,3 +1,4 @@
# stddef.h brings in size_t
sys_includes = ["stddef.h"]
# TODO: figure out how to export void* type
after_includes = """