split out intptr_t from stdint.h for sys/shm.h

This commit is contained in:
auronandace
2026-06-16 20:00:20 +01:00
parent 6be61dd09e
commit f2310befc3
5 changed files with 32 additions and 9 deletions
+1 -3
View File
@@ -87,9 +87,7 @@ typedef __UINT_FAST64_TYPE__ uint_fast64_t;
/* 7.8.1.4 Integer types capable of holding object pointers */
#ifdef __INTPTR_TYPE__
typedef __INTPTR_TYPE__ intptr_t;
#endif
#include <bits/intptr-t.h> // for intptr_t
#ifdef __UINTPTR_TYPE__
typedef __UINTPTR_TYPE__ uintptr_t;
#endif
+19
View File
@@ -0,0 +1,19 @@
# POSIX header spec: https://pubs.opengroup.org/onlinepubs/9799919799/basedefs/stdint.h.html
#
# This type is split out to prevent importing all of stdint.h in other headers.
#
# POSIX headers that require intptr_t:
# - stdint.h (where it should be defined)
# - sys/shm.h
# - unistd.h (permitted to include all of stdint.h)
include_guard = "_RELIBC_BITS_INTPTR_T_H"
after_includes = """
#ifdef __INTPTR_TYPE__
typedef __INTPTR_TYPE__ intptr_t;
#endif
"""
language = "C"
no_includes = true
cpp_compat = true
[enum]
prefix_with_name = true
+5
View File
@@ -0,0 +1,5 @@
//! `intptr_t` implementation for `stdint.h`
//!
//! See <https://pubs.opengroup.org/onlinepubs/9799919799/basedefs/stdint.h.html>.
//!
//! Implemented via typedef in cbindgen.
+2
View File
@@ -18,6 +18,8 @@ pub mod bits_gid_t;
pub mod bits_id_t;
#[path = "bits_ino-t/mod.rs"]
pub mod bits_ino_t;
#[path = "bits_intptr-t/mod.rs"]
pub mod bits_intptr_t;
pub mod bits_iovec;
#[path = "bits_key-t/mod.rs"]
pub mod bits_key_t;
+5 -6
View File
@@ -4,14 +4,13 @@
# - "The <sys/shm.h> header shall define the type intptr_t as described in <stdint.h>."
# - "The <sys/shm.h> header shall define the pid_t, size_t, and time_t types as described in <sys/types.h>."
# - "In addition, the <sys/shm.h> header shall include the <sys/ipc.h> header."
#
# TODO split out intptr_t from stdint.h
sys_includes = ["sys/ipc.h", "stdint.h"]
sys_includes = ["sys/ipc.h"]
include_guard = "_RELIBC_SYS_SHM_H"
after_includes = """
#include <bits/pid-t.h> // for pid_t from sys/types.h
#include <bits/size-t.h> // for size_t from sys/types.h
#include <bits/time-t.h> // for time_t from sys/types.h
#include <bits/intptr-t.h> // for intptr_t from stdint.h
#include <bits/pid-t.h> // for pid_t from sys/types.h
#include <bits/size-t.h> // for size_t from sys/types.h
#include <bits/time-t.h> // for time_t from sys/types.h
"""
language = "C"
style = "Tag"