mirror of
https://github.com/mii443/wasmer.git
synced 2025-12-08 13:48:26 +00:00
chore(c-api) Move cbindgen:ignore from functions/types to modules.
This patch removes the amount of `cbindgen:ignore` instructions by moving this instruction onto the parent module.
This commit is contained in:
@@ -3,14 +3,12 @@
|
||||
macro_rules! wasm_declare_vec_inner {
|
||||
($name:ident) => {
|
||||
paste::item! {
|
||||
/// cbindgen:ignore
|
||||
#[no_mangle]
|
||||
pub unsafe extern "C" fn [<wasm_ $name _vec_new_empty>](out: *mut [<wasm_ $name _vec_t>]) {
|
||||
// TODO: actually implement this
|
||||
[<wasm_ $name _vec_new_uninitialized>](out, 0);
|
||||
}
|
||||
|
||||
/// cbindgen:ignore
|
||||
#[no_mangle]
|
||||
pub unsafe extern "C" fn [<wasm_ $name _vec_delete>](ptr: *mut [<wasm_ $name _vec_t>]) {
|
||||
let vec = &mut *ptr;
|
||||
@@ -29,7 +27,6 @@ macro_rules! wasm_declare_vec_inner {
|
||||
macro_rules! wasm_declare_vec {
|
||||
($name:ident) => {
|
||||
paste::item! {
|
||||
/// cbindgen:ignore
|
||||
#[repr(C)]
|
||||
pub struct [<wasm_ $name _vec_t>] {
|
||||
pub size: usize,
|
||||
@@ -78,7 +75,6 @@ macro_rules! wasm_declare_vec {
|
||||
}
|
||||
|
||||
// TODO: investigate possible memory leak on `init` (owned pointer)
|
||||
/// cbindgen:ignore
|
||||
#[no_mangle]
|
||||
pub unsafe extern "C" fn [<wasm_ $name _vec_new>](out: *mut [<wasm_ $name _vec_t>], length: usize, init: *mut [<wasm_ $name _t>]) {
|
||||
let mut bytes: Vec<[<wasm_ $name _t>]> = Vec::with_capacity(length);
|
||||
@@ -92,7 +88,6 @@ macro_rules! wasm_declare_vec {
|
||||
::std::mem::forget(bytes);
|
||||
}
|
||||
|
||||
/// cbindgen:ignore
|
||||
#[no_mangle]
|
||||
pub unsafe extern "C" fn [<wasm_ $name _vec_new_uninitialized>](out: *mut [<wasm_ $name _vec_t>], length: usize) {
|
||||
let mut bytes: Vec<[<wasm_ $name _t>]> = Vec::with_capacity(length);
|
||||
@@ -112,7 +107,6 @@ macro_rules! wasm_declare_vec {
|
||||
macro_rules! wasm_declare_boxed_vec {
|
||||
($name:ident) => {
|
||||
paste::item! {
|
||||
/// cbindgen:ignore
|
||||
#[repr(C)]
|
||||
pub struct [<wasm_ $name _vec_t>] {
|
||||
pub size: usize,
|
||||
@@ -131,7 +125,6 @@ macro_rules! wasm_declare_boxed_vec {
|
||||
}
|
||||
|
||||
// TODO: investigate possible memory leak on `init` (owned pointer)
|
||||
/// cbindgen:ignore
|
||||
#[no_mangle]
|
||||
pub unsafe extern "C" fn [<wasm_ $name _vec_new>](out: *mut [<wasm_ $name _vec_t>], length: usize, init: *const *mut [<wasm_ $name _t>]) {
|
||||
let mut bytes: Vec<*mut [<wasm_ $name _t>]> = Vec::with_capacity(length);
|
||||
@@ -145,7 +138,6 @@ macro_rules! wasm_declare_boxed_vec {
|
||||
::std::mem::forget(bytes);
|
||||
}
|
||||
|
||||
/// cbindgen:ignore
|
||||
#[no_mangle]
|
||||
pub unsafe extern "C" fn [<wasm_ $name _vec_new_uninitialized>](out: *mut [<wasm_ $name _vec_t>], length: usize) {
|
||||
let mut bytes: Vec<*mut [<wasm_ $name _t>]> = Vec::with_capacity(length);
|
||||
@@ -167,7 +159,6 @@ macro_rules! wasm_declare_ref_base {
|
||||
wasm_declare_own!($name);
|
||||
|
||||
paste::item! {
|
||||
/// cbindgen:ignore
|
||||
#[no_mangle]
|
||||
pub extern "C" fn [<wasm_ $name _copy>](_arg: *const [<wasm_ $name _t>]) -> *mut [<wasm_ $name _t>] {
|
||||
todo!("in generated declare ref base");
|
||||
@@ -185,11 +176,9 @@ macro_rules! wasm_declare_ref_base {
|
||||
macro_rules! wasm_declare_own {
|
||||
($name:ident) => {
|
||||
paste::item! {
|
||||
/// cbindgen:ignore
|
||||
#[repr(C)]
|
||||
pub struct [<wasm_ $name _t>] {}
|
||||
|
||||
/// cbindgen:ignore
|
||||
#[no_mangle]
|
||||
pub extern "C" fn [<wasm_ $name _delete>](_arg: *mut [<wasm_ $name _t>]) {
|
||||
todo!("in generated delete")
|
||||
|
||||
Reference in New Issue
Block a user