split out useconds_t from sys_types header
This commit is contained in:
@@ -0,0 +1,18 @@
|
||||
# POSIX header spec: https://pubs.opengroup.org/onlinepubs/009695399/basedefs/sys/types.h.html
|
||||
#
|
||||
# This type is split out to prevent importing all of sys/types.h into other headers.
|
||||
#
|
||||
# useconds_t was defined in sys/types.h in an older POSIX standard.
|
||||
# relibc currently only uses it in unistd.h for ualarm and usleep.
|
||||
#
|
||||
# features.h required for deprecated annotation.
|
||||
sys_includes = ["features.h"]
|
||||
include_guard = "_RELIBC_BITS_USECONDS_T_H"
|
||||
language = "C"
|
||||
style = "type"
|
||||
no_includes = true
|
||||
cpp_compat = true
|
||||
[export]
|
||||
include = ["useconds_t"]
|
||||
[enum]
|
||||
prefix_with_name = true
|
||||
@@ -0,0 +1,6 @@
|
||||
use crate::platform::types::c_uint;
|
||||
|
||||
/// Used for time in microseconds.
|
||||
#[allow(non_camel_case_types)]
|
||||
#[deprecated]
|
||||
pub type useconds_t = c_uint;
|
||||
@@ -53,6 +53,8 @@ pub mod bits_timespec;
|
||||
pub mod bits_timeval;
|
||||
#[path = "bits_uid-t/mod.rs"]
|
||||
pub mod bits_uid_t;
|
||||
#[path = "bits_useconds-t/mod.rs"]
|
||||
pub mod bits_useconds_t;
|
||||
// complex.h implemented in C (currently through openlibm)
|
||||
pub mod cpio;
|
||||
pub mod crypt;
|
||||
|
||||
@@ -2,21 +2,16 @@
|
||||
#
|
||||
# There are no spec quotations relating to includes
|
||||
#
|
||||
# - sys/types_internal.h are fundamental C types (which includes stddef.h)
|
||||
# - sys/types/internal.h are fundamental C types (which includes stddef.h)
|
||||
# - sys/types/internal.h brings in features.h for deprecated annotations for useconds_t
|
||||
# - bits/pthread.h is separate for convenience
|
||||
# - features.h saves importing separately for any header that imports sys/types.h
|
||||
#
|
||||
# no default C includes - they cause recursive dependencies and do weird stuff
|
||||
no_includes = true
|
||||
sys_includes = [
|
||||
# Import most necessary, internal types first
|
||||
"sys/types/internal.h",
|
||||
|
||||
"bits/pthread.h",
|
||||
"features.h",
|
||||
]
|
||||
|
||||
include_guard = "_SYS_TYPES_H"
|
||||
no_includes = true
|
||||
language = "C"
|
||||
style = "Tag"
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
# stddef.h brings in size_t
|
||||
# bits/useconds-t.h brings in features.h for deprecated annotation
|
||||
sys_includes = ["stddef.h"]
|
||||
after_includes = """
|
||||
#include <bits/clock-t.h>
|
||||
@@ -19,6 +20,7 @@ after_includes = """
|
||||
#include <bits/time-t.h>
|
||||
#include <bits/timer-t.h>
|
||||
#include <bits/uid-t.h>
|
||||
#include <bits/useconds-t.h> // from older POSIX
|
||||
"""
|
||||
include_guard = "_RELIBC_SYS_TYPES_INTERNAL_H"
|
||||
language = "C"
|
||||
@@ -27,7 +29,6 @@ no_includes = true
|
||||
|
||||
[export]
|
||||
include = [
|
||||
"useconds_t",
|
||||
"u_char",
|
||||
"uchar",
|
||||
"u_short",
|
||||
|
||||
@@ -28,10 +28,10 @@ pub use crate::header::{
|
||||
bits_timer_t::timer_t,
|
||||
bits_uid_t::uid_t,
|
||||
};
|
||||
#[expect(deprecated)]
|
||||
pub use crate::header::bits_useconds_t::useconds_t;
|
||||
use crate::platform::types::{c_char, c_longlong, c_uchar, c_uint, c_ulong, c_ulonglong, c_ushort};
|
||||
|
||||
pub type useconds_t = c_uint;
|
||||
|
||||
pub type u_char = c_uchar;
|
||||
pub type uchar = c_uchar;
|
||||
pub type u_short = c_ushort;
|
||||
|
||||
Reference in New Issue
Block a user