Upgrade to witx 0.8.0 with tagged unions (#921)
* witx tagged unions: updates to wig to use new semantics * wig: emit a `#variant: ()` union variant for empty variants * wasi-common: translate to use tagged unions * update to flattened layout of event struct * wig: generate layout tests, and delete bindgen ones the bindgen tests became out-of-date with the latest changes to the representation of unions, and the re-jiggering of various struct definitions that went along with it. * wasi: point at master with tagged union PR merged * fix event struct repr on windows
This commit is contained in:
@@ -13,160 +13,3 @@ pub type uintptr_t = u32;
|
||||
pub type size_t = u32;
|
||||
|
||||
witx_wasi32_types!("snapshot" "wasi_snapshot_preview1");
|
||||
|
||||
#[cfg(test)]
|
||||
mod test {
|
||||
use super::*;
|
||||
|
||||
#[test]
|
||||
fn bindgen_test_layout_wasi_ciovec_t() {
|
||||
assert_eq!(
|
||||
::std::mem::size_of::<__wasi_ciovec_t>(),
|
||||
8usize,
|
||||
concat!("Size of: ", stringify!(__wasi_ciovec_t))
|
||||
);
|
||||
assert_eq!(
|
||||
::std::mem::align_of::<__wasi_ciovec_t>(),
|
||||
4usize,
|
||||
concat!("Alignment of ", stringify!(__wasi_ciovec_t))
|
||||
);
|
||||
assert_eq!(
|
||||
unsafe { &(*(::std::ptr::null::<__wasi_ciovec_t>())).buf as *const _ as usize },
|
||||
0usize,
|
||||
concat!(
|
||||
"Offset of field: ",
|
||||
stringify!(__wasi_ciovec_t),
|
||||
"::",
|
||||
stringify!(buf)
|
||||
)
|
||||
);
|
||||
assert_eq!(
|
||||
unsafe { &(*(::std::ptr::null::<__wasi_ciovec_t>())).buf_len as *const _ as usize },
|
||||
4usize,
|
||||
concat!(
|
||||
"Offset of field: ",
|
||||
stringify!(__wasi_ciovec_t),
|
||||
"::",
|
||||
stringify!(buf_len)
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn bindgen_test_layout_wasi_iovec_t() {
|
||||
assert_eq!(
|
||||
::std::mem::size_of::<__wasi_iovec_t>(),
|
||||
8usize,
|
||||
concat!("Size of: ", stringify!(__wasi_iovec_t))
|
||||
);
|
||||
assert_eq!(
|
||||
::std::mem::align_of::<__wasi_iovec_t>(),
|
||||
4usize,
|
||||
concat!("Alignment of ", stringify!(__wasi_iovec_t))
|
||||
);
|
||||
assert_eq!(
|
||||
unsafe { &(*(::std::ptr::null::<__wasi_iovec_t>())).buf as *const _ as usize },
|
||||
0usize,
|
||||
concat!(
|
||||
"Offset of field: ",
|
||||
stringify!(__wasi_iovec_t),
|
||||
"::",
|
||||
stringify!(buf)
|
||||
)
|
||||
);
|
||||
assert_eq!(
|
||||
unsafe { &(*(::std::ptr::null::<__wasi_iovec_t>())).buf_len as *const _ as usize },
|
||||
4usize,
|
||||
concat!(
|
||||
"Offset of field: ",
|
||||
stringify!(__wasi_iovec_t),
|
||||
"::",
|
||||
stringify!(buf_len)
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn bindgen_test_layout___wasi_prestat_t___wasi_prestat_u___wasi_prestat_u_dir_t() {
|
||||
assert_eq!(
|
||||
::std::mem::size_of::<__wasi_prestat_dir_t>(),
|
||||
4usize,
|
||||
concat!("Size of: ", stringify!(__wasi_prestat_dir_t))
|
||||
);
|
||||
assert_eq!(
|
||||
::std::mem::align_of::<__wasi_prestat_dir_t>(),
|
||||
4usize,
|
||||
concat!("Alignment of ", stringify!(__wasi_prestat_dir_t))
|
||||
);
|
||||
assert_eq!(
|
||||
unsafe {
|
||||
&(*(::std::ptr::null::<__wasi_prestat_dir_t>())).pr_name_len as *const _ as usize
|
||||
},
|
||||
0usize,
|
||||
concat!(
|
||||
"Offset of field: ",
|
||||
stringify!(__wasi_prestat_dir_t),
|
||||
"::",
|
||||
stringify!(pr_name_len)
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn bindgen_test_layout___wasi_prestat_t___wasi_prestat_u() {
|
||||
assert_eq!(
|
||||
::std::mem::size_of::<__wasi_prestat_u_t>(),
|
||||
4usize,
|
||||
concat!("Size of: ", stringify!(__wasi_prestat_u_t))
|
||||
);
|
||||
assert_eq!(
|
||||
::std::mem::align_of::<__wasi_prestat_u_t>(),
|
||||
4usize,
|
||||
concat!("Alignment of ", stringify!(__wasi_prestat_u_t))
|
||||
);
|
||||
assert_eq!(
|
||||
unsafe { &(*(::std::ptr::null::<__wasi_prestat_u_t>())).dir as *const _ as usize },
|
||||
0usize,
|
||||
concat!(
|
||||
"Offset of field: ",
|
||||
stringify!(__wasi_prestat_u_t),
|
||||
"::",
|
||||
stringify!(dir)
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn bindgen_test_layout___wasi_prestat_t() {
|
||||
assert_eq!(
|
||||
::std::mem::size_of::<__wasi_prestat_t>(),
|
||||
8usize,
|
||||
concat!("Size of: ", stringify!(__wasi_prestat_t))
|
||||
);
|
||||
assert_eq!(
|
||||
::std::mem::align_of::<__wasi_prestat_t>(),
|
||||
4usize,
|
||||
concat!("Alignment of ", stringify!(__wasi_prestat_t))
|
||||
);
|
||||
assert_eq!(
|
||||
unsafe { &(*(::std::ptr::null::<__wasi_prestat_t>())).pr_type as *const _ as usize },
|
||||
0usize,
|
||||
concat!(
|
||||
"Offset of field: ",
|
||||
stringify!(__wasi_prestat_t),
|
||||
"::",
|
||||
stringify!(pr_type)
|
||||
)
|
||||
);
|
||||
assert_eq!(
|
||||
unsafe { &(*(::std::ptr::null::<__wasi_prestat_t>())).u as *const _ as usize },
|
||||
4usize,
|
||||
concat!(
|
||||
"Offset of field: ",
|
||||
stringify!(__wasi_prestat_t),
|
||||
"::",
|
||||
stringify!(u)
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user