Skip to content

Commit 559c167

Browse files
authored
clippy: fix no_mangle and export_name usage (#1337)
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.
1 parent b2e7429 commit 559c167

26 files changed

+140
-140
lines changed

crates/c_api/macro/lib.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ pub fn declare_own(input: proc_macro::TokenStream) -> proc_macro::TokenStream {
2626

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

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

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

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

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

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

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

147147
#[doc = #as_ref_const_docs]
148-
#[no_mangle]
148+
#[cfg_attr(not(feature = "prefix-symbols"), no_mangle)]
149149
#[cfg_attr(feature = "prefix-symbols", wasmi_c_api_macros::prefix_symbol)]
150150
pub extern "C" fn #as_ref_const(a: &#ty) -> ::alloc::boxed::Box<crate::wasm_ref_t> {
151151
#[cfg(feature = "std")]

crates/c_api/src/config.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ wasmi_c_api_macros::declare_own!(wasm_config_t);
2020
/// Wraps [`wasmi::Config::default`].
2121
///
2222
/// [`wasm_engine_new_with_config`]: crate::wasm_engine_new_with_config
23-
#[no_mangle]
23+
#[cfg_attr(not(feature = "prefix-symbols"), no_mangle)]
2424
#[cfg_attr(feature = "prefix-symbols", wasmi_c_api_macros::prefix_symbol)]
2525
pub extern "C" fn wasm_config_new() -> Box<wasm_config_t> {
2626
Box::new(wasm_config_t {

crates/c_api/src/engine.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ wasmi_c_api_macros::declare_own!(wasm_engine_t);
1818
/// The returned [`wasm_engine_t`] must be freed using [`wasm_engine_delete`].
1919
///
2020
/// Wraps [`wasmi::Engine::default`].
21-
#[no_mangle]
21+
#[cfg_attr(not(feature = "prefix-symbols"), no_mangle)]
2222
#[cfg_attr(feature = "prefix-symbols", wasmi_c_api_macros::prefix_symbol)]
2323
pub extern "C" fn wasm_engine_new() -> Box<wasm_engine_t> {
2424
Box::new(wasm_engine_t {
@@ -31,7 +31,7 @@ pub extern "C" fn wasm_engine_new() -> Box<wasm_engine_t> {
3131
/// The returned [`wasm_engine_t`] must be freed using [`wasm_engine_delete`].
3232
///
3333
/// Wraps [`wasmi::Engine::new`].
34-
#[no_mangle]
34+
#[cfg_attr(not(feature = "prefix-symbols"), no_mangle)]
3535
#[cfg_attr(feature = "prefix-symbols", wasmi_c_api_macros::prefix_symbol)]
3636
pub extern "C" fn wasm_engine_new_with_config(config: Box<wasm_config_t>) -> Box<wasm_engine_t> {
3737
Box::new(wasm_engine_t {

crates/c_api/src/error.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ impl From<wasmi_error_t> for Error {
2929
/// Creates a new [`wasmi_error_t`] with the given error message.
3030
///
3131
/// Wraps [`wasmi::Error::new`].
32-
#[no_mangle]
32+
#[cfg_attr(not(feature = "prefix-symbols"), no_mangle)]
3333
#[allow(clippy::not_unsafe_ptr_arg_deref)] // clippy 0.1.79 (129f3b99 2024-06-10): incorrectly reports a bug here
3434
pub extern "C" fn wasmi_error_new(msg: *const ffi::c_char) -> Option<Box<wasmi_error_t>> {
3535
let msg_bytes = unsafe { ffi::CStr::from_ptr(msg) };

crates/c_api/src/extern.rs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ pub struct wasm_extern_t {
2222
wasmi_c_api_macros::declare_ref!(wasm_extern_t);
2323

2424
/// Returns the [`wasm_extern_kind`] of the [`wasm_extern_t`].
25-
#[no_mangle]
25+
#[cfg_attr(not(feature = "prefix-symbols"), no_mangle)]
2626
#[cfg_attr(feature = "prefix-symbols", wasmi_c_api_macros::prefix_symbol)]
2727
pub extern "C" fn wasm_extern_kind(e: &wasm_extern_t) -> wasm_externkind_t {
2828
match e.which {
@@ -39,7 +39,7 @@ pub extern "C" fn wasm_extern_kind(e: &wasm_extern_t) -> wasm_externkind_t {
3939
///
4040
/// It is the caller's responsibility not to alias the [`wasm_extern_t`]
4141
/// with its underlying, internal [`WasmStoreRef`].
42-
#[no_mangle]
42+
#[cfg_attr(not(feature = "prefix-symbols"), no_mangle)]
4343
#[cfg_attr(feature = "prefix-symbols", wasmi_c_api_macros::prefix_symbol)]
4444
pub unsafe extern "C" fn wasm_extern_type(e: &wasm_extern_t) -> Box<wasm_externtype_t> {
4545
Box::new(wasm_externtype_t::from_extern_type(
@@ -50,7 +50,7 @@ pub unsafe extern "C" fn wasm_extern_type(e: &wasm_extern_t) -> Box<wasm_externt
5050
/// Returns the [`wasm_extern_t`] as reference to mutable [`wasm_func_t`] if possible.
5151
///
5252
/// Returns `None` if `e` is not a [`wasm_func_t`].
53-
#[no_mangle]
53+
#[cfg_attr(not(feature = "prefix-symbols"), no_mangle)]
5454
#[cfg_attr(feature = "prefix-symbols", wasmi_c_api_macros::prefix_symbol)]
5555
pub extern "C" fn wasm_extern_as_func(e: &mut wasm_extern_t) -> Option<&mut wasm_func_t> {
5656
wasm_func_t::try_from_mut(e)
@@ -59,7 +59,7 @@ pub extern "C" fn wasm_extern_as_func(e: &mut wasm_extern_t) -> Option<&mut wasm
5959
/// Returns the [`wasm_extern_t`] as reference to shared [`wasm_func_t`] if possible.
6060
///
6161
/// Returns `None` if `e` is not a [`wasm_func_t`].
62-
#[no_mangle]
62+
#[cfg_attr(not(feature = "prefix-symbols"), no_mangle)]
6363
#[cfg_attr(feature = "prefix-symbols", wasmi_c_api_macros::prefix_symbol)]
6464
pub extern "C" fn wasm_extern_as_func_const(e: &wasm_extern_t) -> Option<&wasm_func_t> {
6565
wasm_func_t::try_from(e)
@@ -68,7 +68,7 @@ pub extern "C" fn wasm_extern_as_func_const(e: &wasm_extern_t) -> Option<&wasm_f
6868
/// Returns the [`wasm_extern_t`] as reference to mutable [`wasm_global_t`] if possible.
6969
///
7070
/// Returns `None` if `e` is not a [`wasm_global_t`].
71-
#[no_mangle]
71+
#[cfg_attr(not(feature = "prefix-symbols"), no_mangle)]
7272
#[cfg_attr(feature = "prefix-symbols", wasmi_c_api_macros::prefix_symbol)]
7373
pub extern "C" fn wasm_extern_as_global(e: &mut wasm_extern_t) -> Option<&mut wasm_global_t> {
7474
wasm_global_t::try_from_mut(e)
@@ -77,7 +77,7 @@ pub extern "C" fn wasm_extern_as_global(e: &mut wasm_extern_t) -> Option<&mut wa
7777
/// Returns the [`wasm_extern_t`] as reference to shared [`wasm_global_t`] if possible.
7878
///
7979
/// Returns `None` if `e` is not a [`wasm_global_t`].
80-
#[no_mangle]
80+
#[cfg_attr(not(feature = "prefix-symbols"), no_mangle)]
8181
#[cfg_attr(feature = "prefix-symbols", wasmi_c_api_macros::prefix_symbol)]
8282
pub extern "C" fn wasm_extern_as_global_const(e: &wasm_extern_t) -> Option<&wasm_global_t> {
8383
wasm_global_t::try_from(e)
@@ -86,7 +86,7 @@ pub extern "C" fn wasm_extern_as_global_const(e: &wasm_extern_t) -> Option<&wasm
8686
/// Returns the [`wasm_extern_t`] as reference to mutable [`wasm_table_t`] if possible.
8787
///
8888
/// Returns `None` if `e` is not a [`wasm_table_t`].
89-
#[no_mangle]
89+
#[cfg_attr(not(feature = "prefix-symbols"), no_mangle)]
9090
#[cfg_attr(feature = "prefix-symbols", wasmi_c_api_macros::prefix_symbol)]
9191
pub extern "C" fn wasm_extern_as_table(e: &mut wasm_extern_t) -> Option<&mut wasm_table_t> {
9292
wasm_table_t::try_from_mut(e)
@@ -95,7 +95,7 @@ pub extern "C" fn wasm_extern_as_table(e: &mut wasm_extern_t) -> Option<&mut was
9595
/// Returns the [`wasm_extern_t`] as reference to shared [`wasm_table_t`] if possible.
9696
///
9797
/// Returns `None` if `e` is not a [`wasm_table_t`].
98-
#[no_mangle]
98+
#[cfg_attr(not(feature = "prefix-symbols"), no_mangle)]
9999
#[cfg_attr(feature = "prefix-symbols", wasmi_c_api_macros::prefix_symbol)]
100100
pub extern "C" fn wasm_extern_as_table_const(e: &wasm_extern_t) -> Option<&wasm_table_t> {
101101
wasm_table_t::try_from(e)
@@ -104,7 +104,7 @@ pub extern "C" fn wasm_extern_as_table_const(e: &wasm_extern_t) -> Option<&wasm_
104104
/// Returns the [`wasm_extern_t`] as reference to mutable [`wasm_memory_t`] if possible.
105105
///
106106
/// Returns `None` if `e` is not a [`wasm_memory_t`].
107-
#[no_mangle]
107+
#[cfg_attr(not(feature = "prefix-symbols"), no_mangle)]
108108
#[cfg_attr(feature = "prefix-symbols", wasmi_c_api_macros::prefix_symbol)]
109109
pub extern "C" fn wasm_extern_as_memory(e: &mut wasm_extern_t) -> Option<&mut wasm_memory_t> {
110110
wasm_memory_t::try_from_mut(e)
@@ -113,7 +113,7 @@ pub extern "C" fn wasm_extern_as_memory(e: &mut wasm_extern_t) -> Option<&mut wa
113113
/// Returns the [`wasm_extern_t`] as reference to shared [`wasm_memory_t`] if possible.
114114
///
115115
/// Returns `None` if `e` is not a [`wasm_memory_t`].
116-
#[no_mangle]
116+
#[cfg_attr(not(feature = "prefix-symbols"), no_mangle)]
117117
#[cfg_attr(feature = "prefix-symbols", wasmi_c_api_macros::prefix_symbol)]
118118
pub extern "C" fn wasm_extern_as_memory_const(e: &wasm_extern_t) -> Option<&wasm_memory_t> {
119119
wasm_memory_t::try_from(e)

crates/c_api/src/foreign.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ wasmi_c_api_macros::declare_ref!(wasm_foreign_t);
1212
/// # Note
1313
///
1414
/// This API is unsupported and will panic upon use.
15-
#[no_mangle]
15+
#[cfg_attr(not(feature = "prefix-symbols"), no_mangle)]
1616
#[cfg_attr(feature = "prefix-symbols", wasmi_c_api_macros::prefix_symbol)]
1717
pub extern "C" fn wasm_foreign_new(_store: &crate::wasm_store_t) -> Box<wasm_foreign_t> {
1818
unimplemented!("wasm_foreign_new")

crates/c_api/src/frame.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ wasmi_c_api_macros::declare_own!(wasm_frame_t);
1616
/// # Note
1717
///
1818
/// This API is unsupported and will panic upon use.
19-
#[no_mangle]
19+
#[cfg_attr(not(feature = "prefix-symbols"), no_mangle)]
2020
#[cfg_attr(feature = "prefix-symbols", wasmi_c_api_macros::prefix_symbol)]
2121
pub extern "C" fn wasm_frame_func_index(_frame: &wasm_frame_t<'_>) -> u32 {
2222
unimplemented!("wasm_frame_func_index")
@@ -27,7 +27,7 @@ pub extern "C" fn wasm_frame_func_index(_frame: &wasm_frame_t<'_>) -> u32 {
2727
/// # Note
2828
///
2929
/// This API is unsupported and will panic upon use.
30-
#[no_mangle]
30+
#[cfg_attr(not(feature = "prefix-symbols"), no_mangle)]
3131
#[cfg_attr(feature = "prefix-symbols", wasmi_c_api_macros::prefix_symbol)]
3232
pub extern "C" fn wasm_frame_func_offset(_frame: &wasm_frame_t<'_>) -> usize {
3333
unimplemented!("wasm_frame_func_offset")
@@ -38,7 +38,7 @@ pub extern "C" fn wasm_frame_func_offset(_frame: &wasm_frame_t<'_>) -> usize {
3838
/// # Note
3939
///
4040
/// This API is unsupported and will panic upon use.
41-
#[no_mangle]
41+
#[cfg_attr(not(feature = "prefix-symbols"), no_mangle)]
4242
#[cfg_attr(feature = "prefix-symbols", wasmi_c_api_macros::prefix_symbol)]
4343
pub extern "C" fn wasm_frame_instance(_arg1: *const wasm_frame_t<'_>) -> *mut wasm_instance_t {
4444
unimplemented!("wasm_frame_instance")
@@ -49,7 +49,7 @@ pub extern "C" fn wasm_frame_instance(_arg1: *const wasm_frame_t<'_>) -> *mut wa
4949
/// # Note
5050
///
5151
/// This API is unsupported and will panic upon use.
52-
#[no_mangle]
52+
#[cfg_attr(not(feature = "prefix-symbols"), no_mangle)]
5353
#[cfg_attr(feature = "prefix-symbols", wasmi_c_api_macros::prefix_symbol)]
5454
pub extern "C" fn wasm_frame_module_offset(_frame: &wasm_frame_t<'_>) -> usize {
5555
unimplemented!("wasm_frame_module_offset")
@@ -60,7 +60,7 @@ pub extern "C" fn wasm_frame_module_offset(_frame: &wasm_frame_t<'_>) -> usize {
6060
/// # Note
6161
///
6262
/// This API is unsupported and will panic upon use.
63-
#[no_mangle]
63+
#[cfg_attr(not(feature = "prefix-symbols"), no_mangle)]
6464
#[cfg_attr(feature = "prefix-symbols", wasmi_c_api_macros::prefix_symbol)]
6565
pub extern "C" fn wasm_frame_copy<'a>(_frame: &wasm_frame_t<'a>) -> Box<wasm_frame_t<'a>> {
6666
unimplemented!("wasm_frame_copy")

crates/c_api/src/func.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ unsafe fn create_function(
119119
///
120120
/// It is the caller's responsibility not to alias the [`wasm_functype_t`]
121121
/// with its underlying, internal [`WasmStoreRef`](crate::WasmStoreRef).
122-
#[no_mangle]
122+
#[cfg_attr(not(feature = "prefix-symbols"), no_mangle)]
123123
#[cfg_attr(feature = "prefix-symbols", wasmi_c_api_macros::prefix_symbol)]
124124
pub unsafe extern "C" fn wasm_func_new(
125125
store: &mut wasm_store_t,
@@ -141,7 +141,7 @@ pub unsafe extern "C" fn wasm_func_new(
141141
///
142142
/// It is the caller's responsibility not to alias the [`wasm_functype_t`]
143143
/// with its underlying, internal [`WasmStoreRef`](crate::WasmStoreRef).
144-
#[no_mangle]
144+
#[cfg_attr(not(feature = "prefix-symbols"), no_mangle)]
145145
#[cfg_attr(feature = "prefix-symbols", wasmi_c_api_macros::prefix_symbol)]
146146
pub unsafe extern "C" fn wasm_func_new_with_env(
147147
store: &mut wasm_store_t,
@@ -185,7 +185,7 @@ fn prepare_params_and_results(
185185
///
186186
/// It is the caller's responsibility not to alias the [`wasm_func_t`]
187187
/// with its underlying, internal [`WasmStoreRef`](crate::WasmStoreRef).
188-
#[no_mangle]
188+
#[cfg_attr(not(feature = "prefix-symbols"), no_mangle)]
189189
#[cfg_attr(feature = "prefix-symbols", wasmi_c_api_macros::prefix_symbol)]
190190
pub unsafe extern "C" fn wasm_func_call(
191191
func: &mut wasm_func_t,
@@ -250,7 +250,7 @@ fn error_from_panic(panic: Box<dyn Any + Send>) -> Error {
250250
///
251251
/// It is the caller's responsibility not to alias the [`wasm_func_t`]
252252
/// with its underlying, internal [`WasmStoreRef`](crate::WasmStoreRef).
253-
#[no_mangle]
253+
#[cfg_attr(not(feature = "prefix-symbols"), no_mangle)]
254254
#[cfg_attr(feature = "prefix-symbols", wasmi_c_api_macros::prefix_symbol)]
255255
pub unsafe extern "C" fn wasm_func_type(f: &wasm_func_t) -> Box<wasm_functype_t> {
256256
Box::new(wasm_functype_t::new(f.func().ty(f.inner.store.context())))
@@ -266,7 +266,7 @@ pub unsafe extern "C" fn wasm_func_type(f: &wasm_func_t) -> Box<wasm_functype_t>
266266
/// with its underlying, internal [`WasmStoreRef`](crate::WasmStoreRef).
267267
///
268268
/// [`FuncType::params`]: wasmi::FuncType::params
269-
#[no_mangle]
269+
#[cfg_attr(not(feature = "prefix-symbols"), no_mangle)]
270270
#[cfg_attr(feature = "prefix-symbols", wasmi_c_api_macros::prefix_symbol)]
271271
pub unsafe extern "C" fn wasm_func_param_arity(f: &wasm_func_t) -> usize {
272272
f.func().ty(f.inner.store.context()).params().len()
@@ -282,21 +282,21 @@ pub unsafe extern "C" fn wasm_func_param_arity(f: &wasm_func_t) -> usize {
282282
/// with its underlying, internal [`WasmStoreRef`](crate::WasmStoreRef).
283283
///
284284
/// [`FuncType::results`]: wasmi::FuncType::results
285-
#[no_mangle]
285+
#[cfg_attr(not(feature = "prefix-symbols"), no_mangle)]
286286
#[cfg_attr(feature = "prefix-symbols", wasmi_c_api_macros::prefix_symbol)]
287287
pub unsafe extern "C" fn wasm_func_result_arity(f: &wasm_func_t) -> usize {
288288
f.func().ty(f.inner.store.context()).results().len()
289289
}
290290

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

298298
/// Returns the [`wasm_func_t`] as shared reference to [`wasm_extern_t`].
299-
#[no_mangle]
299+
#[cfg_attr(not(feature = "prefix-symbols"), no_mangle)]
300300
#[cfg_attr(feature = "prefix-symbols", wasmi_c_api_macros::prefix_symbol)]
301301
pub extern "C" fn wasm_func_as_extern_const(f: &wasm_func_t) -> &wasm_extern_t {
302302
&f.inner

crates/c_api/src/global.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ impl wasm_global_t {
4848
///
4949
/// It is the caller's responsibility not to alias the [`wasm_global_t`]
5050
/// with its underlying, internal [`WasmStoreRef`](crate::WasmStoreRef).
51-
#[no_mangle]
51+
#[cfg_attr(not(feature = "prefix-symbols"), no_mangle)]
5252
#[cfg_attr(feature = "prefix-symbols", wasmi_c_api_macros::prefix_symbol)]
5353
pub unsafe extern "C" fn wasm_global_new(
5454
store: &mut wasm_store_t,
@@ -70,14 +70,14 @@ pub unsafe extern "C" fn wasm_global_new(
7070
}
7171

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

7979
/// Returns the [`wasm_global_t`] as shared reference to [`wasm_extern_t`].
80-
#[no_mangle]
80+
#[cfg_attr(not(feature = "prefix-symbols"), no_mangle)]
8181
#[cfg_attr(feature = "prefix-symbols", wasmi_c_api_macros::prefix_symbol)]
8282
pub extern "C" fn wasm_global_as_extern_const(g: &wasm_global_t) -> &wasm_extern_t {
8383
&g.inner
@@ -91,7 +91,7 @@ pub extern "C" fn wasm_global_as_extern_const(g: &wasm_global_t) -> &wasm_extern
9191
///
9292
/// It is the caller's responsibility not to alias the [`wasm_global_t`]
9393
/// with its underlying, internal [`WasmStoreRef`](crate::WasmStoreRef).
94-
#[no_mangle]
94+
#[cfg_attr(not(feature = "prefix-symbols"), no_mangle)]
9595
#[cfg_attr(feature = "prefix-symbols", wasmi_c_api_macros::prefix_symbol)]
9696
pub unsafe extern "C" fn wasm_global_type(g: &wasm_global_t) -> Box<wasm_globaltype_t> {
9797
let globaltype = g.global().ty(g.inner.store.context());
@@ -106,7 +106,7 @@ pub unsafe extern "C" fn wasm_global_type(g: &wasm_global_t) -> Box<wasm_globalt
106106
///
107107
/// It is the caller's responsibility not to alias the [`wasm_global_t`]
108108
/// with its underlying, internal [`WasmStoreRef`](crate::WasmStoreRef).
109-
#[no_mangle]
109+
#[cfg_attr(not(feature = "prefix-symbols"), no_mangle)]
110110
#[cfg_attr(feature = "prefix-symbols", wasmi_c_api_macros::prefix_symbol)]
111111
pub unsafe extern "C" fn wasm_global_get(g: &mut wasm_global_t, out: &mut MaybeUninit<wasm_val_t>) {
112112
let global = g.global();
@@ -125,7 +125,7 @@ pub unsafe extern "C" fn wasm_global_get(g: &mut wasm_global_t, out: &mut MaybeU
125125
/// - It is the caller's responsibility that `val` matches the type of `g`.
126126
/// - It is the caller's responsibility not to alias the [`wasm_global_t`]
127127
/// with its underlying, internal [`WasmStoreRef`](crate::WasmStoreRef).
128-
#[no_mangle]
128+
#[cfg_attr(not(feature = "prefix-symbols"), no_mangle)]
129129
#[cfg_attr(feature = "prefix-symbols", wasmi_c_api_macros::prefix_symbol)]
130130
pub unsafe extern "C" fn wasm_global_set(g: &mut wasm_global_t, val: &wasm_val_t) {
131131
let global = g.global();

crates/c_api/src/instance.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ impl wasm_instance_t {
4343
/// with its underlying, internal [`WasmStoreRef`].
4444
///
4545
/// [Wasm core specification]: https://webassembly.github.io/spec/core/exec/modules.html#exec-instantiation
46-
#[no_mangle]
46+
#[cfg_attr(not(feature = "prefix-symbols"), no_mangle)]
4747
#[cfg_attr(feature = "prefix-symbols", wasmi_c_api_macros::prefix_symbol)]
4848
pub unsafe extern "C" fn wasm_instance_new(
4949
store: &mut wasm_store_t,
@@ -80,7 +80,7 @@ pub unsafe extern "C" fn wasm_instance_new(
8080
///
8181
/// It is the caller's responsibility not to alias the [`wasm_instance_t`]
8282
/// with its underlying, internal [`WasmStoreRef`].
83-
#[no_mangle]
83+
#[cfg_attr(not(feature = "prefix-symbols"), no_mangle)]
8484
#[cfg_attr(feature = "prefix-symbols", wasmi_c_api_macros::prefix_symbol)]
8585
pub unsafe extern "C" fn wasm_instance_exports(
8686
instance: &mut wasm_instance_t,

0 commit comments

Comments
 (0)