mirror of
https://git.proxmox.com/git/perlmod
synced 2025-10-04 15:07:15 +00:00
macro: export: copy use chosen visibility
when using the export macro directly without a package we previously always used #[no_mangle] pub extern "C" now instead of 'pub' we copy the original function's visibility Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
This commit is contained in:
parent
100414d678
commit
9bf583ca64
@ -69,6 +69,7 @@ pub fn handle_function(
|
||||
}
|
||||
|
||||
let name = func.sig.ident.clone();
|
||||
let export_public = export_public.then(|| &func.vis);
|
||||
let xs_name = attr
|
||||
.xs_name
|
||||
.clone()
|
||||
@ -283,16 +284,15 @@ fn handle_return_kind(
|
||||
xs_name: &Ident,
|
||||
impl_xs_name: &Ident,
|
||||
passed_arguments: TokenStream,
|
||||
export_public: bool,
|
||||
export_public: Option<&syn::Visibility>,
|
||||
) -> Result<ReturnHandling, Error> {
|
||||
let return_type;
|
||||
let mut handle_return;
|
||||
let wrapper_func;
|
||||
|
||||
let vis = if export_public {
|
||||
quote! { #[no_mangle] pub }
|
||||
} else {
|
||||
quote! { #[allow(non_snake_case)] }
|
||||
let vis = match export_public {
|
||||
Some(vis) => quote! { #[no_mangle] #vis },
|
||||
None => quote! { #[allow(non_snake_case)] },
|
||||
};
|
||||
|
||||
let pthx = crate::pthx_param();
|
||||
|
Loading…
Reference in New Issue
Block a user