This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
pp_pack.c: Use safe UTF8SKIP
[perl5.git] / makedef.pl
index 1f44cc5..42436c7 100644 (file)
@@ -125,10 +125,47 @@ $define{PERL_IMPLICIT_CONTEXT} ||=
     $define{USE_ITHREADS} ||
     $define{MULTIPLICITY} ;
 
-if ($define{USE_ITHREADS} && $ARGS{PLATFORM} ne 'win32' && $^O ne 'darwin') {
+if ($define{USE_ITHREADS} && $ARGS{PLATFORM} ne 'win32' && $ARGS{PLATFORM} ne 'netware') {
     $define{USE_REENTRANT_API} = 1;
 }
 
+if (! $define{NO_LOCALE}) {
+    if ( ! $define{NO_POSIX_2008_LOCALE}
+        && $define{HAS_NEWLOCALE}
+        && $define{HAS_USELOCALE}
+        && $define{HAS_DUPLOCALE}
+        && $define{HAS_FREELOCALE})
+    {
+        $define{HAS_POSIX_2008_LOCALE} = 1;
+        $define{USE_LOCALE} = 1;
+    }
+    elsif ($define{HAS_SETLOCALE}) {
+        $define{USE_LOCALE} = 1;
+    }
+}
+
+my $cctype = $ARGS{CCTYPE} =~ s/MSVC//r;
+if (! $define{HAS_SETLOCALE} && $define{HAS_POSIX_2008_LOCALE}) {
+    $define{USE_POSIX_2008_LOCALE} = 1;
+    $define{USE_THREAD_SAFE_LOCALE} = 1;
+}
+elsif (   ($define{USE_ITHREADS} || $define{USE_THREAD_SAFE_LOCALE})
+       && (    $define{HAS_POSIX_2008_LOCALE}
+           || ($ARGS{PLATFORM} eq 'win32' && (   $cctype !~ /\D/
+                                              && $cctype >= 80)))
+       && ! $define{NO_THREAD_SAFE_LOCALE})
+{
+    $define{USE_THREAD_SAFE_LOCALE} = 1 unless $define{USE_THREAD_SAFE_LOCALE};
+    $define{USE_POSIX_2008_LOCALE} = 1 if $define{HAS_POSIX_2008_LOCALE};
+}
+
+if (   $ARGS{PLATFORM} eq 'win32'
+    && $define{USE_THREAD_SAFE_LOCALE}
+    && $cctype < 140)
+{
+    $define{TS_W32_BROKEN_LOCALECONV} = 1;
+}
+
 # perl.h logic duplication ends
 
 print STDERR "Defines: (" . join(' ', sort keys %define) . ")\n"
@@ -257,7 +294,6 @@ unless ($define{'DEBUGGING'}) {
                    Perl_hv_assert
                    PL_watchaddr
                    PL_watchok
-                   PL_watch_pvx
                         );
 }
 
