From 49825ce8d49ec49e0c08ecb341ea5a7b7383225b Mon Sep 17 00:00:00 2001 From: Karl Williamson Date: Sat, 1 Oct 2022 13:43:54 -0600 Subject: [PATCH] locale.c: Compile display fcn under more circumstances This is in preparation for it to be used in more instances in future commits. It uses a symbol that won't be defined until those commits. --- embed.fnc | 4 +++- embed.h | 8 +++++++- locale.c | 4 ++-- proto.h | 10 ++++++++-- 4 files changed, 20 insertions(+), 6 deletions(-) diff --git a/embed.fnc b/embed.fnc index 7045868..7623b3c 100644 --- a/embed.fnc +++ b/embed.fnc @@ -3450,13 +3450,15 @@ S |const char*|my_langinfo_i|const int item \ |NULLOK utf8ness_t * utf8ness # endif # ifdef DEBUGGING -S |const char *|get_LC_ALL_display SR |char * |my_setlocale_debug_string_i \ |const unsigned cat_index \ |NULLOK const char* locale \ |NULLOK const char* retval \ |const line_t line # endif +# if defined(DEBUGGING) || defined(USE_PERL_SWITCH_LOCALE_CONTEXT) +S |const char *|get_LC_ALL_display +# endif # endif S |const char *|get_displayable_string|NN const char * const s \ |NN const char * const e \ diff --git a/embed.h b/embed.h index b5531e0..ebad32a 100644 --- a/embed.h +++ b/embed.h @@ -1619,7 +1619,6 @@ #define set_padlist Perl_set_padlist # if defined(PERL_IN_LOCALE_C) # if defined(USE_LOCALE) -#define get_LC_ALL_display() S_get_LC_ALL_display(aTHX) #define my_setlocale_debug_string_i(a,b,c,d) S_my_setlocale_debug_string_i(aTHX_ a,b,c,d) # if defined(USE_LOCALE_COLLATE) #define print_collxfrm_input_and_return(a,b,c,d,e) S_print_collxfrm_input_and_return(aTHX_ a,b,c,d,e) @@ -1637,6 +1636,13 @@ #define tokereport(a,b) S_tokereport(aTHX_ a,b) # endif # endif +# if defined(DEBUGGING) || defined(USE_PERL_SWITCH_LOCALE_CONTEXT) +# if defined(PERL_IN_LOCALE_C) +# if defined(USE_LOCALE) +#define get_LC_ALL_display() S_get_LC_ALL_display(aTHX) +# endif +# endif +# endif # if defined(DEBUG_LEAKING_SCALARS_FORK_DUMP) #define dump_sv_child(a) Perl_dump_sv_child(aTHX_ a) # endif diff --git a/locale.c b/locale.c index 03c1981..09e4de0 100644 --- a/locale.c +++ b/locale.c @@ -1731,8 +1731,8 @@ S_calculate_LC_ALL(pTHX_ const char ** individ_locales) } #endif - -#if defined(USE_LOCALE) && defined(DEBUGGING) +#if defined(USE_LOCALE) && ( defined(DEBUGGING) \ + || defined(USE_PERL_SWITCH_LOCALE_CONTEXT)) STATIC const char * S_get_LC_ALL_display(pTHX) diff --git a/proto.h b/proto.h index 9e51fcf..853961e 100644 --- a/proto.h +++ b/proto.h @@ -5120,8 +5120,6 @@ PERL_CALLCONV void Perl_set_padlist(CV * cv, PADLIST * padlist); assert(cv) # if defined(PERL_IN_LOCALE_C) # if defined(USE_LOCALE) -STATIC const char * S_get_LC_ALL_display(pTHX); -#define PERL_ARGS_ASSERT_GET_LC_ALL_DISPLAY STATIC char * S_my_setlocale_debug_string_i(pTHX_ const unsigned cat_index, const char* locale, const char* retval, const line_t line) __attribute__warn_unused_result__; #define PERL_ARGS_ASSERT_MY_SETLOCALE_DEBUG_STRING_I @@ -5220,6 +5218,14 @@ STATIC void S_dump_regex_sets_structures(pTHX_ RExC_state_t *pRExC_state, AV * s assert(pRExC_state); assert(stack); assert(fence_stack) # endif #endif +#if defined(DEBUGGING) || defined(USE_PERL_SWITCH_LOCALE_CONTEXT) +# if defined(PERL_IN_LOCALE_C) +# if defined(USE_LOCALE) +STATIC const char * S_get_LC_ALL_display(pTHX); +#define PERL_ARGS_ASSERT_GET_LC_ALL_DISPLAY +# endif +# endif +#endif #if defined(DEBUG_LEAKING_SCALARS_FORK_DUMP) PERL_CALLCONV void Perl_dump_sv_child(pTHX_ SV *sv) __attribute__visibility__("hidden"); -- 1.8.3.1