Skip to content

Commit 63f5e44

Browse files
committed
teeos: Switch to the s! macro
Add the missing expected traits. (backport <#4773>) (cherry picked from commit d6d774f)
1 parent 0107464 commit 63f5e44

File tree

1 file changed

+63
-71
lines changed

1 file changed

+63
-71
lines changed

src/teeos/mod.rs

Lines changed: 63 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -61,89 +61,81 @@ pub type wctype_t = c_ulong;
6161

6262
pub type cmpfunc = extern "C" fn(x: *const c_void, y: *const c_void) -> c_int;
6363

64-
#[repr(align(16))]
65-
pub struct _CLongDouble(pub u128);
66-
67-
#[repr(align(8))]
68-
#[repr(C)]
69-
pub struct pthread_cond_t {
70-
#[doc(hidden)]
71-
size: [u8; __SIZEOF_PTHREAD_COND_T],
64+
s_paren! {
65+
#[repr(align(16))]
66+
pub struct _CLongDouble(pub u128);
7267
}
7368

74-
#[repr(align(8))]
75-
#[repr(C)]
76-
pub struct pthread_mutex_t {
77-
#[doc(hidden)]
78-
size: [u8; __SIZEOF_PTHREAD_MUTEX_T],
79-
}
69+
s! {
70+
#[repr(align(8))]
71+
pub struct pthread_cond_t {
72+
#[doc(hidden)]
73+
size: [u8; __SIZEOF_PTHREAD_COND_T],
74+
}
8075

81-
#[repr(align(4))]
82-
#[repr(C)]
83-
pub struct pthread_mutexattr_t {
84-
#[doc(hidden)]
85-
size: [u8; __SIZEOF_PTHREAD_MUTEXATTR_T],
86-
}
76+
#[repr(align(8))]
77+
pub struct pthread_mutex_t {
78+
#[doc(hidden)]
79+
size: [u8; __SIZEOF_PTHREAD_MUTEX_T],
80+
}
8781

88-
#[repr(align(4))]
89-
#[repr(C)]
90-
pub struct pthread_condattr_t {
91-
#[doc(hidden)]
92-
size: [u8; __SIZEOF_PTHREAD_CONDATTR_T],
93-
}
82+
#[repr(align(4))]
83+
pub struct pthread_mutexattr_t {
84+
#[doc(hidden)]
85+
size: [u8; __SIZEOF_PTHREAD_MUTEXATTR_T],
86+
}
9487

95-
#[repr(C)]
96-
pub struct pthread_attr_t {
97-
__size: [u64; 7],
98-
}
88+
#[repr(align(4))]
89+
pub struct pthread_condattr_t {
90+
#[doc(hidden)]
91+
size: [u8; __SIZEOF_PTHREAD_CONDATTR_T],
92+
}
9993

100-
#[repr(C)]
101-
pub struct cpu_set_t {
102-
bits: [c_ulong; 128 / size_of::<c_ulong>()],
103-
}
94+
pub struct pthread_attr_t {
95+
__size: [u64; 7],
96+
}
10497

105-
#[repr(C)]
106-
pub struct timespec {
107-
pub tv_sec: time_t,
108-
pub tv_nsec: c_long,
109-
}
98+
pub struct cpu_set_t {
99+
bits: [c_ulong; 128 / size_of::<c_ulong>()],
100+
}
110101

111-
#[repr(C)]
112-
pub struct timeval {
113-
pub tv_sec: time_t,
114-
pub tv_usec: suseconds_t,
115-
}
102+
pub struct timespec {
103+
pub tv_sec: time_t,
104+
pub tv_nsec: c_long,
105+
}
116106

117-
#[repr(C)]
118-
pub struct tm {
119-
pub tm_sec: c_int,
120-
pub tm_min: c_int,
121-
pub tm_hour: c_int,
122-
pub tm_mday: c_int,
123-
pub tm_mon: c_int,
124-
pub tm_year: c_int,
125-
pub tm_wday: c_int,
126-
pub tm_yday: c_int,
127-
pub tm_isdst: c_int,
128-
pub __tm_gmtoff: c_long,
129-
pub __tm_zone: *const c_char,
130-
}
107+
pub struct timeval {
108+
pub tv_sec: time_t,
109+
pub tv_usec: suseconds_t,
110+
}
131111

132-
#[repr(C)]
133-
pub struct mbstate_t {
134-
pub __opaque1: c_uint,
135-
pub __opaque2: c_uint,
136-
}
112+
pub struct tm {
113+
pub tm_sec: c_int,
114+
pub tm_min: c_int,
115+
pub tm_hour: c_int,
116+
pub tm_mday: c_int,
117+
pub tm_mon: c_int,
118+
pub tm_year: c_int,
119+
pub tm_wday: c_int,
120+
pub tm_yday: c_int,
121+
pub tm_isdst: c_int,
122+
pub __tm_gmtoff: c_long,
123+
pub __tm_zone: *const c_char,
124+
}
137125

138-
#[repr(C)]
139-
pub struct sem_t {
140-
pub __val: [c_int; 4 * size_of::<c_long>() / size_of::<c_int>()],
141-
}
126+
pub struct mbstate_t {
127+
pub __opaque1: c_uint,
128+
pub __opaque2: c_uint,
129+
}
142130

143-
#[repr(C)]
144-
pub struct div_t {
145-
pub quot: c_int,
146-
pub rem: c_int,
131+
pub struct sem_t {
132+
pub __val: [c_int; 4 * size_of::<c_long>() / size_of::<c_int>()],
133+
}
134+
135+
pub struct div_t {
136+
pub quot: c_int,
137+
pub rem: c_int,
138+
}
147139
}
148140

149141
// fcntl

0 commit comments

Comments
 (0)