@@ -326,6 +362,8 @@ if ($define{'PERL_USE_SAFE_PUTENV'}) {
 
 unless ($define{'USE_ITHREADS'}) {
     ++$skip{PL_thr_key};
+    ++$skip{PL_user_prop_mutex};
+    ++$skip{PL_user_def_props_aTHX};
 }
 
 # USE_5005THREADS symbols. Kept as reference for easier removal
@@ -358,6 +396,7 @@ unless ($define{'USE_ITHREADS'}) {
 
 unless ($define{'USE_ITHREADS'}) {
     ++$skip{$_} foreach qw(
+                    PL_keyword_plugin_mutex
                    PL_check_mutex
                    PL_op_mutex
                    PL_regex_pad
@@ -365,6 +404,8 @@ unless ($define{'USE_ITHREADS'}) {
                    PL_dollarzero_mutex
                    PL_hints_mutex
                    PL_locale_mutex
+                   PL_lc_numeric_mutex
+                   PL_lc_numeric_mutex_depth
                    PL_my_ctx_mutex
                    PL_perlio_mutex
                    PL_stashpad
@@ -398,10 +439,23 @@ unless ($define{'USE_ITHREADS'}) {
                         );
 }
 
-unless ($define{'HAS_NEWLOCALE'} && ! $define{'NO_POSIX_2008_LOCALE'})
+if (      $define{NO_LOCALE}
+    || (! $define{USE_ITHREADS} && ! $define{USE_THREAD_SAFE_LOCALE}))
+{
+    ++$skip{$_} foreach qw(
+        PL_C_locale_obj
+        PL_curlocales
+    );
+}
+
+unless ( $define{'HAS_NEWLOCALE'}
+    &&   $define{'HAS_FREELOCALE'}
+    &&   $define{'HAS_USELOCALE'}
+    && ! $define{'NO_POSIX_2008_LOCALE'})
 {
     ++$skip{$_} foreach qw(
         PL_C_locale_obj
+        PL_underlying_numeric_obj
     );
 }
 
@@ -411,6 +465,7 @@ unless ($define{'PERL_IMPLICIT_CONTEXT'}) {
                    PL_my_cxt_list
                    PL_my_cxt_size
                    PL_my_cxt_keys
+                   PL_my_cxt_keys_size
                    Perl_croak_nocontext
                    Perl_die_nocontext
                    Perl_deb_nocontext
@@ -429,10 +484,12 @@ unless ($define{'PERL_IMPLICIT_CONTEXT'}) {
                         );
 }
 
-unless ($define{'PERL_OP_PARENT'}) {
-    ++$skip{$_} foreach qw(
-                   Perl_op_parent
-                );
+if ($define{USE_THREAD_SAFE_LOCALE}) {
+    ++$skip{PL_lc_numeric_mutex};
+    ++$skip{PL_lc_numeric_mutex_depth};
+    if (! $define{TS_W32_BROKEN_LOCALECONV}) {
+        ++$skip{PL_locale_mutex};
+    }
 }
 
 unless ($define{'USE_DTRACE'}) {
@@ -490,6 +547,7 @@ unless ($define{'PERL_GLOBAL_STRUCT'}) {
 unless ($define{'PERL_GLOBAL_STRUCT_PRIVATE'}) {
     ++$skip{$_} foreach qw(
                    PL_my_cxt_keys
+                   PL_my_cxt_keys_size
                    Perl_my_cxt_index
                         );
 }
@@ -531,6 +589,9 @@ unless ($define{USE_LOCALE_COLLATE}) {
                    PL_collxfrm_mult
                    Perl_sv_collxfrm
                    Perl_sv_collxfrm_flags
+                    PL_strxfrm_NUL_replacement
+                    PL_strxfrm_is_behaved
+                    PL_strxfrm_max_cp
                         );
 }
 
@@ -540,6 +601,9 @@ unless ($define{USE_LOCALE_NUMERIC}) {
                    PL_numeric_name
                    PL_numeric_radix_sv
                    PL_numeric_standard
+                    PL_numeric_underlying
+                    PL_numeric_underlying_is_standard
+                    PL_underlying_numeric_obj
                         );
 }
 
@@ -688,12 +752,13 @@ unless ($define{'USE_QUADMATH'}) {
 {
     my %seen;
     my ($embed) = setup_embed($ARGS{TARG_DIR});
+    my $excludedre = $define{'NO_MATHOMS'} ? qr/[xmib]/ : qr/[xmi]/;
 
     foreach (@$embed) {
        my ($flags, $retval, $func, @args) = @$_;
        next unless $func;
-       if (   ($flags =~ /[AX]/ && $flags !~ /[xmi]/)
-            || ($flags =~ /b/ && ! $define{'NO_MATHOMS'}))
+       if (($flags =~ /[AX]/ && $flags !~ $excludedre)
+            || (!$define{'NO_MATHOMS'} && $flags =~ /b/))
         {
            # public API, so export
 
@@ -848,6 +913,7 @@ if ($ARGS{PLATFORM} =~ /^win(?:32|ce)$/) {
                            win32_realloc
                            win32_free
                            win32_sleep
+                           win32_pause
                            win32_times
                            win32_access
                            win32_alarm