feat(c-api) Start implementing wasm_target_t, wasm_triple_t and wasm_cpu_features_t.

This commit is contained in:
Ivan Enderlin
2021-01-28 17:26:15 +01:00
parent 2f82d5536f
commit b201f12494
7 changed files with 274 additions and 3 deletions

View File

@@ -467,16 +467,19 @@ macro_rules! wasm_declare_own {
#[macro_export]
macro_rules! c_try {
($expr:expr) => {{
($expr:expr; otherwise $return:expr) => {{
let res: Result<_, _> = $expr;
match res {
Ok(val) => val,
Err(err) => {
crate::error::update_last_error(err);
return None;
return $return;
}
}
}};
($expr:expr) => {{
c_try!($expr; otherwise None)
}};
($expr:expr, $e:expr) => {{
let opt: Option<_> = $expr;
c_try!(opt.ok_or_else(|| $e))