From fb8fa88a0b161f344c66c1db0ce9beaf89755a8e Mon Sep 17 00:00:00 2001 From: "Paul \"LeoNerd\" Evans" Date: Wed, 17 Jan 2024 17:18:32 +0000 Subject: [PATCH] Expose some symbols from builtin.c to make them callable from op.c --- builtin.c | 13 +++++++------ embed.fnc | 6 ++++++ embed.h | 5 +++++ proto.h | 17 +++++++++++++++++ 4 files changed, 35 insertions(+), 6 deletions(-) diff --git a/builtin.c b/builtin.c index b350935e275e4..4e3449728286e 100644 --- a/builtin.c +++ b/builtin.c @@ -12,6 +12,7 @@ */ #include "EXTERN.h" +#define PERL_IN_BUILTIN_C #include "perl.h" #include "XSUB.h" @@ -39,8 +40,8 @@ static void S_warn_experimental_builtin(pTHX_ const char *name) /* These three utilities might want to live elsewhere to be reused from other * code sometime */ -#define prepare_export_lexical() S_prepare_export_lexical(aTHX) -static void S_prepare_export_lexical(pTHX) +void +Perl_prepare_export_lexical(pTHX) { assert(PL_compcv); @@ -59,8 +60,8 @@ static void S_export_lexical(pTHX_ SV *name, SV *sv) PL_curpad[off] = SvREFCNT_inc(sv); } -#define finish_export_lexical() S_finish_export_lexical(aTHX) -static void S_finish_export_lexical(pTHX) +void +Perl_finish_export_lexical(pTHX) { intro_my(); @@ -596,8 +597,8 @@ static void S_import_sym(pTHX_ SV *sym) export_lexical(ampname, (SV *)cv); } -#define import_builtin_bundle(ver) S_import_builtin_bundle(aTHX_ ver) -static void S_import_builtin_bundle(pTHX_ U16 ver) +void +Perl_import_builtin_bundle(pTHX_ U16 ver) { for(int i = 0; builtins[i].name; i++) { if(builtins[i].since_ver <= ver) diff --git a/embed.fnc b/embed.fnc index 4c6598355eba2..ea6d87812d33a 100644 --- a/embed.fnc +++ b/embed.fnc @@ -4076,6 +4076,12 @@ i |bool |PerlEnv_putenv |NN char *str #if defined(PERL_IN_AV_C) S |MAGIC *|get_aux_mg |NN AV *av #endif +#if defined(PERL_IN_BUILTIN_C) || defined(PERL_IN_OP_C) +p |void |finish_export_lexical +p |void |import_builtin_bundle \ + |U16 ver +p |void |prepare_export_lexical +#endif #if defined(PERL_IN_CLASS_C) || defined(PERL_IN_OP_C) || \ defined(PERL_IN_PAD_C) || defined(PERL_IN_PERLY_C) || \ defined(PERL_IN_TOKE_C) diff --git a/embed.h b/embed.h index 8e90549469df7..5569d0ca04689 100644 --- a/embed.h +++ b/embed.h @@ -1199,6 +1199,11 @@ # if defined(PERL_IN_AV_C) # define get_aux_mg(a) S_get_aux_mg(aTHX_ a) # endif +# if defined(PERL_IN_BUILTIN_C) || defined(PERL_IN_OP_C) +# define finish_export_lexical() Perl_finish_export_lexical(aTHX) +# define import_builtin_bundle(a) Perl_import_builtin_bundle(aTHX_ a) +# define prepare_export_lexical() Perl_prepare_export_lexical(aTHX) +# endif # if defined(PERL_IN_CLASS_C) || defined(PERL_IN_GLOBALS_C) || \ defined(PERL_IN_OP_C) || defined(PERL_IN_PEEP_C) # define ck_anoncode(a) Perl_ck_anoncode(aTHX_ a) diff --git a/proto.h b/proto.h index e748f085afe23..10b3d593a617a 100644 --- a/proto.h +++ b/proto.h @@ -6210,6 +6210,23 @@ S_get_aux_mg(pTHX_ AV *av); assert(av) #endif +#if defined(PERL_IN_BUILTIN_C) || defined(PERL_IN_OP_C) +PERL_CALLCONV void +Perl_finish_export_lexical(pTHX) + __attribute__visibility__("hidden"); +# define PERL_ARGS_ASSERT_FINISH_EXPORT_LEXICAL + +PERL_CALLCONV void +Perl_import_builtin_bundle(pTHX_ U16 ver) + __attribute__visibility__("hidden"); +# define PERL_ARGS_ASSERT_IMPORT_BUILTIN_BUNDLE + +PERL_CALLCONV void +Perl_prepare_export_lexical(pTHX) + __attribute__visibility__("hidden"); +# define PERL_ARGS_ASSERT_PREPARE_EXPORT_LEXICAL + +#endif /* defined(PERL_IN_BUILTIN_C) || defined(PERL_IN_OP_C) */ #if defined(PERL_IN_CLASS_C) || defined(PERL_IN_GLOBALS_C) || \ defined(PERL_IN_OP_C) || defined(PERL_IN_PEEP_C) PERL_CALLCONV OP *