Merge branch 'stddef-rust' into 'master'

move stddef header from C to cbindgen

See merge request redox-os/relibc!1492
This commit is contained in:
Jeremy Soller
2026-06-24 14:39:54 -06:00
9 changed files with 55 additions and 22 deletions
+3
View File
@@ -10,6 +10,9 @@ include_guard = "_RELIBC_BITS_NULL_T_H"
language = "C"
no_includes = true
after_includes = """
// Null pointer constant.
// Any pointer object whose representation has all bits set to zero, perhaps by
// memset() to 0 or by calloc(), shall be treated as a null pointer.
#ifdef __cplusplus
#if __cplusplus >= 201103L
#define NULL nullptr
+5 -1
View File
@@ -1 +1,5 @@
// NULL is defined in cbindgen
//! `NULL` from `stddef.h` implementation.
//!
//! See <https://pubs.opengroup.org/onlinepubs/9799919799/basedefs/stddef.h.html>.
//!
//! Implemented via ifdefs and defines in cbindgen.
+4
View File
@@ -1,3 +1,7 @@
//! `size_t` from `stddef.h` implementation.
//!
//! See <https://pubs.opengroup.org/onlinepubs/9799919799/basedefs/stddef.h.html>.
use crate::platform::types::c_ulong;
/// Unsigned integer type of the result of the sizeof operator.
+3
View File
@@ -3,6 +3,9 @@
# This type is split out to prevent importing all of stddef.h into inttypes.h
include_guard = "_RELIBC_BITS_WCHAR_T_H"
after_includes = """
// Integer type whose range of values can represent distinct codes for all
// members of the largest extended character set specified among the supported
// locales; the null character shall have the code value zero.
#ifndef _WCHAR_T
#define _WCHAR_T
#ifndef __cplusplus
+5 -1
View File
@@ -1 +1,5 @@
// `wchar_t` is defined in cbindgen
//! `wchar_t` from `stddef.h` implementation.
//!
//! See <https://pubs.opengroup.org/onlinepubs/9799919799/basedefs/stddef.h.html>.
//!
//! Implemented via ifdefs and defines in cbindgen.
+1 -1
View File
@@ -136,7 +136,7 @@ pub mod spawn;
pub mod stdarg;
// stdatomic.h implemented in C
// stdbool.h implemented in C
// stddef.h implemented in C
pub mod stddef;
// stdint.h implemented in C
pub mod stdio;
pub mod stdlib;
+29
View File
@@ -0,0 +1,29 @@
# POSIX header spec: https://pubs.opengroup.org/onlinepubs/9799919799/basedefs/stddef.h.html
#
# There are no spec quotations relating to includes
include_guard = "_RELIBC_STDDEF_H"
after_includes = """
// wchar_t should come before NULL and size_t
// according to comment in wchar cbindgen
#include <bits/wchar-t.h>
#include <bits/size-t.h>
#include <bits/null.h>
#ifndef __PTRDIFF_TYPE__
#define __PTRDIFF_TYPE__ long int
#endif
// Signed integer type of the result of subtracting two pointers.
typedef __PTRDIFF_TYPE__ ptrdiff_t;
// Object type whose alignment is the greatest fundamental alignment.
typedef struct { long long __ll; long double __ld; } max_align_t;
// Integer constant expression of type size_t, the value of which is the offset
// in bytes to the structure member from the beginning of its structure.
#define offsetof(type, member) __builtin_offsetof(type, member)
"""
language = "C"
no_includes = true
cpp_compat = true
[enum]
prefix_with_name = true
+5
View File
@@ -0,0 +1,5 @@
//! `stddef.h` implementation.
//!
//! See <https://pubs.opengroup.org/onlinepubs/9799919799/basedefs/stddef.h.html>.
//!
//! Implemented via includes, typedefs and defines in cbindgen.