Don't include interpreter variable unless used
authorKarl Williamson <khw@cpan.org>
Thu, 15 Mar 2018 03:08:54 +0000 (21:08 -0600)
committerKarl Williamson <khw@cpan.org>
Fri, 16 Mar 2018 20:09:42 +0000 (14:09 -0600)
This adds an #ifdef around this variable, so that it isn't defined
unless used.

Spotted by Daniel Dragan.

intrpvar.h
makedef.pl
sv.c

index 33d9526..6b56971 100644 (file)
@@ -262,7 +262,9 @@ PERLVAR(I, exit_flags,      U8)             /* was exit() unexpected, etc. */
 PERLVAR(I, utf8locale, bool)           /* utf8 locale detected */
 PERLVAR(I, in_utf8_CTYPE_locale, bool)
 PERLVAR(I, in_utf8_COLLATE_locale, bool)
+#if defined(USE_ITHREADS) && ! defined(USE_THREAD_SAFE_LOCALE)
 PERLVARI(I, lc_numeric_mutex_depth, int, 0)   /* Emulate general semaphore */
+#endif
 PERLVARA(I, locale_utf8ness, 256, char)
 
 #ifdef USE_LOCALE_CTYPE
index a339059..88273e5 100644 (file)
@@ -368,6 +368,7 @@ unless ($define{'USE_ITHREADS'}) {
                    PL_hints_mutex
                    PL_locale_mutex
                    PL_lc_numeric_mutex
+                   PL_lc_numeric_mutex_depth
                    PL_my_ctx_mutex
                    PL_perlio_mutex
                    PL_stashpad
@@ -442,6 +443,7 @@ if (${^SAFE_LOCALES}) {    # Don't need mutexes if have thread-safe operations
     ++$skip{PL_locale_mutex} unless $ARGS{PLATFORM} eq 'win32'
                                 && ($ARGS{CCTYPE} =~ s/MSVC//r) < 140;
     ++$skip{PL_lc_numeric_mutex};
+    ++$skip{PL_lc_numeric_mutex_depth};
 }
 
 unless ($define{'PERL_OP_PARENT'}) {
diff --git a/sv.c b/sv.c
index 1856ba3..1090384 100644 (file)
--- a/sv.c
+++ b/sv.c
@@ -15236,7 +15236,9 @@ perl_clone_using(PerlInterpreter *proto_perl, UV flags,
     PL_in_utf8_CTYPE_locale = proto_perl->Iin_utf8_CTYPE_locale;
     PL_in_utf8_COLLATE_locale = proto_perl->Iin_utf8_COLLATE_locale;
     my_strlcpy(PL_locale_utf8ness, proto_perl->Ilocale_utf8ness, sizeof(PL_locale_utf8ness));
+#if defined(USE_ITHREADS) && ! defined(USE_THREAD_SAFE_LOCALE)
     PL_lc_numeric_mutex_depth = 0;
+#endif
     /* Unicode features (see perlrun/-C) */
     PL_unicode         = proto_perl->Iunicode;