move stddef header from C to cbindgen
This commit is contained in:
@@ -1,19 +0,0 @@
|
|||||||
#ifndef _STDDEF_H
|
|
||||||
#define _STDDEF_H
|
|
||||||
|
|
||||||
// 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
|
|
||||||
typedef __PTRDIFF_TYPE__ ptrdiff_t;
|
|
||||||
|
|
||||||
typedef struct { long long __ll; long double __ld; } max_align_t;
|
|
||||||
|
|
||||||
#define offsetof(type, member) __builtin_offsetof(type, member)
|
|
||||||
|
|
||||||
#endif /* _STDDEF_H */
|
|
||||||
@@ -10,6 +10,9 @@ include_guard = "_RELIBC_BITS_NULL_T_H"
|
|||||||
language = "C"
|
language = "C"
|
||||||
no_includes = true
|
no_includes = true
|
||||||
after_includes = """
|
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
|
#ifdef __cplusplus
|
||||||
#if __cplusplus >= 201103L
|
#if __cplusplus >= 201103L
|
||||||
#define NULL nullptr
|
#define NULL nullptr
|
||||||
|
|||||||
@@ -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.
|
||||||
|
|||||||
@@ -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;
|
use crate::platform::types::c_ulong;
|
||||||
|
|
||||||
/// Unsigned integer type of the result of the sizeof operator.
|
/// Unsigned integer type of the result of the sizeof operator.
|
||||||
|
|||||||
@@ -3,6 +3,9 @@
|
|||||||
# This type is split out to prevent importing all of stddef.h into inttypes.h
|
# This type is split out to prevent importing all of stddef.h into inttypes.h
|
||||||
include_guard = "_RELIBC_BITS_WCHAR_T_H"
|
include_guard = "_RELIBC_BITS_WCHAR_T_H"
|
||||||
after_includes = """
|
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
|
#ifndef _WCHAR_T
|
||||||
#define _WCHAR_T
|
#define _WCHAR_T
|
||||||
#ifndef __cplusplus
|
#ifndef __cplusplus
|
||||||
|
|||||||
@@ -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
@@ -136,7 +136,7 @@ pub mod spawn;
|
|||||||
pub mod stdarg;
|
pub mod stdarg;
|
||||||
// stdatomic.h implemented in C
|
// stdatomic.h implemented in C
|
||||||
// stdbool.h implemented in C
|
// stdbool.h implemented in C
|
||||||
// stddef.h implemented in C
|
pub mod stddef;
|
||||||
// stdint.h implemented in C
|
// stdint.h implemented in C
|
||||||
pub mod stdio;
|
pub mod stdio;
|
||||||
pub mod stdlib;
|
pub mod stdlib;
|
||||||
|
|||||||
@@ -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
|
||||||
@@ -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.
|
||||||
Reference in New Issue
Block a user