Skip to content

Commit bce4454

Browse files
committed
Touch up style of wasi.rs
1 parent 8662b47 commit bce4454

File tree

2 files changed

+147
-144
lines changed

2 files changed

+147
-144
lines changed

ci/style.rs

+3
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,9 @@ fn check_style(file: &str, path: &Path, err: &mut Errors) {
144144
let line = if is_pub {&line[4..]} else {line};
145145

146146
let line_state = if line.starts_with("use ") {
147+
if line.contains("c_void") {
148+
continue;
149+
}
147150
if is_pub {
148151
State::Modules
149152
} else {

src/wasi.rs

+144-144
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,146 @@ pub type __wasi_userdata_t = u64;
5757
pub type __wasi_whence_t = u8;
5858
pub type __wasi_preopentype_t = u8;
5959

60+
#[cfg_attr(feature = "extra_traits", derive(Debug))]
61+
pub enum FILE {}
62+
impl ::Copy for FILE {}
63+
impl ::Clone for FILE {
64+
fn clone(&self) -> FILE {
65+
*self
66+
}
67+
}
68+
69+
s! {
70+
#[repr(align(8))]
71+
pub struct fpos_t {
72+
data: [u8; 16],
73+
}
74+
75+
pub struct tm {
76+
pub tm_sec: c_int,
77+
pub tm_min: c_int,
78+
pub tm_hour: c_int,
79+
pub tm_mday: c_int,
80+
pub tm_mon: c_int,
81+
pub tm_year: c_int,
82+
pub tm_wday: c_int,
83+
pub tm_yday: c_int,
84+
pub tm_isdst: c_int,
85+
pub __tm_gmtoff: c_int,
86+
pub __tm_zone: *const c_char,
87+
pub __tm_nsec: c_int,
88+
}
89+
90+
pub struct timespec {
91+
pub tv_sec: time_t,
92+
pub tv_nsec: c_long,
93+
}
94+
95+
pub struct itimerspec {
96+
pub it_interval: timespec,
97+
pub it_value: timespec,
98+
}
99+
100+
pub struct __wasi_dirent_t {
101+
pub d_next: __wasi_dircookie_t,
102+
pub d_ino: __wasi_inode_t,
103+
pub d_namlen: u32,
104+
pub d_type: __wasi_filetype_t,
105+
}
106+
107+
pub struct __wasi_event_u_fd_readwrite_t {
108+
pub nbytes: __wasi_filesize_t,
109+
pub flags: __wasi_eventrwflags_t,
110+
}
111+
112+
pub struct __wasi_fdstat_t {
113+
pub fs_filetype: __wasi_filetype_t,
114+
pub fs_flags: __wasi_fdflags_t,
115+
pub fs_rights_base: __wasi_rights_t,
116+
pub fs_rights_inheriting: __wasi_rights_t,
117+
}
118+
119+
pub struct __wasi_filestat_t {
120+
pub st_dev: __wasi_device_t,
121+
pub st_ino: __wasi_inode_t,
122+
pub st_filetype: __wasi_filetype_t,
123+
pub st_nlink: __wasi_linkcount_t,
124+
pub st_size: __wasi_filesize_t,
125+
pub st_atim: __wasi_timestamp_t,
126+
pub st_mtim: __wasi_timestamp_t,
127+
pub st_ctim: __wasi_timestamp_t,
128+
}
129+
130+
pub struct __wasi_ciovec_t {
131+
pub buf: *const ::c_void,
132+
pub buf_len: size_t,
133+
}
134+
135+
pub struct __wasi_iovec_t {
136+
pub buf: *mut ::c_void,
137+
pub buf_len: size_t,
138+
}
139+
140+
pub struct __wasi_subscription_u_clock_t {
141+
pub identifier: __wasi_userdata_t,
142+
pub clock_id: __wasi_clockid_t,
143+
pub timeout: __wasi_timestamp_t,
144+
pub precision: __wasi_timestamp_t,
145+
pub flags: __wasi_subclockflags_t,
146+
}
147+
148+
pub struct __wasi_subscription_u_fd_readwrite_t {
149+
pub fd: __wasi_fd_t,
150+
}
151+
152+
pub struct __wasi_prestat_u_dir_t {
153+
pub pr_name_len: size_t,
154+
}
155+
}
156+
157+
s_no_extra_traits! {
158+
#[allow(missing_debug_implementations)]
159+
pub struct __wasi_subscription_t {
160+
pub userdata: __wasi_userdata_t,
161+
pub type_: __wasi_eventtype_t,
162+
pub u: __wasi_subscription_u,
163+
}
164+
165+
#[allow(missing_debug_implementations)]
166+
pub struct __wasi_event_t {
167+
pub userdata: __wasi_userdata_t,
168+
pub error: __wasi_errno_t,
169+
pub type_: __wasi_eventtype_t,
170+
pub u: __wasi_event_u,
171+
}
172+
173+
#[allow(missing_debug_implementations)]
174+
pub union __wasi_event_u {
175+
pub fd_readwrite: __wasi_event_u_fd_readwrite_t,
176+
_bindgen_union_align: [u64; 2],
177+
}
178+
179+
#[allow(missing_debug_implementations)]
180+
pub union __wasi_subscription_u {
181+
pub clock: __wasi_subscription_u_clock_t,
182+
pub fd_readwrite:
183+
__wasi_subscription_u_fd_readwrite_t,
184+
_bindgen_union_align: [u64; 5],
185+
}
186+
187+
#[allow(missing_debug_implementations)]
188+
pub struct __wasi_prestat_t {
189+
pub pr_type: __wasi_preopentype_t,
190+
pub u: __wasi_prestat_u,
191+
}
192+
193+
#[allow(missing_debug_implementations)]
194+
pub union __wasi_prestat_u {
195+
pub dir: __wasi_prestat_u_dir_t,
196+
}
197+
198+
}
199+
60200
pub const STDIN_FILENO: c_int = 0;
61201
pub const STDOUT_FILENO: c_int = 1;
62202
pub const STDERR_FILENO: c_int = 2;
@@ -248,152 +388,12 @@ pub const __WASI_WHENCE_CUR: u8 = 0;
248388
pub const __WASI_WHENCE_END: u8 = 1;
249389
pub const __WASI_WHENCE_SET: u8 = 2;
250390

251-
#[cfg_attr(feature = "extra_traits", derive(Debug))]
252-
pub enum FILE {}
253-
impl ::Copy for FILE {}
254-
impl ::Clone for FILE {
255-
fn clone(&self) -> FILE {
256-
*self
257-
}
258-
}
259-
260-
s! {
261-
#[repr(align(8))]
262-
pub struct fpos_t {
263-
data: [u8; 16],
264-
}
265-
266-
pub struct tm {
267-
pub tm_sec: c_int,
268-
pub tm_min: c_int,
269-
pub tm_hour: c_int,
270-
pub tm_mday: c_int,
271-
pub tm_mon: c_int,
272-
pub tm_year: c_int,
273-
pub tm_wday: c_int,
274-
pub tm_yday: c_int,
275-
pub tm_isdst: c_int,
276-
pub __tm_gmtoff: c_int,
277-
pub __tm_zone: *const c_char,
278-
pub __tm_nsec: c_int,
279-
}
280-
281-
pub struct timespec {
282-
pub tv_sec: time_t,
283-
pub tv_nsec: c_long,
284-
}
285-
286-
pub struct itimerspec {
287-
pub it_interval: timespec,
288-
pub it_value: timespec,
289-
}
290-
291-
pub struct __wasi_dirent_t {
292-
pub d_next: __wasi_dircookie_t,
293-
pub d_ino: __wasi_inode_t,
294-
pub d_namlen: u32,
295-
pub d_type: __wasi_filetype_t,
296-
}
297-
298-
pub struct __wasi_event_u_fd_readwrite_t {
299-
pub nbytes: __wasi_filesize_t,
300-
pub flags: __wasi_eventrwflags_t,
301-
}
302-
303-
pub struct __wasi_fdstat_t {
304-
pub fs_filetype: __wasi_filetype_t,
305-
pub fs_flags: __wasi_fdflags_t,
306-
pub fs_rights_base: __wasi_rights_t,
307-
pub fs_rights_inheriting: __wasi_rights_t,
308-
}
309-
310-
pub struct __wasi_filestat_t {
311-
pub st_dev: __wasi_device_t,
312-
pub st_ino: __wasi_inode_t,
313-
pub st_filetype: __wasi_filetype_t,
314-
pub st_nlink: __wasi_linkcount_t,
315-
pub st_size: __wasi_filesize_t,
316-
pub st_atim: __wasi_timestamp_t,
317-
pub st_mtim: __wasi_timestamp_t,
318-
pub st_ctim: __wasi_timestamp_t,
319-
}
320-
321-
pub struct __wasi_ciovec_t {
322-
pub buf: *const ::c_void,
323-
pub buf_len: size_t,
324-
}
325-
326-
pub struct __wasi_iovec_t {
327-
pub buf: *mut ::c_void,
328-
pub buf_len: size_t,
329-
}
330-
331-
pub struct __wasi_subscription_u_clock_t {
332-
pub identifier: __wasi_userdata_t,
333-
pub clock_id: __wasi_clockid_t,
334-
pub timeout: __wasi_timestamp_t,
335-
pub precision: __wasi_timestamp_t,
336-
pub flags: __wasi_subclockflags_t,
337-
}
338-
339-
pub struct __wasi_subscription_u_fd_readwrite_t {
340-
pub fd: __wasi_fd_t,
341-
}
342-
343-
pub struct __wasi_prestat_u_dir_t {
344-
pub pr_name_len: size_t,
345-
}
346-
}
347-
348-
s_no_extra_traits! {
349-
#[allow(missing_debug_implementations)]
350-
pub struct __wasi_subscription_t {
351-
pub userdata: __wasi_userdata_t,
352-
pub type_: __wasi_eventtype_t,
353-
pub u: __wasi_subscription_u,
354-
}
355-
356-
#[allow(missing_debug_implementations)]
357-
pub struct __wasi_event_t {
358-
pub userdata: __wasi_userdata_t,
359-
pub error: __wasi_errno_t,
360-
pub type_: __wasi_eventtype_t,
361-
pub u: __wasi_event_u,
362-
}
363-
364-
#[allow(missing_debug_implementations)]
365-
pub union __wasi_event_u {
366-
pub fd_readwrite: __wasi_event_u_fd_readwrite_t,
367-
_bindgen_union_align: [u64; 2],
368-
}
369-
370-
#[allow(missing_debug_implementations)]
371-
pub union __wasi_subscription_u {
372-
pub clock: __wasi_subscription_u_clock_t,
373-
pub fd_readwrite:
374-
__wasi_subscription_u_fd_readwrite_t,
375-
_bindgen_union_align: [u64; 5],
376-
}
377-
378-
#[allow(missing_debug_implementations)]
379-
pub struct __wasi_prestat_t {
380-
pub pr_type: __wasi_preopentype_t,
381-
pub u: __wasi_prestat_u,
382-
}
383-
384-
#[allow(missing_debug_implementations)]
385-
pub union __wasi_prestat_u {
386-
pub dir: __wasi_prestat_u_dir_t,
387-
}
388-
389-
}
390-
391391
#[cfg_attr(feature = "rustc-dep-of-std",
392392
link(name = "c", kind = "static",
393393
cfg(target_feature = "crt-static")))]
394394
#[cfg_attr(feature = "rustc-dep-of-std",
395395
link(name = "c", cfg(not(target_feature = "crt-static"))))]
396-
extern "C" {
396+
extern {
397397
pub fn _Exit(code: c_int) -> !;
398398
pub fn _exit(code: c_int) -> !;
399399
pub fn abort() -> !;
@@ -452,8 +452,8 @@ extern "C" {
452452
pub fn puts(a: *const c_char) -> c_int;
453453
pub fn perror(a: *const c_char);
454454
pub fn srand(a: c_uint);
455-
pub fn atexit(a: extern "C" fn()) -> c_int;
456-
pub fn at_quick_exit(a: extern "C" fn()) -> c_int;
455+
pub fn atexit(a: extern fn()) -> c_int;
456+
pub fn at_quick_exit(a: extern fn()) -> c_int;
457457
pub fn quick_exit(a: c_int) -> !;
458458
pub fn posix_memalign(a: *mut *mut c_void, b: size_t, c: size_t) -> c_int;
459459
pub fn rand_r(a: *mut c_uint) -> c_int;
@@ -501,7 +501,7 @@ extern "C" {
501501
}
502502

503503
#[link(wasm_import_module = "wasi_unstable")]
504-
extern "C" {
504+
extern {
505505
#[link_name = "clock_res_get"]
506506
pub fn __wasi_clock_res_get(
507507
clock_id: __wasi_clockid_t,

0 commit comments

Comments
 (0)