This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
locale.c: Compile display fcn under more circumstances
authorKarl Williamson <khw@cpan.org>
Sat, 1 Oct 2022 19:43:54 +0000 (13:43 -0600)
committerKarl Williamson <khw@cpan.org>
Tue, 18 Oct 2022 12:22:16 +0000 (06:22 -0600)
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
embed.h
locale.c
proto.h

index 7045868..7623b3c 100644 (file)
--- 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 (file)
--- a/embed.h
+++ b/embed.h
 #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)
 #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
index 03c1981..09e4de0 100644 (file)
--- 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 (file)
--- 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");