This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Allow core to work with code points above IV_MAX
authorKarl Williamson <khw@cpan.org>
Wed, 2 Oct 2019 21:29:05 +0000 (15:29 -0600)
committerKarl Williamson <khw@cpan.org>
Thu, 7 Nov 2019 02:11:45 +0000 (19:11 -0700)
Higher has been reserved for core use, and a future commit will want to
finally do this.

utf8.c
utf8.h

diff --git a/utf8.c b/utf8.c
index 9112145..6b98473 100644 (file)
--- a/utf8.c
+++ b/utf8.c
@@ -324,7 +324,9 @@ Perl_uvoffuni_to_utf8_flags_msgs(pTHX_ U8 *d, UV uv, const UV flags, HV** msgs)
      * performance hit on these high EBCDIC code points. */
 
     if (UNLIKELY(UNICODE_IS_SUPER(uv))) {
-        if (UNLIKELY(uv > MAX_LEGAL_CP)) {
+        if (UNLIKELY(      uv > MAX_LEGAL_CP
+                     && ! (flags & UNICODE_ALLOW_ABOVE_IV_MAX)))
+        {
             Perl_croak(aTHX_ cp_above_legal_max, uv, MAX_LEGAL_CP);
         }
         if (       (flags & UNICODE_WARN_SUPER)
diff --git a/utf8.h b/utf8.h
index 7ef1102..6a11ce0 100644 (file)
--- a/utf8.h
+++ b/utf8.h
@@ -940,6 +940,10 @@ Evaluates to 0xFFFD, the code point of the Unicode REPLACEMENT CHARACTER
 #define UNICODE_DISALLOW_NONCHAR       0x0020
 #define UNICODE_DISALLOW_SUPER         0x0040
 #define UNICODE_DISALLOW_PERL_EXTENDED 0x0080
+
+#ifdef PERL_CORE
+#  define UNICODE_ALLOW_ABOVE_IV_MAX   0x0100
+#endif
 #define UNICODE_DISALLOW_ABOVE_31_BIT  UNICODE_DISALLOW_PERL_EXTENDED
 
 #define UNICODE_GOT_SURROGATE       UNICODE_DISALLOW_SURROGATE