Skip to content

Commit

Permalink
clippy: fix no_mangle and export_name usage (#1337)
Browse files Browse the repository at this point in the history
clippy: fix no_mangle and export_name usage

The no_mangle and export_name attributes cannot be used at the same time.
(Link: rust-lang/rust#47446)
Since Clippy now warns about this we were notified about our misuse and this PR fixes it.
  • Loading branch information
Robbepop authored Jan 6, 2025
1 parent b2e7429 commit 559c167
Show file tree
Hide file tree
Showing 26 changed files with 140 additions and 140 deletions.
16 changes: 8 additions & 8 deletions crates/c_api/macro/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ pub fn declare_own(input: proc_macro::TokenStream) -> proc_macro::TokenStream {

(quote! {
#[doc = #docs]
#[no_mangle]
#[cfg_attr(not(feature = "prefix-symbols"), no_mangle)]
#[cfg_attr(feature = "prefix-symbols", wasmi_c_api_macros::prefix_symbol)]
pub extern "C" fn #delete(_: ::alloc::boxed::Box<#ty>) {}
})
Expand All @@ -49,7 +49,7 @@ pub fn declare_ty(input: proc_macro::TokenStream) -> proc_macro::TokenStream {
::wasmi_c_api_macros::declare_own!(#ty);

#[doc = #docs]
#[no_mangle]
#[cfg_attr(not(feature = "prefix-symbols"), no_mangle)]
#[cfg_attr(feature = "prefix-symbols", wasmi_c_api_macros::prefix_symbol)]
pub extern "C" fn #copy(src: &#ty) -> ::alloc::boxed::Box<#ty> {
::alloc::boxed::Box::new(src.clone())
Expand Down Expand Up @@ -98,7 +98,7 @@ pub fn declare_ref(input: proc_macro::TokenStream) -> proc_macro::TokenStream {
::wasmi_c_api_macros::declare_ty!(#ty);

#[doc = #same_docs]
#[no_mangle]
#[cfg_attr(not(feature = "prefix-symbols"), no_mangle)]
#[cfg_attr(feature = "prefix-symbols", wasmi_c_api_macros::prefix_symbol)]
pub extern "C" fn #same(_a: &#ty, _b: &#ty) -> ::core::primitive::bool {
#[cfg(feature = "std")]
Expand All @@ -107,14 +107,14 @@ pub fn declare_ref(input: proc_macro::TokenStream) -> proc_macro::TokenStream {
}

#[doc = #get_host_info_docs]
#[no_mangle]
#[cfg_attr(not(feature = "prefix-symbols"), no_mangle)]
#[cfg_attr(feature = "prefix-symbols", wasmi_c_api_macros::prefix_symbol)]
pub extern "C" fn #get_host_info(a: &#ty) -> *mut ::core::ffi::c_void {
::core::ptr::null_mut()
}

#[doc = #set_host_info_docs]
#[no_mangle]
#[cfg_attr(not(feature = "prefix-symbols"), no_mangle)]
#[cfg_attr(feature = "prefix-symbols", wasmi_c_api_macros::prefix_symbol)]
pub extern "C" fn #set_host_info(a: &#ty, info: *mut ::core::ffi::c_void) {
#[cfg(feature = "std")]
Expand All @@ -123,7 +123,7 @@ pub fn declare_ref(input: proc_macro::TokenStream) -> proc_macro::TokenStream {
}

#[doc = #set_host_info_final_docs]
#[no_mangle]
#[cfg_attr(not(feature = "prefix-symbols"), no_mangle)]
#[cfg_attr(feature = "prefix-symbols", wasmi_c_api_macros::prefix_symbol)]
pub extern "C" fn #set_host_info_final(
a: &#ty,
Expand All @@ -136,7 +136,7 @@ pub fn declare_ref(input: proc_macro::TokenStream) -> proc_macro::TokenStream {
}

#[doc = #as_ref_docs]
#[no_mangle]
#[cfg_attr(not(feature = "prefix-symbols"), no_mangle)]
#[cfg_attr(feature = "prefix-symbols", wasmi_c_api_macros::prefix_symbol)]
pub extern "C" fn #as_ref(a: &#ty) -> ::alloc::boxed::Box<crate::wasm_ref_t> {
#[cfg(feature = "std")]
Expand All @@ -145,7 +145,7 @@ pub fn declare_ref(input: proc_macro::TokenStream) -> proc_macro::TokenStream {
}

#[doc = #as_ref_const_docs]
#[no_mangle]
#[cfg_attr(not(feature = "prefix-symbols"), no_mangle)]
#[cfg_attr(feature = "prefix-symbols", wasmi_c_api_macros::prefix_symbol)]
pub extern "C" fn #as_ref_const(a: &#ty) -> ::alloc::boxed::Box<crate::wasm_ref_t> {
#[cfg(feature = "std")]
Expand Down
2 changes: 1 addition & 1 deletion crates/c_api/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ wasmi_c_api_macros::declare_own!(wasm_config_t);
/// Wraps [`wasmi::Config::default`].
///
/// [`wasm_engine_new_with_config`]: crate::wasm_engine_new_with_config
#[no_mangle]
#[cfg_attr(not(feature = "prefix-symbols"), no_mangle)]
#[cfg_attr(feature = "prefix-symbols", wasmi_c_api_macros::prefix_symbol)]
pub extern "C" fn wasm_config_new() -> Box<wasm_config_t> {
Box::new(wasm_config_t {
Expand Down
4 changes: 2 additions & 2 deletions crates/c_api/src/engine.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ wasmi_c_api_macros::declare_own!(wasm_engine_t);
/// The returned [`wasm_engine_t`] must be freed using [`wasm_engine_delete`].
///
/// Wraps [`wasmi::Engine::default`].
#[no_mangle]
#[cfg_attr(not(feature = "prefix-symbols"), no_mangle)]
#[cfg_attr(feature = "prefix-symbols", wasmi_c_api_macros::prefix_symbol)]
pub extern "C" fn wasm_engine_new() -> Box<wasm_engine_t> {
Box::new(wasm_engine_t {
Expand All @@ -31,7 +31,7 @@ pub extern "C" fn wasm_engine_new() -> Box<wasm_engine_t> {
/// The returned [`wasm_engine_t`] must be freed using [`wasm_engine_delete`].
///
/// Wraps [`wasmi::Engine::new`].
#[no_mangle]
#[cfg_attr(not(feature = "prefix-symbols"), no_mangle)]
#[cfg_attr(feature = "prefix-symbols", wasmi_c_api_macros::prefix_symbol)]
pub extern "C" fn wasm_engine_new_with_config(config: Box<wasm_config_t>) -> Box<wasm_engine_t> {
Box::new(wasm_engine_t {
Expand Down
2 changes: 1 addition & 1 deletion crates/c_api/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ impl From<wasmi_error_t> for Error {
/// Creates a new [`wasmi_error_t`] with the given error message.
///
/// Wraps [`wasmi::Error::new`].
#[no_mangle]
#[cfg_attr(not(feature = "prefix-symbols"), no_mangle)]
#[allow(clippy::not_unsafe_ptr_arg_deref)] // clippy 0.1.79 (129f3b99 2024-06-10): incorrectly reports a bug here
pub extern "C" fn wasmi_error_new(msg: *const ffi::c_char) -> Option<Box<wasmi_error_t>> {
let msg_bytes = unsafe { ffi::CStr::from_ptr(msg) };
Expand Down
20 changes: 10 additions & 10 deletions crates/c_api/src/extern.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ pub struct wasm_extern_t {
wasmi_c_api_macros::declare_ref!(wasm_extern_t);

/// Returns the [`wasm_extern_kind`] of the [`wasm_extern_t`].
#[no_mangle]
#[cfg_attr(not(feature = "prefix-symbols"), no_mangle)]
#[cfg_attr(feature = "prefix-symbols", wasmi_c_api_macros::prefix_symbol)]
pub extern "C" fn wasm_extern_kind(e: &wasm_extern_t) -> wasm_externkind_t {
match e.which {
Expand All @@ -39,7 +39,7 @@ pub extern "C" fn wasm_extern_kind(e: &wasm_extern_t) -> wasm_externkind_t {
///
/// It is the caller's responsibility not to alias the [`wasm_extern_t`]
/// with its underlying, internal [`WasmStoreRef`].
#[no_mangle]
#[cfg_attr(not(feature = "prefix-symbols"), no_mangle)]
#[cfg_attr(feature = "prefix-symbols", wasmi_c_api_macros::prefix_symbol)]
pub unsafe extern "C" fn wasm_extern_type(e: &wasm_extern_t) -> Box<wasm_externtype_t> {
Box::new(wasm_externtype_t::from_extern_type(
Expand All @@ -50,7 +50,7 @@ pub unsafe extern "C" fn wasm_extern_type(e: &wasm_extern_t) -> Box<wasm_externt
/// Returns the [`wasm_extern_t`] as reference to mutable [`wasm_func_t`] if possible.
///
/// Returns `None` if `e` is not a [`wasm_func_t`].
#[no_mangle]
#[cfg_attr(not(feature = "prefix-symbols"), no_mangle)]
#[cfg_attr(feature = "prefix-symbols", wasmi_c_api_macros::prefix_symbol)]
pub extern "C" fn wasm_extern_as_func(e: &mut wasm_extern_t) -> Option<&mut wasm_func_t> {
wasm_func_t::try_from_mut(e)
Expand All @@ -59,7 +59,7 @@ pub extern "C" fn wasm_extern_as_func(e: &mut wasm_extern_t) -> Option<&mut wasm
/// Returns the [`wasm_extern_t`] as reference to shared [`wasm_func_t`] if possible.
///
/// Returns `None` if `e` is not a [`wasm_func_t`].
#[no_mangle]
#[cfg_attr(not(feature = "prefix-symbols"), no_mangle)]
#[cfg_attr(feature = "prefix-symbols", wasmi_c_api_macros::prefix_symbol)]
pub extern "C" fn wasm_extern_as_func_const(e: &wasm_extern_t) -> Option<&wasm_func_t> {
wasm_func_t::try_from(e)
Expand All @@ -68,7 +68,7 @@ pub extern "C" fn wasm_extern_as_func_const(e: &wasm_extern_t) -> Option<&wasm_f
/// Returns the [`wasm_extern_t`] as reference to mutable [`wasm_global_t`] if possible.
///
/// Returns `None` if `e` is not a [`wasm_global_t`].
#[no_mangle]
#[cfg_attr(not(feature = "prefix-symbols"), no_mangle)]
#[cfg_attr(feature = "prefix-symbols", wasmi_c_api_macros::prefix_symbol)]
pub extern "C" fn wasm_extern_as_global(e: &mut wasm_extern_t) -> Option<&mut wasm_global_t> {
wasm_global_t::try_from_mut(e)
Expand All @@ -77,7 +77,7 @@ pub extern "C" fn wasm_extern_as_global(e: &mut wasm_extern_t) -> Option<&mut wa
/// Returns the [`wasm_extern_t`] as reference to shared [`wasm_global_t`] if possible.
///
/// Returns `None` if `e` is not a [`wasm_global_t`].
#[no_mangle]
#[cfg_attr(not(feature = "prefix-symbols"), no_mangle)]
#[cfg_attr(feature = "prefix-symbols", wasmi_c_api_macros::prefix_symbol)]
pub extern "C" fn wasm_extern_as_global_const(e: &wasm_extern_t) -> Option<&wasm_global_t> {
wasm_global_t::try_from(e)
Expand All @@ -86,7 +86,7 @@ pub extern "C" fn wasm_extern_as_global_const(e: &wasm_extern_t) -> Option<&wasm
/// Returns the [`wasm_extern_t`] as reference to mutable [`wasm_table_t`] if possible.
///
/// Returns `None` if `e` is not a [`wasm_table_t`].
#[no_mangle]
#[cfg_attr(not(feature = "prefix-symbols"), no_mangle)]
#[cfg_attr(feature = "prefix-symbols", wasmi_c_api_macros::prefix_symbol)]
pub extern "C" fn wasm_extern_as_table(e: &mut wasm_extern_t) -> Option<&mut wasm_table_t> {
wasm_table_t::try_from_mut(e)
Expand All @@ -95,7 +95,7 @@ pub extern "C" fn wasm_extern_as_table(e: &mut wasm_extern_t) -> Option<&mut was
/// Returns the [`wasm_extern_t`] as reference to shared [`wasm_table_t`] if possible.
///
/// Returns `None` if `e` is not a [`wasm_table_t`].
#[no_mangle]
#[cfg_attr(not(feature = "prefix-symbols"), no_mangle)]
#[cfg_attr(feature = "prefix-symbols", wasmi_c_api_macros::prefix_symbol)]
pub extern "C" fn wasm_extern_as_table_const(e: &wasm_extern_t) -> Option<&wasm_table_t> {
wasm_table_t::try_from(e)
Expand All @@ -104,7 +104,7 @@ pub extern "C" fn wasm_extern_as_table_const(e: &wasm_extern_t) -> Option<&wasm_
/// Returns the [`wasm_extern_t`] as reference to mutable [`wasm_memory_t`] if possible.
///
/// Returns `None` if `e` is not a [`wasm_memory_t`].
#[no_mangle]
#[cfg_attr(not(feature = "prefix-symbols"), no_mangle)]
#[cfg_attr(feature = "prefix-symbols", wasmi_c_api_macros::prefix_symbol)]
pub extern "C" fn wasm_extern_as_memory(e: &mut wasm_extern_t) -> Option<&mut wasm_memory_t> {
wasm_memory_t::try_from_mut(e)
Expand All @@ -113,7 +113,7 @@ pub extern "C" fn wasm_extern_as_memory(e: &mut wasm_extern_t) -> Option<&mut wa
/// Returns the [`wasm_extern_t`] as reference to shared [`wasm_memory_t`] if possible.
///
/// Returns `None` if `e` is not a [`wasm_memory_t`].
#[no_mangle]
#[cfg_attr(not(feature = "prefix-symbols"), no_mangle)]
#[cfg_attr(feature = "prefix-symbols", wasmi_c_api_macros::prefix_symbol)]
pub extern "C" fn wasm_extern_as_memory_const(e: &wasm_extern_t) -> Option<&wasm_memory_t> {
wasm_memory_t::try_from(e)
Expand Down
2 changes: 1 addition & 1 deletion crates/c_api/src/foreign.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ wasmi_c_api_macros::declare_ref!(wasm_foreign_t);
/// # Note
///
/// This API is unsupported and will panic upon use.
#[no_mangle]
#[cfg_attr(not(feature = "prefix-symbols"), no_mangle)]
#[cfg_attr(feature = "prefix-symbols", wasmi_c_api_macros::prefix_symbol)]
pub extern "C" fn wasm_foreign_new(_store: &crate::wasm_store_t) -> Box<wasm_foreign_t> {
unimplemented!("wasm_foreign_new")
Expand Down
10 changes: 5 additions & 5 deletions crates/c_api/src/frame.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ wasmi_c_api_macros::declare_own!(wasm_frame_t);
/// # Note
///
/// This API is unsupported and will panic upon use.
#[no_mangle]
#[cfg_attr(not(feature = "prefix-symbols"), no_mangle)]
#[cfg_attr(feature = "prefix-symbols", wasmi_c_api_macros::prefix_symbol)]
pub extern "C" fn wasm_frame_func_index(_frame: &wasm_frame_t<'_>) -> u32 {
unimplemented!("wasm_frame_func_index")
Expand All @@ -27,7 +27,7 @@ pub extern "C" fn wasm_frame_func_index(_frame: &wasm_frame_t<'_>) -> u32 {
/// # Note
///
/// This API is unsupported and will panic upon use.
#[no_mangle]
#[cfg_attr(not(feature = "prefix-symbols"), no_mangle)]
#[cfg_attr(feature = "prefix-symbols", wasmi_c_api_macros::prefix_symbol)]
pub extern "C" fn wasm_frame_func_offset(_frame: &wasm_frame_t<'_>) -> usize {
unimplemented!("wasm_frame_func_offset")
Expand All @@ -38,7 +38,7 @@ pub extern "C" fn wasm_frame_func_offset(_frame: &wasm_frame_t<'_>) -> usize {
/// # Note
///
/// This API is unsupported and will panic upon use.
#[no_mangle]
#[cfg_attr(not(feature = "prefix-symbols"), no_mangle)]
#[cfg_attr(feature = "prefix-symbols", wasmi_c_api_macros::prefix_symbol)]
pub extern "C" fn wasm_frame_instance(_arg1: *const wasm_frame_t<'_>) -> *mut wasm_instance_t {
unimplemented!("wasm_frame_instance")
Expand All @@ -49,7 +49,7 @@ pub extern "C" fn wasm_frame_instance(_arg1: *const wasm_frame_t<'_>) -> *mut wa
/// # Note
///
/// This API is unsupported and will panic upon use.
#[no_mangle]
#[cfg_attr(not(feature = "prefix-symbols"), no_mangle)]
#[cfg_attr(feature = "prefix-symbols", wasmi_c_api_macros::prefix_symbol)]
pub extern "C" fn wasm_frame_module_offset(_frame: &wasm_frame_t<'_>) -> usize {
unimplemented!("wasm_frame_module_offset")
Expand All @@ -60,7 +60,7 @@ pub extern "C" fn wasm_frame_module_offset(_frame: &wasm_frame_t<'_>) -> usize {
/// # Note
///
/// This API is unsupported and will panic upon use.
#[no_mangle]
#[cfg_attr(not(feature = "prefix-symbols"), no_mangle)]
#[cfg_attr(feature = "prefix-symbols", wasmi_c_api_macros::prefix_symbol)]
pub extern "C" fn wasm_frame_copy<'a>(_frame: &wasm_frame_t<'a>) -> Box<wasm_frame_t<'a>> {
unimplemented!("wasm_frame_copy")
Expand Down
16 changes: 8 additions & 8 deletions crates/c_api/src/func.rs
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ unsafe fn create_function(
///
/// It is the caller's responsibility not to alias the [`wasm_functype_t`]
/// with its underlying, internal [`WasmStoreRef`](crate::WasmStoreRef).
#[no_mangle]
#[cfg_attr(not(feature = "prefix-symbols"), no_mangle)]
#[cfg_attr(feature = "prefix-symbols", wasmi_c_api_macros::prefix_symbol)]
pub unsafe extern "C" fn wasm_func_new(
store: &mut wasm_store_t,
Expand All @@ -141,7 +141,7 @@ pub unsafe extern "C" fn wasm_func_new(
///
/// It is the caller's responsibility not to alias the [`wasm_functype_t`]
/// with its underlying, internal [`WasmStoreRef`](crate::WasmStoreRef).
#[no_mangle]
#[cfg_attr(not(feature = "prefix-symbols"), no_mangle)]
#[cfg_attr(feature = "prefix-symbols", wasmi_c_api_macros::prefix_symbol)]
pub unsafe extern "C" fn wasm_func_new_with_env(
store: &mut wasm_store_t,
Expand Down Expand Up @@ -185,7 +185,7 @@ fn prepare_params_and_results(
///
/// It is the caller's responsibility not to alias the [`wasm_func_t`]
/// with its underlying, internal [`WasmStoreRef`](crate::WasmStoreRef).
#[no_mangle]
#[cfg_attr(not(feature = "prefix-symbols"), no_mangle)]
#[cfg_attr(feature = "prefix-symbols", wasmi_c_api_macros::prefix_symbol)]
pub unsafe extern "C" fn wasm_func_call(
func: &mut wasm_func_t,
Expand Down Expand Up @@ -250,7 +250,7 @@ fn error_from_panic(panic: Box<dyn Any + Send>) -> Error {
///
/// It is the caller's responsibility not to alias the [`wasm_func_t`]
/// with its underlying, internal [`WasmStoreRef`](crate::WasmStoreRef).
#[no_mangle]
#[cfg_attr(not(feature = "prefix-symbols"), no_mangle)]
#[cfg_attr(feature = "prefix-symbols", wasmi_c_api_macros::prefix_symbol)]
pub unsafe extern "C" fn wasm_func_type(f: &wasm_func_t) -> Box<wasm_functype_t> {
Box::new(wasm_functype_t::new(f.func().ty(f.inner.store.context())))
Expand All @@ -266,7 +266,7 @@ pub unsafe extern "C" fn wasm_func_type(f: &wasm_func_t) -> Box<wasm_functype_t>
/// with its underlying, internal [`WasmStoreRef`](crate::WasmStoreRef).
///
/// [`FuncType::params`]: wasmi::FuncType::params
#[no_mangle]
#[cfg_attr(not(feature = "prefix-symbols"), no_mangle)]
#[cfg_attr(feature = "prefix-symbols", wasmi_c_api_macros::prefix_symbol)]
pub unsafe extern "C" fn wasm_func_param_arity(f: &wasm_func_t) -> usize {
f.func().ty(f.inner.store.context()).params().len()
Expand All @@ -282,21 +282,21 @@ pub unsafe extern "C" fn wasm_func_param_arity(f: &wasm_func_t) -> usize {
/// with its underlying, internal [`WasmStoreRef`](crate::WasmStoreRef).
///
/// [`FuncType::results`]: wasmi::FuncType::results
#[no_mangle]
#[cfg_attr(not(feature = "prefix-symbols"), no_mangle)]
#[cfg_attr(feature = "prefix-symbols", wasmi_c_api_macros::prefix_symbol)]
pub unsafe extern "C" fn wasm_func_result_arity(f: &wasm_func_t) -> usize {
f.func().ty(f.inner.store.context()).results().len()
}

/// Returns the [`wasm_func_t`] as mutable reference to [`wasm_extern_t`].
#[no_mangle]
#[cfg_attr(not(feature = "prefix-symbols"), no_mangle)]
#[cfg_attr(feature = "prefix-symbols", wasmi_c_api_macros::prefix_symbol)]
pub extern "C" fn wasm_func_as_extern(f: &mut wasm_func_t) -> &mut wasm_extern_t {
&mut f.inner
}

/// Returns the [`wasm_func_t`] as shared reference to [`wasm_extern_t`].
#[no_mangle]
#[cfg_attr(not(feature = "prefix-symbols"), no_mangle)]
#[cfg_attr(feature = "prefix-symbols", wasmi_c_api_macros::prefix_symbol)]
pub extern "C" fn wasm_func_as_extern_const(f: &wasm_func_t) -> &wasm_extern_t {
&f.inner
Expand Down
12 changes: 6 additions & 6 deletions crates/c_api/src/global.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ impl wasm_global_t {
///
/// It is the caller's responsibility not to alias the [`wasm_global_t`]
/// with its underlying, internal [`WasmStoreRef`](crate::WasmStoreRef).
#[no_mangle]
#[cfg_attr(not(feature = "prefix-symbols"), no_mangle)]
#[cfg_attr(feature = "prefix-symbols", wasmi_c_api_macros::prefix_symbol)]
pub unsafe extern "C" fn wasm_global_new(
store: &mut wasm_store_t,
Expand All @@ -70,14 +70,14 @@ pub unsafe extern "C" fn wasm_global_new(
}

/// Returns the [`wasm_global_t`] as mutable reference to [`wasm_extern_t`].
#[no_mangle]
#[cfg_attr(not(feature = "prefix-symbols"), no_mangle)]
#[cfg_attr(feature = "prefix-symbols", wasmi_c_api_macros::prefix_symbol)]
pub extern "C" fn wasm_global_as_extern(g: &mut wasm_global_t) -> &mut wasm_extern_t {
&mut g.inner
}

/// Returns the [`wasm_global_t`] as shared reference to [`wasm_extern_t`].
#[no_mangle]
#[cfg_attr(not(feature = "prefix-symbols"), no_mangle)]
#[cfg_attr(feature = "prefix-symbols", wasmi_c_api_macros::prefix_symbol)]
pub extern "C" fn wasm_global_as_extern_const(g: &wasm_global_t) -> &wasm_extern_t {
&g.inner
Expand All @@ -91,7 +91,7 @@ pub extern "C" fn wasm_global_as_extern_const(g: &wasm_global_t) -> &wasm_extern
///
/// It is the caller's responsibility not to alias the [`wasm_global_t`]
/// with its underlying, internal [`WasmStoreRef`](crate::WasmStoreRef).
#[no_mangle]
#[cfg_attr(not(feature = "prefix-symbols"), no_mangle)]
#[cfg_attr(feature = "prefix-symbols", wasmi_c_api_macros::prefix_symbol)]
pub unsafe extern "C" fn wasm_global_type(g: &wasm_global_t) -> Box<wasm_globaltype_t> {
let globaltype = g.global().ty(g.inner.store.context());
Expand All @@ -106,7 +106,7 @@ pub unsafe extern "C" fn wasm_global_type(g: &wasm_global_t) -> Box<wasm_globalt
///
/// It is the caller's responsibility not to alias the [`wasm_global_t`]
/// with its underlying, internal [`WasmStoreRef`](crate::WasmStoreRef).
#[no_mangle]
#[cfg_attr(not(feature = "prefix-symbols"), no_mangle)]
#[cfg_attr(feature = "prefix-symbols", wasmi_c_api_macros::prefix_symbol)]
pub unsafe extern "C" fn wasm_global_get(g: &mut wasm_global_t, out: &mut MaybeUninit<wasm_val_t>) {
let global = g.global();
Expand All @@ -125,7 +125,7 @@ pub unsafe extern "C" fn wasm_global_get(g: &mut wasm_global_t, out: &mut MaybeU
/// - It is the caller's responsibility that `val` matches the type of `g`.
/// - It is the caller's responsibility not to alias the [`wasm_global_t`]
/// with its underlying, internal [`WasmStoreRef`](crate::WasmStoreRef).
#[no_mangle]
#[cfg_attr(not(feature = "prefix-symbols"), no_mangle)]
#[cfg_attr(feature = "prefix-symbols", wasmi_c_api_macros::prefix_symbol)]
pub unsafe extern "C" fn wasm_global_set(g: &mut wasm_global_t, val: &wasm_val_t) {
let global = g.global();
Expand Down
4 changes: 2 additions & 2 deletions crates/c_api/src/instance.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ impl wasm_instance_t {
/// with its underlying, internal [`WasmStoreRef`].
///
/// [Wasm core specification]: https://webassembly.github.io/spec/core/exec/modules.html#exec-instantiation
#[no_mangle]
#[cfg_attr(not(feature = "prefix-symbols"), no_mangle)]
#[cfg_attr(feature = "prefix-symbols", wasmi_c_api_macros::prefix_symbol)]
pub unsafe extern "C" fn wasm_instance_new(
store: &mut wasm_store_t,
Expand Down Expand Up @@ -80,7 +80,7 @@ pub unsafe extern "C" fn wasm_instance_new(
///
/// It is the caller's responsibility not to alias the [`wasm_instance_t`]
/// with its underlying, internal [`WasmStoreRef`].
#[no_mangle]
#[cfg_attr(not(feature = "prefix-symbols"), no_mangle)]
#[cfg_attr(feature = "prefix-symbols", wasmi_c_api_macros::prefix_symbol)]
pub unsafe extern "C" fn wasm_instance_exports(
instance: &mut wasm_instance_t,
Expand Down
Loading

0 comments on commit 559c167

Please sign in to comment.