From 100414d678afad42741dec03a1e03b4c0b0de179 Mon Sep 17 00:00:00 2001 From: Wolfgang Bumiller Date: Wed, 22 Dec 2021 09:58:02 +0100 Subject: [PATCH] macro: fixup export visibility commi 54919078765f was incomplete, this fixes up the remaining 2 cases Fixes: 54919078765f ("don't export xs wrappers from modules") Signed-off-by: Wolfgang Bumiller --- perlmod-macro/src/function.rs | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/perlmod-macro/src/function.rs b/perlmod-macro/src/function.rs index 14372f7..22e6bfd 100644 --- a/perlmod-macro/src/function.rs +++ b/perlmod-macro/src/function.rs @@ -289,6 +289,12 @@ fn handle_return_kind( let mut handle_return; let wrapper_func; + let vis = if export_public { + quote! { #[no_mangle] pub } + } else { + quote! { #[allow(non_snake_case)] } + }; + let pthx = crate::pthx_param(); match ret { Return::None(result) => { @@ -319,12 +325,6 @@ fn handle_return_kind( }; } - let vis = if export_public { - quote! { #[no_mangle] pub } - } else { - quote! { #[allow(non_snake_case)] } - }; - wrapper_func = quote! { #[doc(hidden)] #vis extern "C" fn #xs_name(#pthx _cv: &::perlmod::ffi::CV) { @@ -373,9 +373,8 @@ fn handle_return_kind( }; wrapper_func = quote! { - #[no_mangle] #[doc(hidden)] - pub extern "C" fn #xs_name(#pthx _cv: &::perlmod::ffi::CV) { + #vis extern "C" fn #xs_name(#pthx _cv: &::perlmod::ffi::CV) { unsafe { match #impl_xs_name() { Ok(sv) => ::perlmod::ffi::stack_push_raw(sv), @@ -460,9 +459,8 @@ fn handle_return_kind( //} wrapper_func = quote! { - #[no_mangle] #[doc(hidden)] - pub extern "C" fn #xs_name(#pthx _cv: &::perlmod::ffi::CV) { + #vis extern "C" fn #xs_name(#pthx _cv: &::perlmod::ffi::CV) { unsafe { match #impl_xs_name() { Ok(sv) => { #push },