diff options
author | 2017-02-05 00:31:51 +0000 | |
---|---|---|
committer | 2017-02-05 00:31:51 +0000 | |
commit | b8851fcc53cbe24fd20b090f26dd149e353f6174 (patch) | |
tree | 4b7c1695865f00ab7a0da30b5632d514848ea3a2 /gnu/usr.bin/perl/t/lib | |
parent | Add option PCIVERBOSE. (diff) | |
download | wireguard-openbsd-b8851fcc53cbe24fd20b090f26dd149e353f6174.tar.xz wireguard-openbsd-b8851fcc53cbe24fd20b090f26dd149e353f6174.zip |
Fix merge issues, remove excess files - match perl-5.24.1 dist
Diffstat (limited to 'gnu/usr.bin/perl/t/lib')
38 files changed, 1615 insertions, 605 deletions
diff --git a/gnu/usr.bin/perl/t/lib/1_compile.t b/gnu/usr.bin/perl/t/lib/1_compile.t deleted file mode 100644 index 2802ae2ad64..00000000000 --- a/gnu/usr.bin/perl/t/lib/1_compile.t +++ /dev/null @@ -1,64 +0,0 @@ -#!./perl - -# Modules should have their own tests. For historical reasons, some -# do not. This does basic compile tests on modules that have no tests -# of their own. - -BEGIN { - chdir 't'; - @INC = '../lib'; - require './test.pl'; -} - -use warnings; -use File::Spec::Functions; - -# Okay, this is the list. - -my @Core_Modules = grep /\S/, <DATA>; -chomp @Core_Modules; - -if (eval { require Socket }) { - # Two Net:: modules need the Convert::EBCDIC if in EBDCIC. - if (ord("A") != 193 || eval { require Convert::EBCDIC }) { - push @Core_Modules, qw(Net::Cmd Net::POP3); - } -} - -@Core_Modules = sort @Core_Modules; - -plan tests => 1+@Core_Modules; - -cmp_ok(@Core_Modules, '>', 0, "All modules should have tests"); -note("http://www.xray.mpe.mpg.de/mailing-lists/perl5-porters/2001-04/msg01223.html"); -note("20010421230349.P2946\@blackrider.blackstar.co.uk"); - -foreach my $module (@Core_Modules) { - if ($module eq 'ByteLoader' && $^O eq 'VMS') { - TODO: { - local $TODO = "$module needs porting on $^O"; - ok(compile_module($module), "compile $module"); - } - } - else { - ok(compile_module($module), "compile $module"); - } -} - -# We do this as a separate process else we'll blow the hell -# out of our namespace. -sub compile_module { - my ($module) = $_[0]; - - my $compmod = catfile(curdir(), 'lib', 'compmod.pl'); - my $lib = '-I' . catdir(updir(), 'lib'); - - my $out = scalar `$^X $lib $compmod $module`; - return $out =~ /^ok/; -} - -# These modules have no tests of their own. -# Keep up to date with -# http://perl-qa.hexten.net/wiki/index.php/Untested_Core_Modules -# and vice-versa. The list should only shrink. -__DATA__ diff --git a/gnu/usr.bin/perl/t/lib/Cname.pm b/gnu/usr.bin/perl/t/lib/Cname.pm index 562f59ae600..dad356ae666 100644 --- a/gnu/usr.bin/perl/t/lib/Cname.pm +++ b/gnu/usr.bin/perl/t/lib/Cname.pm @@ -24,14 +24,6 @@ sub translator { if ( $str eq 'TOO-LONG-STR') { return 'A' x 256; } - if ($str eq 'MALFORMED') { - $str = "\xDF\xDFabc"; - utf8::upgrade($str); - - # Create a malformed in first and second characters. - $str =~ s/^\C/A/; - $str =~ s/^(\C\C)\C/$1A/; - } return $str; } diff --git a/gnu/usr.bin/perl/t/lib/charnames/alias b/gnu/usr.bin/perl/t/lib/charnames/alias index b8786db30c2..33ccff42323 100644 --- a/gnu/usr.bin/perl/t/lib/charnames/alias +++ b/gnu/usr.bin/perl/t/lib/charnames/alias @@ -18,7 +18,7 @@ Here: 1 ######## # NAME autoload doesn't get viacode print "Here: \N{DIGIT THREE}\n"; -charnames::viacode(0x34); +charnames::viacode(utf8::unicode_to_native(0x34)); EXPECT OPTIONS regex Undefined subroutine &charnames::viacode called at - line \d+. @@ -327,7 +327,7 @@ use warnings; no warnings 'void'; use charnames (); charnames::vianame('SPACE'); -charnames::viacode(0x41); +charnames::viacode(utf8::unicode_to_native(0x41)); EXPECT OPTIONS regex $ @@ -335,24 +335,41 @@ $ # NAME no extraneous warning [perl #11560] use warnings; use charnames (); -print charnames::viacode(0x80), "\n"; +print charnames::viacode(utf8::unicode_to_native(0x80)), "\n"; EXPECT OPTIONS regex PADDING CHARACTER ######## -# NAME various wrong characters in :alias are errors -# Below, one of the EXPECT regexes matches both the UTF-8 and non-UTF-8 form. -# This is because under some circumstances the message gets output as UTF-8. +# NAME A wrong character in :alias is an error +# These next tests could be combined, but the messages can come out in +# different orders on EBCDIC vs ASCII, and can't have both 'random' and 'regex' +# options, and need 'regex' to avoid 'at line X' getting in the way. use charnames ":full", ":alias" => { "4e_ACUTE" => "LATIN SMALL LETTER E WITH ACUTE", - "e_A,CUTE" => "LATIN SMALL LETTER E WITH ACUTE", - "e_ACUT\x{d7}E" => "LATIN SMALL LETTER E WITH ACUTE", }; EXPECT OPTIONS regex Invalid character in charnames alias definition; marked by <-- HERE in '4<-- HERE e_ACUTE' +######## +# NAME Another wrong character in :alias is an error +use charnames ":full", ":alias" => { + "e_A,CUTE" => "LATIN SMALL LETTER E WITH ACUTE", + }; +EXPECT +OPTIONS regex Invalid character in charnames alias definition; marked by <-- HERE in 'e_A,<-- HERE CUTE' -Invalid character in charnames alias definition; marked by <-- HERE in 'e_ACUT(?:\x{d7}|\x{C3}\x{97})<-- HERE E' +######## +# NAME Another wrong character in :alias is an error +# The EXPECT regex matches both the UTF-8 and non-UTF-8 form. +# This is because under some circumstances the message gets output as UTF-8. +# We use \xab, as that is invalid in both ASCII and EBCDIC platforms, and we +# accept both UTF-8 and 1047 UTF-EBCDIC. +use charnames ":full", ":alias" => { + "e_ACUT\x{ab}E" => "LATIN SMALL LETTER E WITH ACUTE", + }; +EXPECT +OPTIONS regex +Invalid character in charnames alias definition; marked by <-- HERE in 'e_ACUT(?:\x{ab}|\x{C2}\x{AB}|\x{80\x{73})<-- HERE E' ######## # RT#73022 # NAME \N{...} interprets ... as octets rather than UTF-8 @@ -375,32 +392,36 @@ Unknown charname '転車に乗る人' at - line \d+, within string # NAME various wrong UTF-8 characters in :alias are errors # First has a punctuation, KATAKANA MIDDLE DOT, in it; second begins with a # digit: ARABIC-INDIC DIGIT FOUR +# Note that output order is alphabetical by character name use utf8; use open qw( :utf8 :std ); use charnames ":full", ":alias" => { "自転車・に乗る人" => "BICYCLIST", "٤転車に乗る人" => "BICYCLIST", + "TOO MANY SPACES" => "NO ENTRY SIGN", + "TRAILING SPACE " => "FACE WITH NO GOOD GESTURE" }; +print "ok\n" if "\N{TOO MANY SPACES}" eq "\x{1F6AB}"; +print "ok\n" if "\N{TRAILING SPACE }" eq "\x{1F645}"; print "ok\n" if "\N{自転車・に乗る人}" eq "\x{1F6B4}"; print "ok\n" if "\N{٤転車に乗る人}" eq "\x{1F6B4}"; EXPECT -OPTIONS regex +OPTIONS regex fatal +charnames alias definitions may not contain a sequence of multiple spaces; marked by <-- HERE in 'TOO <-- HERE MANY SPACES' +charnames alias definitions may not contain trailing white-space; marked by <-- HERE in 'TRAILING SPACE <-- HERE ' Invalid character in charnames alias definition; marked by <-- HERE in '٤<-- HERE 転車に乗る人' Invalid character in charnames alias definition; marked by <-- HERE in '自転車・<-- HERE に乗る人' at - line \d+ ######## -# NAME trailing and sequences of multiple spaces in :alias names are deprectated -use charnames ":alias" => { "TOO MANY SPACES" => "NO ENTRY SIGN", - "TRAILING SPACE " => "FACE WITH NO GOOD GESTURE" - }; -print "ok\n" if "\N{TOO MANY SPACES}" eq "\x{1F6AB}"; -print "ok\n" if "\N{TRAILING SPACE }" eq "\x{1F645}"; +# NAME Using NBSP in :alias names is deprectated +use utf8; +use open qw( :utf8 :std ); +use charnames ":alias" => { "NBSP SEPARATED SPACE" => "BLACK SMILING FACE" }; +print "ok\n" if "\N{NBSP SEPARATED SPACE}" eq "\x{263B}"; +print "ok\n" if "\N{NBSP SEPARATED SPACE}" eq "\x{263B}"; no warnings 'deprecated'; -print "ok\n" if "\N{TOO MANY SPACES}" eq "\x{1F6AB}"; -print "ok\n" if "\N{TRAILING SPACE }" eq "\x{1F645}"; +print "ok\n" if "\N{NBSP SEPARATED SPACE}" eq "\x{263B}"; EXPECT OPTIONS regex -A sequence of multiple spaces in a charnames alias definition is deprecated; marked by <-- HERE in 'TOO <-- HERE MANY SPACES' at - line \d+. -Trailing white-space in a charnames alias definition is deprecated; marked by <-- HERE in 'TRAILING SPACE <-- HERE ' at - line \d+. -ok +NO-BREAK SPACE in a charnames alias definition is deprecated; marked by <-- HERE in 'NBSP SEPARATED <-- HERE SPACE' at - line \d+. ok ok ok diff --git a/gnu/usr.bin/perl/t/lib/common.pl b/gnu/usr.bin/perl/t/lib/common.pl index 4ab00b1f503..367c676d516 100644 --- a/gnu/usr.bin/perl/t/lib/common.pl +++ b/gnu/usr.bin/perl/t/lib/common.pl @@ -6,7 +6,7 @@ # to call cur_test() to find out how many this executed BEGIN { - require './test.pl'; + require './test.pl'; require './charset_tools.pl'; } use Config; diff --git a/gnu/usr.bin/perl/t/lib/compmod.pl b/gnu/usr.bin/perl/t/lib/compmod.pl deleted file mode 100644 index fa032f1acf1..00000000000 --- a/gnu/usr.bin/perl/t/lib/compmod.pl +++ /dev/null @@ -1,19 +0,0 @@ -#!./perl - -BEGIN { - chdir 't'; - @INC = '../lib'; -} - -my $module = shift; - -# 'require open' confuses Perl, so we use instead. -eval "use $module ();"; -if( $@ ) { - print "not "; - $@ =~ s/\n/\n# /g; - warn "# require failed with '$@'\n"; -} -print "ok - $module\n"; - - diff --git a/gnu/usr.bin/perl/t/lib/croak/op b/gnu/usr.bin/perl/t/lib/croak/op index 603f718350c..cd3a6544e36 100644 --- a/gnu/usr.bin/perl/t/lib/croak/op +++ b/gnu/usr.bin/perl/t/lib/croak/op @@ -1,10 +1,25 @@ __END__ +# NAME join, +join, +EXPECT +Not enough arguments for join or string at - line 1, near "join," +Execution of - aborted due to compilation errors. +######## # NAME my $<special> my $!; EXPECT Can't use global $! in "my" at - line 1, near "my $!" Execution of - aborted due to compilation errors. ######## +# NAME my $<non-ASCII> doesn't output garbage +# \xB6 is same character in all three EBCDIC pages and Latin1 +use open ":std", ":utf8"; +eval qq|my \$\xb6;|; # ¶ in Latin-1, and EBCDIC 1047, 037, POSIX-BC +print $@; +exit 1; +EXPECT +Can't use global $¶ in "my" at (eval 1) line 1, near "my $¶" +######## # NAME OP_HELEM fields package Foo; use fields qw(a b); @@ -62,6 +77,18 @@ EXPECT Can't declare do block in "my" at - line 1, at EOF Execution of - aborted due to compilation errors. ######## +# NAME ($_, state $x) = ... +($_, CORE::state $x) = (); +EXPECT +Initialization of state variables in list context currently forbidden at - line 1, near ");" +Execution of - aborted due to compilation errors. +######## +# NAME my $y; ($y, state $x) = ... +my $y; ($y, CORE::state $x) = (); +EXPECT +Initialization of state variables in list context currently forbidden at - line 1, near ");" +Execution of - aborted due to compilation errors. +######## # NAME delete BAD delete $x; EXPECT @@ -82,3 +109,45 @@ exists argument is not a HASH or ARRAY element or a subroutine at - line 1. exists &foo() EXPECT exists argument is not a subroutine name at - line 1. +######## +# NAME push BAREWORD +push FRED; +EXPECT +Type of arg 1 to push must be array (not constant item) at - line 1, near "FRED;" +Execution of - aborted due to compilation errors. +######## +# NAME pop BAREWORD +pop FRED; +EXPECT +Type of arg 1 to pop must be array (not constant item) at - line 1, near "FRED;" +Execution of - aborted due to compilation errors. +######## +# NAME shift BAREWORD +shift FRED; +EXPECT +Type of arg 1 to shift must be array (not constant item) at - line 1, near "FRED;" +Execution of - aborted due to compilation errors. +######## +# NAME unshift BAREWORD +unshift FRED; +EXPECT +Type of arg 1 to unshift must be array (not constant item) at - line 1, near "FRED;" +Execution of - aborted due to compilation errors. +######## +# NAME keys BAREWORD +@a = keys FRED ; +EXPECT +Type of arg 1 to keys must be hash (not constant item) at - line 1, near "FRED ;" +Execution of - aborted due to compilation errors. +######## +# NAME values BAREWORD +@a = values FRED ; +EXPECT +Type of arg 1 to values must be hash (not constant item) at - line 1, near "FRED ;" +Execution of - aborted due to compilation errors. +######## +# NAME each BAREWORD +@a = each FRED ; +EXPECT +Type of arg 1 to each must be hash (not constant item) at - line 1, near "FRED ;" +Execution of - aborted due to compilation errors. diff --git a/gnu/usr.bin/perl/t/lib/croak/pp b/gnu/usr.bin/perl/t/lib/croak/pp index 9a2057b680f..e5839525d20 100644 --- a/gnu/usr.bin/perl/t/lib/croak/pp +++ b/gnu/usr.bin/perl/t/lib/croak/pp @@ -1,4 +1,10 @@ __END__ +# NAME our @a->{0} +# Somewhat nonsensical, but at least it should not fail an assertion. +our @a->{0}; +EXPECT +Can't use an undefined value as a HASH reference at - line 2. +######## # NAME [perl #119809] Attempt to bless into a reference (tied) sub TIESCALAR { bless [] } sub FETCH { [] } diff --git a/gnu/usr.bin/perl/t/lib/croak/pp_sys b/gnu/usr.bin/perl/t/lib/croak/pp_sys new file mode 100644 index 00000000000..739b7e95af7 --- /dev/null +++ b/gnu/usr.bin/perl/t/lib/croak/pp_sys @@ -0,0 +1,16 @@ +__END__ +# pp_sys.c +# NAME pipe() croaks on bad left side [perl #126480] +# SKIP ? use Config; !$Config{d_pipe} && "No pipe() available" +my $fh; +pipe($$5, $fh) +EXPECT +Bad symbol for filehandle at - line 3. +######## +# NAME pipe() croaks on bad right side [perl #126480] +# SKIP ? use Config; !$Config{d_pipe} && "No pipe() available" +my $fh; +pipe($fh, $$5) +EXPECT +Bad symbol for filehandle at - line 2. +######## diff --git a/gnu/usr.bin/perl/t/lib/croak/toke b/gnu/usr.bin/perl/t/lib/croak/toke index 0572094e5f6..18dfa24cc67 100644 --- a/gnu/usr.bin/perl/t/lib/croak/toke +++ b/gnu/usr.bin/perl/t/lib/croak/toke @@ -1,4 +1,60 @@ __END__ +# NAME foo found where operator expected +myfunc 1,2,3 +EXPECT +Number found where operator expected at - line 1, near "myfunc 1" + (Do you need to predeclare myfunc?) +syntax error at - line 1, near "myfunc 1" +Execution of - aborted due to compilation errors. +######## +# NAME foo found where operator expected (after strict error, w/fatal warnings) +use warnings FATAL => 'all'; +use strict; +$foo; +myfunc 1,2,3 +EXPECT +Global symbol "$foo" requires explicit package name (did you forget to declare "my $foo"?) at - line 3. +Number found where operator expected at - line 4, near "myfunc 1" + (Do you need to predeclare myfunc?) +syntax error at - line 4, near "myfunc 1" +Execution of - aborted due to compilation errors. +######## +# NAME (Missing operator before ${?) [perl #123737] +0${ +EXPECT +Scalar found where operator expected at - line 1, near "0${" + (Missing operator before ${?) +syntax error at - line 1, near "0$" +Missing right curly or square bracket at - line 1, at end of line +Execution of - aborted due to compilation errors. +######## +# NAME (Missing operator before $#{?) [perl #123737] +0$#{ +EXPECT +Array length found where operator expected at - line 1, near "0$#{" + (Missing operator before $#{?) +syntax error at - line 1, near "0$#" +Missing right curly or square bracket at - line 1, at end of line +Execution of - aborted due to compilation errors. +######## +# NAME (Missing operator before @foo) [perl #123737] +0@foo +EXPECT +Array found where operator expected at - line 1, near "0@foo" + (Missing operator before @foo?) +syntax error at - line 1, near "0@foo +" +Execution of - aborted due to compilation errors. +######## +# NAME (Missing operator before @{) [perl #123737] +0@{ +EXPECT +Array found where operator expected at - line 1, near "0@{" + (Missing operator before @{?) +syntax error at - line 1, near "0@" +Missing right curly or square bracket at - line 1, at end of line +Execution of - aborted due to compilation errors. +######## # NAME Unterminated here-doc in string eval eval "<<foo"; die $@ EXPECT @@ -9,12 +65,37 @@ eval "s//<<foo/e"; die $@ EXPECT Can't find string terminator "foo" anywhere before EOF at (eval 1) line 1. ######## +# NAME Unterminated here-doc in string +"${<<foo"; # Used to give ‘Attempt to free blah blah blah’ +EXPECT +Can't find string terminator "foo" anywhere before EOF at - line 1. +######## +# NAME Unterminated qw// +qw/ +EXPECT +Can't find string terminator "/" anywhere before EOF at - line 1. +######## +# NAME Unterminated q// +qw/ +EXPECT +Can't find string terminator "/" anywhere before EOF at - line 1. +######## +# NAME Unterminated '' +' +EXPECT +Can't find string terminator "'" anywhere before EOF at - line 1. +######## # NAME /\N{/ /\N{/ EXPECT Missing right brace on \N{} or unescaped left brace after \N at - line 1, within pattern Execution of - aborted due to compilation errors. ######## +# NAME map{for our *a... +map{for our *a (1..10) {$_.=$x}} +EXPECT +Missing $ on loop variable at - line 1. +######## # NAME Missing name in "my sub" use feature 'lexical_subs'; my sub; EXPECT @@ -34,6 +115,17 @@ EXPECT The lexical_subs feature is experimental at - line 2. Missing name in "state sub" at - line 2. ######## +# NAME my sub pack::foo +use feature 'lexical_subs', 'state'; +my sub foo::bar; +state sub foo::bear; +EXPECT +The lexical_subs feature is experimental at - line 2. +The lexical_subs feature is experimental at - line 3. +"my" subroutine &foo::bar can't be in a package at - line 2, near "my sub foo::bar" +"state" subroutine &foo::bear can't be in a package at - line 3, near "state sub foo::bear" +Execution of - aborted due to compilation errors. +######## # NAME Integer constant overloading returning undef use overload; BEGIN { overload::constant integer => sub {}; undef *^H } @@ -130,22 +222,83 @@ Constant(qq): Call to &{$^H{qr}} did not return a defined value at - line 3, wit Constant(q): Call to &{$^H{qr}} did not return a defined value at - line 3, within pattern Execution of - aborted due to compilation errors. ######## +# NAME Failed constant overloading should not cause a double free +use overload; +BEGIN { overload::constant q => sub {}; undef *^H } +undef(1,2); +undef(1,2); +undef(1,2); +undef(1,2); +undef(1,2); +undef(1,2); +undef(1,2); +undef(1,2); +undef(1,2); +"a" +EXPECT +Too many arguments for undef operator at - line 3, near "2)" +Too many arguments for undef operator at - line 4, near "2)" +Too many arguments for undef operator at - line 5, near "2)" +Too many arguments for undef operator at - line 6, near "2)" +Too many arguments for undef operator at - line 7, near "2)" +Too many arguments for undef operator at - line 8, near "2)" +Too many arguments for undef operator at - line 9, near "2)" +Too many arguments for undef operator at - line 10, near "2)" +Too many arguments for undef operator at - line 11, near "2)" +Constant(q) unknown at - line 12, near ""a"" +- has too many errors. +######## # NAME Unterminated delimiter for here document <<"foo EXPECT Unterminated delimiter for here document at - line 1. ######## -# NAME Unterminated qw// -qw/ +# NAME my (our $x) errors +my (our $x); EXPECT -Can't find string terminator "/" anywhere before EOF at - line 1. +Can't redeclare "our" in "my" at - line 1, at end of line +Execution of - aborted due to compilation errors. ######## -# NAME Unterminated q// -qw/ +# NAME our (my $x) errors +our (my $x); EXPECT -Can't find string terminator "/" anywhere before EOF at - line 1. +Can't redeclare "my" in "our" at - line 1, at end of line +Execution of - aborted due to compilation errors. ######## -# NAME Unterminated '' -' +# NAME state (my $x) errors +use feature 'state'; +state (my $x); EXPECT -Can't find string terminator "'" anywhere before EOF at - line 1. +Can't redeclare "my" in "state" at - line 2, at end of line +Execution of - aborted due to compilation errors. +######## +# NAME our (state $x) errors +use feature 'state'; +our (state $x); +EXPECT +Can't redeclare "state" in "our" at - line 2, at end of line +Execution of - aborted due to compilation errors. +######## +# NAME my (my $x) errors +my (my $x, $y, $z); +EXPECT +Can't redeclare "my" in "my" at - line 1, at end of line +Execution of - aborted due to compilation errors. +######## +# NAME our (our $x) errors +our ($x, our($y), $z); +EXPECT +Can't redeclare "our" in "our" at - line 1, near ", " +Execution of - aborted due to compilation errors. +######## +# NAME state (state $x) errors +use feature 'state'; +state ($x, $y, state $z); +EXPECT +Can't redeclare "state" in "state" at - line 2, near ", " +Execution of - aborted due to compilation errors. +######## +# NAME BEGIN <> [perl #125341] +BEGIN <> +EXPECT +Illegal declaration of subroutine BEGIN at - line 1. diff --git a/gnu/usr.bin/perl/t/lib/cygwin.t b/gnu/usr.bin/perl/t/lib/cygwin.t index 9033d3fb53d..ba861701267 100755 --- a/gnu/usr.bin/perl/t/lib/cygwin.t +++ b/gnu/usr.bin/perl/t/lib/cygwin.t @@ -52,13 +52,16 @@ is(Cygwin::mount_flags("/cygdrive") =~ /,cygdrive/, 1, "check cygdrive mount_fl # Cygdrive mount prefix my @flags = split(/,/, Cygwin::mount_flags('/cygdrive')); my $prefix = pop(@flags); -ok($prefix, "cygdrive mount prefix = " . (($prefix) ? $prefix : '<none>')); -chomp(my $prefix2 = `df | grep -i '^c: ' | cut -d% -f2 | xargs`); -$prefix2 =~ s/\/c$//i; -if (! $prefix2) { - $prefix2 = '/'; +ok($prefix, "cygdrive mount prefix = " . (($prefix) ? $prefix : '<none>')); +my $prefix2 = readlink "/proc/cygdrive"; +unless ($prefix2) { + # fallback to old Cygwin, the drive need not actually exist, so + # this will always work (but might return the wrong prefix if the + # user re-mounted C:\ + chomp($prefix2 = `cygpath C:`); + $prefix2 = substr($prefix2, 0, -1-(length($prefix2)>2)); } -is($prefix, $prefix2, 'cygdrive mount prefix'); +is($prefix, $prefix2, 'cygdrive mount prefix2 = ' . $prefix2); my @mnttbl = Cygwin::mount_table(); ok(@mnttbl > 0, "non empty mount_table"); diff --git a/gnu/usr.bin/perl/t/lib/deprecate.t b/gnu/usr.bin/perl/t/lib/deprecate.t index 9e59469d46e..09b258f87c8 100755 --- a/gnu/usr.bin/perl/t/lib/deprecate.t +++ b/gnu/usr.bin/perl/t/lib/deprecate.t @@ -2,6 +2,7 @@ use strict; BEGIN { + chdir 't' if -d 't'; require './test.pl'; } use File::Copy (); diff --git a/gnu/usr.bin/perl/t/lib/feature/bundle b/gnu/usr.bin/perl/t/lib/feature/bundle index a40aba4a13b..b9facc0bd69 100644 --- a/gnu/usr.bin/perl/t/lib/feature/bundle +++ b/gnu/usr.bin/perl/t/lib/feature/bundle @@ -9,20 +9,20 @@ Helloworld ######## # Standard feature bundle, no 5.11 use feature ":5.10"; -say ord uc chr 233; +say utf8::native_to_unicode(ord uc chr utf8::unicode_to_native(233)); EXPECT 233 ######## # Standard feature bundle, 5.11 use feature ":5.11"; -say ord uc chr 233; +say utf8::native_to_unicode(ord uc chr utf8::unicode_to_native(233)); EXPECT 201 ######## # Standard feature bundle, 5.11 use feature ":5.11"; use utf8; -say ord "\ué"; # this is utf8 +say utf8::native_to_unicode(ord "\ué"); # this is utf8 EXPECT 201 ######## diff --git a/gnu/usr.bin/perl/t/lib/feature/implicit b/gnu/usr.bin/perl/t/lib/feature/implicit index a741421e7d3..79f1bf8888a 100644 --- a/gnu/usr.bin/perl/t/lib/feature/implicit +++ b/gnu/usr.bin/perl/t/lib/feature/implicit @@ -107,18 +107,21 @@ b ######## # Implicit unicode_string feature use v5.14; -print 'ss' =~ /\xdf/i ? "ok\n" : "nok\n"; +my $sharp_s = chr utf8::unicode_to_native(0xdf); +print 'ss' =~ /$sharp_s/i ? "ok\n" : "nok\n"; use v5.8.8; -print 'ss' =~ /\xdf/i ? "ok\n" : "nok\n"; +print 'ss' =~ /$sharp_s/i ? "ok\n" : "nok\n"; EXPECT ok nok ######## # Implicit unicode_eval feature use v5.15; -print eval "use utf8; q|\xc5\xbf|" eq "\xc5\xbf" ? "ok\n" : "nok\n"; +require '../../t/charset_tools.pl'; +my $long_s = byte_utf8a_to_utf8n("\xc5\xbf"); +print eval "use utf8; q|$long_s|" eq $long_s ? "ok\n" : "nok\n"; use v5.8.8; -print eval "use utf8; q|\xc5\xbf|" eq "\x{17f}" ? "ok\n" : "nok\n"; +print eval "use utf8; q|$long_s|" eq "\x{17f}" ? "ok\n" : "nok\n"; EXPECT ok ok diff --git a/gnu/usr.bin/perl/t/lib/h2ph.pht b/gnu/usr.bin/perl/t/lib/h2ph.pht index cda8d21051c..f068d6dae46 100644 --- a/gnu/usr.bin/perl/t/lib/h2ph.pht +++ b/gnu/usr.bin/perl/t/lib/h2ph.pht @@ -90,6 +90,10 @@ unless(defined(&_H2PH_H_)) { } eval("sub flim () { 0; }") unless defined(&flim); eval("sub flam () { 1; }") unless defined(&flam); + eval 'sub blli_in_use { + my($blli) = @_; + eval q({ ($blli->{l2_proto}) || ($blli->{l3_proto}); }); + }' unless defined(&blli_in_use); eval 'sub multiline () {"multilinestring";}' unless defined(&multiline); } 1; diff --git a/gnu/usr.bin/perl/t/lib/mypragma.t b/gnu/usr.bin/perl/t/lib/mypragma.t index 0464897ebc1..eb93e7cd6ad 100644 --- a/gnu/usr.bin/perl/t/lib/mypragma.t +++ b/gnu/usr.bin/perl/t/lib/mypragma.t @@ -1,14 +1,15 @@ #!./perl -use strict; -use warnings; - BEGIN { - unshift @INC, 'lib'; + chdir 't' if -d 't'; require './test.pl'; + @INC = qw(lib ../lib); plan(tests => 14); } +use strict; +use warnings; + use mypragma (); # don't enable this pragma yet BEGIN { diff --git a/gnu/usr.bin/perl/t/lib/no_load.t b/gnu/usr.bin/perl/t/lib/no_load.t index 39f0dc6816e..58520056103 100644 --- a/gnu/usr.bin/perl/t/lib/no_load.t +++ b/gnu/usr.bin/perl/t/lib/no_load.t @@ -11,7 +11,7 @@ BEGIN { use strict; use warnings; -require "test.pl"; +require "./test.pl"; # # Format: [Module-that-should-not-be-loaded => modules to test] diff --git a/gnu/usr.bin/perl/t/lib/overload_nomethod.t b/gnu/usr.bin/perl/t/lib/overload_nomethod.t index d72dceea105..edff1639a11 100644 --- a/gnu/usr.bin/perl/t/lib/overload_nomethod.t +++ b/gnu/usr.bin/perl/t/lib/overload_nomethod.t @@ -12,11 +12,11 @@ package main; my $foo = Foo->new; eval {my $val = $foo + 1}; -ok( $@ =~ /unimplemented/ ); +ok( $@ =~ /unimplemented/, "'+' not implemented; 'nomethod' special key invoked" ); eval {$foo += 1}; -ok( $@ =~ /unimplemented/ ); +ok( $@ =~ /unimplemented/, "'+=' not implemented; 'nomethod' special key invoked" ); eval {my $val = 0; $val += $foo}; -ok( $@ =~ /unimplemented/ ); +ok( $@ =~ /unimplemented/, "'+=' not implemented; 'nomethod' special key invoked" ); diff --git a/gnu/usr.bin/perl/t/lib/proxy_constant_subs.t b/gnu/usr.bin/perl/t/lib/proxy_constant_subs.t index 9e73006fce5..0b327b1c4ab 100644 --- a/gnu/usr.bin/perl/t/lib/proxy_constant_subs.t +++ b/gnu/usr.bin/perl/t/lib/proxy_constant_subs.t @@ -1,5 +1,6 @@ my @symbols; BEGIN { + chdir 't' if -d 't'; require './test.pl'; skip_all_without_dynamic_extension($_) foreach qw(B Fcntl); # S_IFMT is a real subroutine, and acts as control diff --git a/gnu/usr.bin/perl/t/lib/strict/refs b/gnu/usr.bin/perl/t/lib/strict/refs index e74851220e7..ee9f42c92d1 100644 --- a/gnu/usr.bin/perl/t/lib/strict/refs +++ b/gnu/usr.bin/perl/t/lib/strict/refs @@ -340,24 +340,6 @@ defined $$x; EXPECT Can't use string ("foo") as a SCALAR ref while "strict refs" in use at - line 4. ######## -# [perl #37886] strict 'refs' doesn't apply inside defined -use strict 'refs'; -my $x = "foo"; -defined @$x; -EXPECT -defined(@array) is deprecated at - line 4. - (Maybe you should just omit the defined()?) -Can't use string ("foo") as an ARRAY ref while "strict refs" in use at - line 4. -######## -# [perl #37886] strict 'refs' doesn't apply inside defined -use strict 'refs'; -my $x = "foo"; -defined %$x; -EXPECT -defined(%hash) is deprecated at - line 4. - (Maybe you should just omit the defined()?) -Can't use string ("foo") as a HASH ref while "strict refs" in use at - line 4. -######## # [perl #74168] Assertion failed: (SvTYPE(_svcur) >= SVt_PV), function Perl_softref2xv, file pp.c, line 240. use strict 'refs'; my $o = 1 ; $o->{1} ; diff --git a/gnu/usr.bin/perl/t/lib/strict/subs b/gnu/usr.bin/perl/t/lib/strict/subs index 5fd0b03de7f..246be0ee9be 100644 --- a/gnu/usr.bin/perl/t/lib/strict/subs +++ b/gnu/usr.bin/perl/t/lib/strict/subs @@ -108,7 +108,7 @@ use strict 'vars' ; $joe = 1 ; EXPECT Variable "$joe" is not imported at - line 8. -Global symbol "$joe" requires explicit package name at - line 8. +Global symbol "$joe" requires explicit package name (did you forget to declare "my $joe"?) at - line 8. Execution of - aborted due to compilation errors. ######## @@ -120,7 +120,7 @@ no strict; } $joe = 1 ; EXPECT -Global symbol "$joe" requires explicit package name at - line 6. +Global symbol "$joe" requires explicit package name (did you forget to declare "my $joe"?) at - line 6. Execution of - aborted due to compilation errors. ######## @@ -458,3 +458,12 @@ use strict 'subs'; EXPECT Bareword "FOO" not allowed while "strict subs" in use at - line 3. Execution of - aborted due to compilation errors. +######## +# [perl #126981] Strict subs vs. multideref +my $h; +my $v1 = $h->{+CONST_TYPO}; +use strict 'subs'; +my $v2 = $h->{+CONST_TYPO}; +EXPECT +Bareword "CONST_TYPO" not allowed while "strict subs" in use at - line 5. +Execution of - aborted due to compilation errors. diff --git a/gnu/usr.bin/perl/t/lib/strict/vars b/gnu/usr.bin/perl/t/lib/strict/vars index c6cb0679396..b571751b520 100644 --- a/gnu/usr.bin/perl/t/lib/strict/vars +++ b/gnu/usr.bin/perl/t/lib/strict/vars @@ -49,7 +49,7 @@ EXPECT use strict ; $fred ; EXPECT -Global symbol "$fred" requires explicit package name at - line 4. +Global symbol "$fred" requires explicit package name (did you forget to declare "my $fred"?) at - line 4. Execution of - aborted due to compilation errors. ######## @@ -57,7 +57,7 @@ Execution of - aborted due to compilation errors. use strict 'vars' ; <$fred> ; EXPECT -Global symbol "$fred" requires explicit package name at - line 4. +Global symbol "$fred" requires explicit package name (did you forget to declare "my $fred"?) at - line 4. Execution of - aborted due to compilation errors. ######## @@ -65,7 +65,7 @@ Execution of - aborted due to compilation errors. use strict 'vars' ; local $fred ; EXPECT -Global symbol "$fred" requires explicit package name at - line 4. +Global symbol "$fred" requires explicit package name (did you forget to declare "my $fred"?) at - line 4. Execution of - aborted due to compilation errors. ######## @@ -78,7 +78,7 @@ use strict 'vars' ; $joe = 1 ; EXPECT Variable "$joe" is not imported at - line 8. -Global symbol "$joe" requires explicit package name at - line 8. +Global symbol "$joe" requires explicit package name (did you forget to declare "my $joe"?) at - line 8. Execution of - aborted due to compilation errors. ######## @@ -93,7 +93,7 @@ use open qw( :utf8 :std ); $jòè = 1 ; EXPECT Variable "$jòè" is not imported at - line 10. -Global symbol "$jòè" requires explicit package name at - line 10. +Global symbol "$jòè" requires explicit package name (did you forget to declare "my $jòè"?) at - line 10. Execution of - aborted due to compilation errors. ######## @@ -105,7 +105,7 @@ no strict; } $joe = 1 ; EXPECT -Global symbol "$joe" requires explicit package name at - line 6. +Global symbol "$joe" requires explicit package name (did you forget to declare "my $joe"?) at - line 6. Execution of - aborted due to compilation errors. ######## @@ -138,7 +138,7 @@ $joe = 1 ; require "./abc"; EXPECT Variable "$joe" is not imported at ./abc line 2. -Global symbol "$joe" requires explicit package name at ./abc line 2. +Global symbol "$joe" requires explicit package name (did you forget to declare "my $joe"?) at ./abc line 2. Compilation failed in require at - line 2. ######## @@ -155,7 +155,7 @@ $jòè = 1 ; require "./abc"; EXPECT Variable "$jòè" is not imported at ./abc line 4. -Global symbol "$jòè" requires explicit package name at ./abc line 4. +Global symbol "$jòè" requires explicit package name (did you forget to declare "my $jòè"?) at ./abc line 4. Compilation failed in require at - line 4. ######## @@ -168,7 +168,7 @@ $joe = 1 ; use abc; EXPECT Variable "$joe" is not imported at abc.pm line 2. -Global symbol "$joe" requires explicit package name at abc.pm line 2. +Global symbol "$joe" requires explicit package name (did you forget to declare "my $joe"?) at abc.pm line 2. Compilation failed in require at - line 2. BEGIN failed--compilation aborted at - line 2. ######## @@ -186,7 +186,7 @@ $jòè = 1 ; use abc; EXPECT Variable "$jòè" is not imported at abc.pm line 4. -Global symbol "$jòè" requires explicit package name at abc.pm line 4. +Global symbol "$jòè" requires explicit package name (did you forget to declare "my $jòè"?) at abc.pm line 4. Compilation failed in require at - line 4. BEGIN failed--compilation aborted at - line 4. ######## @@ -203,20 +203,20 @@ $p = 0b12; --FILE-- use abc; EXPECT -Global symbol "$f" requires explicit package name at abc.pm line 3. -Global symbol "$k" requires explicit package name at abc.pm line 3. -Global symbol "$g" requires explicit package name at abc.pm line 4. -Global symbol "$l" requires explicit package name at abc.pm line 4. -Global symbol "$c" requires explicit package name at abc.pm line 5. -Global symbol "$h" requires explicit package name at abc.pm line 5. -Global symbol "$m" requires explicit package name at abc.pm line 5. -Global symbol "$d" requires explicit package name at abc.pm line 6. -Global symbol "$i" requires explicit package name at abc.pm line 6. -Global symbol "$n" requires explicit package name at abc.pm line 6. -Global symbol "$e" requires explicit package name at abc.pm line 7. -Global symbol "$j" requires explicit package name at abc.pm line 7. -Global symbol "$o" requires explicit package name at abc.pm line 7. -Global symbol "$p" requires explicit package name at abc.pm line 8. +Global symbol "$f" requires explicit package name (did you forget to declare "my $f"?) at abc.pm line 3. +Global symbol "$k" requires explicit package name (did you forget to declare "my $k"?) at abc.pm line 3. +Global symbol "$g" requires explicit package name (did you forget to declare "my $g"?) at abc.pm line 4. +Global symbol "$l" requires explicit package name (did you forget to declare "my $l"?) at abc.pm line 4. +Global symbol "$c" requires explicit package name (did you forget to declare "my $c"?) at abc.pm line 5. +Global symbol "$h" requires explicit package name (did you forget to declare "my $h"?) at abc.pm line 5. +Global symbol "$m" requires explicit package name (did you forget to declare "my $m"?) at abc.pm line 5. +Global symbol "$d" requires explicit package name (did you forget to declare "my $d"?) at abc.pm line 6. +Global symbol "$i" requires explicit package name (did you forget to declare "my $i"?) at abc.pm line 6. +Global symbol "$n" requires explicit package name (did you forget to declare "my $n"?) at abc.pm line 6. +Global symbol "$e" requires explicit package name (did you forget to declare "my $e"?) at abc.pm line 7. +Global symbol "$j" requires explicit package name (did you forget to declare "my $j"?) at abc.pm line 7. +Global symbol "$o" requires explicit package name (did you forget to declare "my $o"?) at abc.pm line 7. +Global symbol "$p" requires explicit package name (did you forget to declare "my $p"?) at abc.pm line 8. Illegal binary digit '2' at abc.pm line 8, at end of line abc.pm has too many errors. Compilation failed in require at - line 1. @@ -243,7 +243,7 @@ eval { print STDERR $@; $joe = 1 ; EXPECT -Global symbol "$joe" requires explicit package name at - line 6. +Global symbol "$joe" requires explicit package name (did you forget to declare "my $joe"?) at - line 6. Execution of - aborted due to compilation errors. ######## @@ -255,8 +255,8 @@ eval { print STDERR $@; $joe = 1 ; EXPECT -Global symbol "$joe" requires explicit package name at - line 5. -Global symbol "$joe" requires explicit package name at - line 8. +Global symbol "$joe" requires explicit package name (did you forget to declare "my $joe"?) at - line 5. +Global symbol "$joe" requires explicit package name (did you forget to declare "my $joe"?) at - line 8. Execution of - aborted due to compilation errors. ######## @@ -270,7 +270,7 @@ print STDERR $@; $joe = 1 ; EXPECT Variable "$joe" is not imported at - line 9. -Global symbol "$joe" requires explicit package name at - line 9. +Global symbol "$joe" requires explicit package name (did you forget to declare "my $joe"?) at - line 9. Execution of - aborted due to compilation errors. ######## @@ -286,7 +286,7 @@ print STDERR $@; $jòè = 1 ; EXPECT Variable "$jòè" is not imported at - line 11. -Global symbol "$jòè" requires explicit package name at - line 11. +Global symbol "$jòè" requires explicit package name (did you forget to declare "my $jòè"?) at - line 11. Execution of - aborted due to compilation errors. ######## @@ -307,7 +307,7 @@ eval q[ $joe = 1 ; ]; print STDERR $@; EXPECT -Global symbol "$joe" requires explicit package name at (eval 1) line 3. +Global symbol "$joe" requires explicit package name (did you forget to declare "my $joe"?) at (eval 1) line 3. ######## # Check scope of pragma with eval @@ -316,7 +316,7 @@ eval ' $joe = 1 ; '; print STDERR $@ ; EXPECT -Global symbol "$joe" requires explicit package name at (eval 1) line 2. +Global symbol "$joe" requires explicit package name (did you forget to declare "my $joe"?) at (eval 1) line 2. ######## # Check scope of pragma with eval @@ -327,7 +327,7 @@ eval ' '; print STDERR $@; $joe = 1 ; EXPECT -Global symbol "$joe" requires explicit package name at - line 8. +Global symbol "$joe" requires explicit package name (did you forget to declare "my $joe"?) at - line 8. Execution of - aborted due to compilation errors. ######## @@ -340,9 +340,9 @@ $ret = eval q{ print $x; }; print $@; print "ok 2\n" unless defined $ret; EXPECT -Global symbol "$x" requires explicit package name at (eval 1) line 1. +Global symbol "$x" requires explicit package name (did you forget to declare "my $x"?) at (eval 1) line 1. ok 1 -Global symbol "$x" requires explicit package name at (eval 2) line 1. +Global symbol "$x" requires explicit package name (did you forget to declare "my $x"?) at (eval 2) line 1. ok 2 ######## @@ -399,7 +399,7 @@ sub foo { $fred ; EXPECT Variable "$fred" is not imported at - line 8. -Global symbol "$fred" requires explicit package name at - line 8. +Global symbol "$fred" requires explicit package name (did you forget to declare "my $fred"?) at - line 8. Execution of - aborted due to compilation errors. ######## @@ -414,7 +414,7 @@ sub fòò { $frèd ; EXPECT Variable "$frèd" is not imported at - line 10. -Global symbol "$frèd" requires explicit package name at - line 10. +Global symbol "$frèd" requires explicit package name (did you forget to declare "my $frèd"?) at - line 10. Execution of - aborted due to compilation errors. ######## @@ -502,7 +502,7 @@ use strict 'vars'; no warnings; "@i_like_crackers"; EXPECT -Global symbol "@i_like_crackers" requires explicit package name at - line 7. +Global symbol "@i_like_crackers" requires explicit package name (did you forget to declare "my @i_like_crackers"?) at - line 7. Execution of - aborted due to compilation errors. ######## @@ -510,15 +510,15 @@ Execution of - aborted due to compilation errors. use strict 'vars'; @k = <$k>; EXPECT -Global symbol "@k" requires explicit package name at - line 4. -Global symbol "$k" requires explicit package name at - line 4. +Global symbol "@k" requires explicit package name (did you forget to declare "my @k"?) at - line 4. +Global symbol "$k" requires explicit package name (did you forget to declare "my $k"?) at - line 4. Execution of - aborted due to compilation errors. ######## # [perl #26910] hints not propagated into (?{...}) use strict 'vars'; qr/(?{$foo++})/; EXPECT -Global symbol "$foo" requires explicit package name at - line 3. +Global symbol "$foo" requires explicit package name (did you forget to declare "my $foo"?) at - line 3. Execution of - aborted due to compilation errors. ######## # Regex compilation errors weren't UTF-8 clean. @@ -527,7 +527,7 @@ use utf8; use open qw( :utf8 :std ); qr/(?{$fòò++})/; EXPECT -Global symbol "$fòò" requires explicit package name at - line 5. +Global symbol "$fòò" requires explicit package name (did you forget to declare "my $fòò"?) at - line 5. Execution of - aborted due to compilation errors. ######## # [perl #73712] 'Variable is not imported' should be suppressible diff --git a/gnu/usr.bin/perl/t/lib/universal.t b/gnu/usr.bin/perl/t/lib/universal.t index 19f8f284290..5980cade351 100644 --- a/gnu/usr.bin/perl/t/lib/universal.t +++ b/gnu/usr.bin/perl/t/lib/universal.t @@ -6,7 +6,7 @@ BEGIN { chdir 't' if -d 't'; @INC = '../lib'; require './test.pl'; - plan( tests => 13 ); + plan( tests => 17 ); } for my $arg ('', 'q[]', qw( 1 undef )) { @@ -59,4 +59,17 @@ ok !Internals::SvREADONLY($h{b}), Internals::SvREADONLY($h{b},0); $h{b} =~ y/ia/ao/; is __PACKAGE__, 'main', - 'turning off a cow’s readonliness did not affect sharers of the same PV'; + 'turning off a cow\'s readonliness did not affect sharers of the same PV'; + +&Internals::SvREADONLY(\!0, 0); +eval { ${\!0} = 7 }; +like $@, qr "^Modification of a read-only value", + 'protected values still croak on assignment after SvREADONLY(..., 0)'; +is ${\3} == 3, "1", 'attempt to modify failed'; + +eval { { my $x = ${qr//}; Internals::SvREADONLY $x, 1; () } }; +is $@, "", 'read-only lexical regexps on scope exit [perl #115254]'; + +Internals::SvREADONLY($],0); +eval { $]=7 }; +is $], 7, 'SvREADONLY can make magic vars mutable' diff --git a/gnu/usr.bin/perl/t/lib/warnings/7fatal b/gnu/usr.bin/perl/t/lib/warnings/7fatal index 32d2f19a361..40c649f249a 100644 --- a/gnu/usr.bin/perl/t/lib/warnings/7fatal +++ b/gnu/usr.bin/perl/t/lib/warnings/7fatal @@ -416,18 +416,21 @@ use warnings FATAL => 'all', NONFATAL => 'io'; no warnings 'once'; open(F, "<true\ncd"); +open(G, "<truecd\n"); +open(H, "<truecd\n\0"); close "fred" ; print STDERR "The End.\n" ; EXPECT -Unsuccessful open on filename containing newline at - line 5. -close() on unopened filehandle fred at - line 6. +Unsuccessful open on filename containing newline at - line 6. +Unsuccessful open on filename containing newline at - line 7. +close() on unopened filehandle fred at - line 8. The End. ######## use warnings FATAL => 'all', NONFATAL => 'io', FATAL => 'unopened' ; no warnings 'once'; -open(F, "<true\ncd"); +open(F, "<truecd\n"); close "fred" ; print STDERR "The End.\n" ; EXPECT @@ -532,3 +535,34 @@ print STDERR "The End.\n" ; EXPECT Reversed += operator at - line 10. The End. +######## + +# fatal warnings shouldn't hide parse errors [perl #122966] +use warnings FATAL => 'all'; +if (1 { + my $x = "hello"; + print $x, "\n"; +} +EXPECT +syntax error at - line 4, near "1 {" +"my" variable $x masks earlier declaration in same statement at - line 6. +syntax error at - line 7, near "}" +Execution of - aborted due to compilation errors. +######## + +# fatal warnings in DESTROY should be made non-fatal [perl #123398] +# This test will blow up your memory with SEGV without the patch +package Foo; +use strict; use utf8; use warnings FATAL => 'all'; +sub new { + return bless{ 'field' => undef }, 'Foo'; +} +sub DESTROY { + my $self = shift; + $self->{'field'}->missing_method; +} +package main; +my $foo = new Foo; +undef($foo); +EXPECT + (in cleanup) Can't call method "missing_method" on an undefined value at - line 11. diff --git a/gnu/usr.bin/perl/t/lib/warnings/9uninit b/gnu/usr.bin/perl/t/lib/warnings/9uninit index d9e5b9bed73..ef9b4f6d178 100644 --- a/gnu/usr.bin/perl/t/lib/warnings/9uninit +++ b/gnu/usr.bin/perl/t/lib/warnings/9uninit @@ -786,17 +786,6 @@ s/$m1/$g1/; undef $_; tr/x/y/; undef $_; tr/x/y/r; undef $_; -my $_; -/y/; -/$m1/; -/$g1/; -s/y/z/; undef $_; -s/$m1/z/; undef $_; -s//$g1/; undef $_; -s/$m1/$g1/; undef $_; -tr/x/y/; undef $_; -tr/x/y/r; undef $_; - $g2 =~ /y/; $g2 =~ /$m1/; $g2 =~ /$g1/; @@ -818,8 +807,10 @@ $foo =~ s/./$m1/e; undef $g1; $m1 = '$g1'; $foo =~ s//$m1/ee; +undef $m1; +$m1 =~ tr/x/y/; undef $m1; +$m1 =~ tr/x/y/r; EXPECT -Use of my $_ is experimental at - line 16. Use of uninitialized value $_ in pattern match (m//) at - line 5. Use of uninitialized value $m1 in regexp compilation at - line 6. Use of uninitialized value $_ in pattern match (m//) at - line 6. @@ -838,50 +829,34 @@ Use of uninitialized value $_ in substitution (s///) at - line 12. Use of uninitialized value $g1 in substitution iterator at - line 12. Use of uninitialized value $_ in transliteration (tr///) at - line 13. Use of uninitialized value $_ in transliteration (tr///) at - line 14. -Use of uninitialized value $_ in pattern match (m//) at - line 17. -Use of uninitialized value $m1 in regexp compilation at - line 18. -Use of uninitialized value $_ in pattern match (m//) at - line 18. -Use of uninitialized value $g1 in regexp compilation at - line 19. -Use of uninitialized value $_ in pattern match (m//) at - line 19. -Use of uninitialized value $_ in substitution (s///) at - line 20. -Use of uninitialized value $m1 in regexp compilation at - line 21. -Use of uninitialized value $_ in substitution (s///) at - line 21. -Use of uninitialized value $_ in substitution (s///) at - line 21. -Use of uninitialized value $_ in substitution (s///) at - line 22. -Use of uninitialized value $_ in substitution (s///) at - line 22. +Use of uninitialized value $g2 in pattern match (m//) at - line 16. +Use of uninitialized value $m1 in regexp compilation at - line 17. +Use of uninitialized value $g2 in pattern match (m//) at - line 17. +Use of uninitialized value $g1 in regexp compilation at - line 18. +Use of uninitialized value $g2 in pattern match (m//) at - line 18. +Use of uninitialized value $g2 in substitution (s///) at - line 19. +Use of uninitialized value $m1 in regexp compilation at - line 20. +Use of uninitialized value $g2 in substitution (s///) at - line 20. +Use of uninitialized value $g2 in substitution (s///) at - line 20. +Use of uninitialized value $g2 in substitution (s///) at - line 21. +Use of uninitialized value $g2 in substitution (s///) at - line 21. +Use of uninitialized value $g1 in substitution iterator at - line 21. +Use of uninitialized value $m1 in regexp compilation at - line 22. +Use of uninitialized value $g2 in substitution (s///) at - line 22. +Use of uninitialized value $g2 in substitution (s///) at - line 22. Use of uninitialized value $g1 in substitution iterator at - line 22. -Use of uninitialized value $m1 in regexp compilation at - line 23. -Use of uninitialized value $_ in substitution (s///) at - line 23. -Use of uninitialized value $_ in substitution (s///) at - line 23. -Use of uninitialized value $g1 in substitution iterator at - line 23. -Use of uninitialized value $_ in transliteration (tr///) at - line 24. -Use of uninitialized value $_ in transliteration (tr///) at - line 25. -Use of uninitialized value $g2 in pattern match (m//) at - line 27. -Use of uninitialized value $m1 in regexp compilation at - line 28. -Use of uninitialized value $g2 in pattern match (m//) at - line 28. -Use of uninitialized value $g1 in regexp compilation at - line 29. -Use of uninitialized value $g2 in pattern match (m//) at - line 29. -Use of uninitialized value $g2 in substitution (s///) at - line 30. -Use of uninitialized value $m1 in regexp compilation at - line 31. -Use of uninitialized value $g2 in substitution (s///) at - line 31. -Use of uninitialized value $g2 in substitution (s///) at - line 31. -Use of uninitialized value $g2 in substitution (s///) at - line 32. -Use of uninitialized value $g2 in substitution (s///) at - line 32. +Use of uninitialized value in transliteration (tr///) at - line 23. +Use of uninitialized value in transliteration (tr///) at - line 24. +Use of uninitialized value $m1 in regexp compilation at - line 27. +Use of uninitialized value $g1 in regexp compilation at - line 28. +Use of uninitialized value $m1 in regexp compilation at - line 30. +Use of uninitialized value $g1 in substitution iterator at - line 31. +Use of uninitialized value $m1 in regexp compilation at - line 32. Use of uninitialized value $g1 in substitution iterator at - line 32. -Use of uninitialized value $m1 in regexp compilation at - line 33. -Use of uninitialized value $g2 in substitution (s///) at - line 33. -Use of uninitialized value $g2 in substitution (s///) at - line 33. -Use of uninitialized value $g1 in substitution iterator at - line 33. -Use of uninitialized value in transliteration (tr///) at - line 34. -Use of uninitialized value in transliteration (tr///) at - line 35. -Use of uninitialized value $m1 in regexp compilation at - line 38. -Use of uninitialized value $g1 in regexp compilation at - line 39. -Use of uninitialized value $m1 in regexp compilation at - line 41. -Use of uninitialized value $g1 in substitution iterator at - line 42. -Use of uninitialized value $m1 in regexp compilation at - line 43. -Use of uninitialized value $g1 in substitution iterator at - line 43. -Use of uninitialized value $m1 in substitution (s///) at - line 44. -Use of uninitialized value in substitution iterator at - line 47. +Use of uninitialized value $m1 in substitution (s///) at - line 33. +Use of uninitialized value in substitution iterator at - line 36. +Use of uninitialized value $m1 in transliteration (tr///) at - line 38. +Use of uninitialized value $m1 in transliteration (tr///) at - line 39. ######## use warnings 'uninitialized'; my ($m1); @@ -1126,7 +1101,6 @@ Use of uninitialized value $m1 in regexp compilation at - line 8. Use of uninitialized value $g1 in split at - line 8. Use of uninitialized value $m2 in split at - line 8. Use of uninitialized value $m1 in join or string at - line 10. -Use of uninitialized value $m1 in join or string at - line 11. Use of uninitialized value $m2 in join or string at - line 11. Use of uninitialized value $m1 in join or string at - line 12. Use of uninitialized value $m2 in join or string at - line 12. @@ -2087,3 +2061,80 @@ tie $t, ""; $v = 1.1 * $t; # sv_2nv on a tied regexp EXPECT +######## +# multi-level uninitialised array/hash indexes +use warnings 'uninitialized'; + +our ($i0, $i2, $i4, $i6, $i8, $i10, $i12); +my ($i1, $i3, $i5, $i7, $i9, $i11, $i13); + +my (@a,%h); +my $v; + + +# use enough depth that OP_MULTIDEREF needs more than one action word + +$v = $a[$i0]{$i1}[$i2]{$i3}[$i4]{$i5}[$i6]{$i7}[$i8]{$i9}[$i10]{$i11}[$i12]{$i13}; +$v = $h{$i0}[$i1]{$i2}[$i3]{$i4}[$i5]{$i6}[$i7]{$i8}[$i9]{$i10}[$i11]{$i12}[$i13]; + +EXPECT +Use of uninitialized value $i0 in array element at - line 13. +Use of uninitialized value $i1 in hash element at - line 13. +Use of uninitialized value $i2 in array element at - line 13. +Use of uninitialized value $i3 in hash element at - line 13. +Use of uninitialized value $i4 in array element at - line 13. +Use of uninitialized value $i5 in hash element at - line 13. +Use of uninitialized value $i6 in array element at - line 13. +Use of uninitialized value $i7 in hash element at - line 13. +Use of uninitialized value $i8 in array element at - line 13. +Use of uninitialized value $i9 in hash element at - line 13. +Use of uninitialized value $i10 in array element at - line 13. +Use of uninitialized value $i11 in hash element at - line 13. +Use of uninitialized value $i12 in array element at - line 13. +Use of uninitialized value $i13 in hash element at - line 13. +Use of uninitialized value $i0 in hash element at - line 14. +Use of uninitialized value $i1 in array element at - line 14. +Use of uninitialized value $i2 in hash element at - line 14. +Use of uninitialized value $i3 in array element at - line 14. +Use of uninitialized value $i4 in hash element at - line 14. +Use of uninitialized value $i5 in array element at - line 14. +Use of uninitialized value $i6 in hash element at - line 14. +Use of uninitialized value $i7 in array element at - line 14. +Use of uninitialized value $i8 in hash element at - line 14. +Use of uninitialized value $i9 in array element at - line 14. +Use of uninitialized value $i10 in hash element at - line 14. +Use of uninitialized value $i11 in array element at - line 14. +Use of uninitialized value $i12 in hash element at - line 14. +Use of uninitialized value $i13 in array element at - line 14. +######## +# misc multideref +use warnings 'uninitialized'; +my ($i,$j,$k); +my @a; +my @ra = \@a; +my $v; +$v = exists $a[$i]{$k}; +$v = delete $a[$i]{$k}; +$v = local $a[$i]{$k}; +delete $a[$i]{$k}; +$v = $ra->[$i+$j]{$k}; +$v = ($ra//0)->[$i]{$k}; +$v = $a[length $i]{$k} +EXPECT +Use of uninitialized value $i in array element at - line 7. +Use of uninitialized value $k in exists at - line 7. +Use of uninitialized value $i in array element at - line 8. +Use of uninitialized value $k in delete at - line 8. +Use of uninitialized value $i in array element at - line 9. +Use of uninitialized value $k in hash element at - line 9. +Use of uninitialized value $k in hash element at - line 9. +Use of uninitialized value $k in hash element at - line 9. +Use of uninitialized value $i in array element at - line 10. +Use of uninitialized value $k in delete at - line 10. +Use of uninitialized value $j in addition (+) at - line 11. +Use of uninitialized value $i in addition (+) at - line 11. +Use of uninitialized value $k in hash element at - line 11. +Use of uninitialized value $i in array element at - line 12. +Use of uninitialized value $k in hash element at - line 12. +Use of uninitialized value $i in array element at - line 13. +Use of uninitialized value $k in hash element at - line 13. diff --git a/gnu/usr.bin/perl/t/lib/warnings/doio b/gnu/usr.bin/perl/t/lib/warnings/doio index 63250e156c0..baa6b970069 100644 --- a/gnu/usr.bin/perl/t/lib/warnings/doio +++ b/gnu/usr.bin/perl/t/lib/warnings/doio @@ -87,10 +87,15 @@ Missing command in piped open at - line 3. # doio.c [Perl_do_open9] use warnings 'io' ; open(F, "<true\ncd"); +open(G, "<truecd\n"); +open(H, "<truecd\n\0"); no warnings 'io' ; -open(G, "<true\ncd"); +open(H, "<true\ncd"); +open(I, "<truecd\n"); +open(I, "<truecd\n\0"); EXPECT -Unsuccessful open on filename containing newline at - line 3. +Unsuccessful open on filename containing newline at - line 4. +Unsuccessful open on filename containing newline at - line 5. ######## # doio.c [Perl_do_close] <<TODO use warnings 'unopened' ; @@ -149,12 +154,22 @@ Use of uninitialized value $a in print at - line 3. use warnings 'io' ; stat "ab\ncd"; lstat "ab\ncd"; +stat "abcd\n"; +lstat "abcd\n"; +stat "abcd\n\0"; +lstat "abcd\n\0"; no warnings 'io' ; stat "ab\ncd"; lstat "ab\ncd"; +stat "abcd\n"; +lstat "abcd\n"; +stat "abcd\n\0"; +lstat "abcd\n\0"; EXPECT -Unsuccessful stat on filename containing newline at - line 3. -Unsuccessful stat on filename containing newline at - line 4. +Unsuccessful stat on filename containing newline at - line 5. +Unsuccessful stat on filename containing newline at - line 6. +Unsuccessful stat on filename containing newline at - line 7. +Unsuccessful stat on filename containing newline at - line 8. ######## # doio.c [Perl_my_stat] use warnings 'io'; diff --git a/gnu/usr.bin/perl/t/lib/warnings/doop b/gnu/usr.bin/perl/t/lib/warnings/doop index 74c3e907fea..bcc85a365af 100644 --- a/gnu/usr.bin/perl/t/lib/warnings/doop +++ b/gnu/usr.bin/perl/t/lib/warnings/doop @@ -5,3 +5,33 @@ $_ = "\x80 \xff" ; chop ; EXPECT ######## +# NAME deprecation of logical bit operations with above ff code points +$_ = "\xFF" & "\x{100}"; # Above ff second +$_ = "\xFF" | "\x{101}"; +$_ = "\xFF" ^ "\x{102}"; +$_ = "\x{100}" & "\x{FF}"; # Above ff first +$_ = "\x{101}" | "\x{FF}"; +$_ = "\x{102}" ^ "\x{FF}"; +$_ = "\x{100}" & "\x{103}"; # both above ff has just one message raised +$_ = "\x{101}" | "\x{104}"; +$_ = "\x{102}" ^ "\x{105}"; +no warnings 'deprecated'; +$_ = "\xFF" & "\x{100}"; +$_ = "\xFF" | "\x{101}"; +$_ = "\xFF" ^ "\x{101}"; +$_ = "\x{100}" & "\x{FF}"; +$_ = "\x{101}" | "\x{FF}"; +$_ = "\x{102}" ^ "\x{FF}"; +$_ = "\x{100}" & "\x{103}"; +$_ = "\x{101}" | "\x{104}"; +$_ = "\x{102}" ^ "\x{105}"; +EXPECT +Use of strings with code points over 0xFF as arguments to bitwise and (&) operator is deprecated at - line 1. +Use of strings with code points over 0xFF as arguments to bitwise or (|) operator is deprecated at - line 2. +Use of strings with code points over 0xFF as arguments to bitwise xor (^) operator is deprecated at - line 3. +Use of strings with code points over 0xFF as arguments to bitwise and (&) operator is deprecated at - line 4. +Use of strings with code points over 0xFF as arguments to bitwise or (|) operator is deprecated at - line 5. +Use of strings with code points over 0xFF as arguments to bitwise xor (^) operator is deprecated at - line 6. +Use of strings with code points over 0xFF as arguments to bitwise and (&) operator is deprecated at - line 7. +Use of strings with code points over 0xFF as arguments to bitwise or (|) operator is deprecated at - line 8. +Use of strings with code points over 0xFF as arguments to bitwise xor (^) operator is deprecated at - line 9. diff --git a/gnu/usr.bin/perl/t/lib/warnings/irs b/gnu/usr.bin/perl/t/lib/warnings/irs deleted file mode 100644 index 9e1d3dea09a..00000000000 --- a/gnu/usr.bin/perl/t/lib/warnings/irs +++ /dev/null @@ -1,14 +0,0 @@ -Test warnings related to $/ -__END__ --w -# warnable code, warnings enabled via command line switch -$/ = \0; -EXPECT -Setting $/ to a reference to zero as a form of slurp is deprecated, treating as undef at - line 3. -######## --w -# warnable code, warnings enabled via command line switch -$/ = \-1; -EXPECT -Setting $/ to a reference to a negative integer as a form of slurp is deprecated, treating as undef at - line 3. - diff --git a/gnu/usr.bin/perl/t/lib/warnings/mg b/gnu/usr.bin/perl/t/lib/warnings/mg index 9e3652b71e1..6bd6c3a912f 100644 --- a/gnu/usr.bin/perl/t/lib/warnings/mg +++ b/gnu/usr.bin/perl/t/lib/warnings/mg @@ -3,13 +3,11 @@ No such signal: SIG%s $SIG{FRED} = sub {} + Setting $/ to a reference to zero as a form of slurp is deprecated, treating as undef + SIG%s handler \"%s\" not defined. $SIG{"INT"} = "ok3"; kill "INT",$$; - Mandatory Warnings TODO - ------------------ - Can't break at that line [magic_setdbline] - __END__ # mg.c use warnings 'signal' ; @@ -23,6 +21,24 @@ $SIG{FRED} = sub {}; EXPECT ######## +-w +# warnable code, warnings enabled via command line switch +$/ = \0; +EXPECT +Setting $/ to a reference to zero as a form of slurp is deprecated, treating as undef at - line 3. +######## +-w +# warnable code, warnings enabled via command line switch +$/ = \-1; +EXPECT +Setting $/ to a reference to a negative integer as a form of slurp is deprecated, treating as undef at - line 3. +######## +$/ = \-1; +no warnings 'deprecated'; +$/ = \-1; +EXPECT +Setting $/ to a reference to a negative integer as a form of slurp is deprecated, treating as undef at - line 1. +######## # mg.c use warnings 'signal' ; if ($^O eq 'MSWin32' || $^O eq 'NetWare' || $^O eq 'VMS') { @@ -44,6 +60,29 @@ EXPECT ######## # mg.c +use warnings 'signal' ; +if ($^O eq 'MSWin32' || $^O eq 'NetWare' || $^O eq 'VMS') { + print "SKIPPED\n# $^O, can't kill() to raise()\n"; exit; +} +$|=1; +$SIG{__WARN__} = sub { warn shift =~ s/\0/\\0/rugs }; +$SIG{"INT"} = "fr\0d"; kill "INT",$$; +EXPECT +SIGINT handler "fr\0d" not defined. +######## +# mg.c +use warnings 'signal' ; +use open ":std", ":utf8"; +use utf8; +if ($^O eq 'MSWin32' || $^O eq 'NetWare' || $^O eq 'VMS') { + print "SKIPPED\n# $^O, can't kill() to raise()\n"; exit; +} +$|=1; +$SIG{"INT"} = "프레드"; kill "INT",$$; +EXPECT +SIGINT handler "프레드" not defined. +######## +# mg.c use warnings 'uninitialized'; 'foo' =~ /(foo)/; oct $3; @@ -60,3 +99,16 @@ Use of uninitialized value $3 in oct at - line 3. use warnings 'uninitialized'; $ENV{FOO} = undef; # should not warn EXPECT +######## +${^ENCODING} = 42; +{ local ${^ENCODING}; } +${^ENCODING} = undef; +{ local ${^ENCODING} = 37; } +no warnings 'deprecated'; +${^ENCODING} = 42; +{ local ${^ENCODING}; } +${^ENCODING} = undef; +{ local ${^ENCODING} = 37; } +EXPECT +Setting ${^ENCODING} is deprecated at - line 1. +Setting ${^ENCODING} is deprecated at - line 4. diff --git a/gnu/usr.bin/perl/t/lib/warnings/op b/gnu/usr.bin/perl/t/lib/warnings/op index bca28186a2f..528639e5a9a 100644 --- a/gnu/usr.bin/perl/t/lib/warnings/op +++ b/gnu/usr.bin/perl/t/lib/warnings/op @@ -1,8 +1,5 @@ op.c AOK - Use of my $_ is experimental - my $_ ; - Found = in conditional, should be == 1 if $a = 1 ; @@ -61,39 +58,21 @@ format FRED = . - Array @%s missing the @ in argument %d of %s() - push fred ; - - push on reference is experimental [ck_fun] - pop on reference is experimental - shift on reference is experimental - unshift on reference is experimental - splice on reference is experimental - - Hash %%%s missing the %% in argument %d of %s() - keys joe ; - Statement unlikely to be reached (Maybe you meant system() when you said exec()? exec "true" ; my $a - defined(@array) is deprecated - (Maybe you should just omit the defined()?) + Can't use defined(@array) (Maybe you should just omit the defined()?) my @a ; defined @a ; defined (@a = (1,2,3)) ; - defined(%hash) is deprecated - (Maybe you should just omit the defined()?) + Can't use defined(%hash) (Maybe you should just omit the defined()?) my %h ; defined %h ; "my %s" used in sort comparison $[ used in comparison (did you mean $] ?) - each on reference is experimental [ck_each] - keys on reference is experimental - values on reference is experimental - length() used on @array (did you mean "scalar(@array)"?) length() used on %hash (did you mean "scalar(keys %hash)"?) @@ -108,6 +87,8 @@ Use of /g modifier is meaningless in split + The bitwise feature is experimental [Perl_ck_bitop] + Possible precedence problem on bitwise %c operator [Perl_ck_bitop] Mandatory Warnings @@ -121,17 +102,6 @@ __END__ # op.c -use warnings 'experimental::lexical_topic' ; -my $_; -CORE::state $_; -no warnings 'experimental::lexical_topic' ; -my $_; -CORE::state $_; -EXPECT -Use of my $_ is experimental at - line 3. -Use of state $_ is experimental at - line 4. -######## -# op.c use warnings 'syntax' ; 1 if $a = 1 ; 1 if $a @@ -153,6 +123,17 @@ no warnings 'syntax' ; EXPECT ######## # op.c +# NAME unless with assignment as condition +use warnings 'syntax'; +1 unless $a = 1; +unless ($a = 1) { + 1; +} +EXPECT +Found = in conditional, should be == at - line 3. +Found = in conditional, should be == at - line 4. +######## +# op.c use warnings 'syntax' ; @a[3]; @a{3}; @@ -235,12 +216,6 @@ my @s = @f{"]", "a"}; @h{m ""}; use constant phoo => 1..3; @h{+phoo}; # rv2av -{ - no warnings 'deprecated'; - @h{each H}; - @h{values H}; - @h{keys H}; -} @h{sort foo}; @h{reverse foo}; @h{caller 0}; @@ -252,12 +227,6 @@ use constant phoo => 1..3; @h{localtime 0}; @h{gmtime 0}; @h{eval ""}; -{ - no warnings 'experimental::autoderef'; - @h{each $foo} if 0; - @h{keys $foo} if 0; - @h{values $foo} if 0; -} # arrays @h[qw"a b c"] = 1..3; @@ -284,12 +253,6 @@ my @s = @f["]", "a"]; @h[m ""]; use constant phoo => 1..3; @h[+phoo]; # rv2av -{ - no warnings 'deprecated'; - @h[each H]; - @h[values H]; - @h[keys H]; -} @h[sort foo]; @h[reverse foo]; @h[caller 0]; @@ -301,12 +264,6 @@ use constant phoo => 1..3; @h[localtime 0]; @h[gmtime 0]; @h[eval ""]; -{ - no warnings 'experimental::autoderef'; - @h[each $foo] if 0; - @h[keys $foo] if 0; - @h[values $foo] if 0; -} EXPECT ######## # op.c @@ -318,33 +275,60 @@ syntax error at - line 4, near "[]" Execution of - aborted due to compilation errors. ######## # op.c -my (@foo, %foo); -%main::foo->{"bar"}; -%foo->{"bar"}; -@main::foo->[23]; -@foo->[23]; -$main::foo = {}; %$main::foo->{"bar"}; -$foo = {}; %$foo->{"bar"}; -$main::foo = []; @$main::foo->[34]; -$foo = []; @$foo->[34]; -no warnings 'deprecated'; +my %foo; %main::foo->{"bar"}; +EXPECT +OPTION fatal +Can't use a hash as a reference at - line 3. +######## +# op.c +my %foo; %foo->{"bar"}; +EXPECT +OPTION fatal +Can't use a hash as a reference at - line 3. +######## +# op.c +my @foo; @main::foo->[23]; +EXPECT +OPTION fatal +Can't use an array as a reference at - line 3. +######## +# op.c +my @foo; @foo->[23]; +EXPECT +OPTION fatal +Can't use an array as a reference at - line 3. +######## +# op.c +my %foo; $main::foo = {}; %$main::foo->{"bar"}; +EXPECT +OPTION fatal +Can't use a hash as a reference at - line 3. +######## +# op.c +my %foo; $foo = {}; %$foo->{"bar"}; +EXPECT +OPTION fatal +Can't use a hash as a reference at - line 3. +######## +# op.c +my @foo; $main::foo = []; @$main::foo->[34]; +EXPECT +OPTION fatal +Can't use an array as a reference at - line 3. +######## +# op.c +my @foo; $foo = []; @$foo->[34]; EXPECT -Using a hash as a reference is deprecated at - line 3. -Using a hash as a reference is deprecated at - line 4. -Using an array as a reference is deprecated at - line 5. -Using an array as a reference is deprecated at - line 6. -Using a hash as a reference is deprecated at - line 7. -Using a hash as a reference is deprecated at - line 8. -Using an array as a reference is deprecated at - line 9. -Using an array as a reference is deprecated at - line 10. +OPTION fatal +Can't use an array as a reference at - line 3. ######## # op.c use warnings 'void' ; no warnings 'experimental::smartmatch'; close STDIN ; @@ -360,7 +344,7 @@ wantarray ; # OP_WANTARRAY # OP_PADANY # OP_AV2ARYLEN ref ; # OP_REF -\@a ; # OP_REFGEN +\(@a) ; # OP_REFGEN \$a ; # OP_SREFGEN defined $a ; # OP_DEFINED hex $a ; # OP_HEX @@ -380,7 +364,7 @@ $a{0} ; # OP_HELEM @a{0} ; # OP_HSLICE unpack "a", "a" ; # OP_UNPACK pack $a,"" ; # OP_PACK -join "" ; # OP_JOIN +join "", @_ ; # OP_JOIN (@a)[0,1] ; # OP_LSLICE # OP_ANONLIST # OP_ANONHASH @@ -408,7 +392,9 @@ $a <=> $b; # OP_NCMP "diatrewq"; "igatrewq"; use 5.015; -__SUB__ # OP_RUNCV +__SUB__ ; # OP_RUNCV +[]; # OP_ANONLIST +grep /42/, (1,2); # OP_GREP. Not warned about (yet). Grep git logs for void_unusual to see why... EXPECT Useless use of a constant ("111") in void context at - line 2. Useless use of repeat (x) in void context at - line 3. @@ -455,6 +441,7 @@ Useless use of a constant ("dsatrewq") in void context at - line 57. Useless use of a constant ("diatrewq") in void context at - line 58. Useless use of a constant ("igatrewq") in void context at - line 59. Useless use of __SUB__ in void context at - line 61. +Useless use of anonymous array ([]) in void context at - line 62. ######## # op.c use warnings 'void' ; close STDIN ; @@ -752,10 +739,23 @@ Useless use of a constant (undef) in void context at - line 8. Useless use of a constant ("\"\t\n") in void context at - line 9. ######## # op.c +BEGIN { + if (ord('A') == 193) { + print "SKIPPED\n# Result varies depending on EBCDIC code page"; + exit 0; + } +} use utf8; use open qw( :utf8 :std ); use warnings 'void' ; "àḆc"; # OP_CONST +EXPECT +Useless use of a constant ("\340\x{1e06}c") in void context at - line 11. +######## +# op.c +use utf8; +use open qw( :utf8 :std ); +use warnings 'void' ; "Ẋ" . "ƴ"; # optimized to OP_CONST FOO; # Bareword optimized to OP_CONST use constant ů => undef; @@ -766,14 +766,13 @@ no warnings 'void' ; "àḆc"; # OP_CONST "Ẋ" . "ƴ"; # optimized to OP_CONST EXPECT -Useless use of a constant ("\340\x{1e06}c") in void context at - line 5. -Useless use of a constant ("\x{1e8a}\x{1b4}") in void context at - line 6. -Useless use of a constant ("\x{ff26}\x{ff2f}\x{ff2f}") in void context at - line 7. -Useless use of a constant (undef) in void context at - line 9. +Useless use of a constant ("\x{1e8a}\x{1b4}") in void context at - line 5. +Useless use of a constant ("\x{ff26}\x{ff2f}\x{ff2f}") in void context at - line 6. +Useless use of a constant (undef) in void context at - line 8. ######## # op.c # -use warnings 'misc' ; +use warnings 'misc' ; use utf8; my $a ; my @a = () ; my %a = () ; my $b = \@a ; my $c = \%a ;my $d = 'test'; @a =~ /abc/ ; @a2 =~ s/a/b/ ; @@ -790,6 +789,8 @@ my $a ; my @a = () ; my %a = () ; my $b = \@a ; my $c = \%a ;my $d = 'test'; $d =~ tr/a/b/d ; $d2 =~ tr/a/bc/; $d3 =~ tr//b/c; +$d =~ tr/α/β/d ; +$d2 =~ tr/α/βγ/; { no warnings 'misc' ; my $a ; my @a = () ; my %a = () ; my $b = \@a ; my $c = \%a ; my $d = 'test'; @@ -824,14 +825,17 @@ Applying substitution (s///) to %hash will act on scalar(%hash) at - line 15. Applying transliteration (tr///) to %hash will act on scalar(%hash) at - line 16. Useless use of /d modifier in transliteration operator at - line 17. Replacement list is longer than search list at - line 18. +Useless use of /d modifier in transliteration operator at - line 20. +Replacement list is longer than search list at - line 21. Can't modify array dereference in substitution (s///) at - line 6, near "s/a/b/ ;" -BEGIN not safe after errors--compilation aborted at - line 21. +BEGIN not safe after errors--compilation aborted at - line 23. ######## # op.c use warnings 'parenthesis' ; my $a, $b = (1,2); my @foo,%bar, $quux; # there's a TAB here my $x, $y or print; +my $p, *q; no warnings 'parenthesis' ; my $c, $d = (1,2); EXPECT @@ -841,6 +845,7 @@ Parentheses missing around "my" list at - line 4. # op.c use warnings 'parenthesis' ; our $a, $b = (1,2); +our $p, *q; no warnings 'parenthesis' ; our $c, $d = (1,2); EXPECT @@ -850,11 +855,13 @@ Parentheses missing around "our" list at - line 3. use warnings 'parenthesis' ; local $a, $b = (1,2); local *f, *g; +local $p, *q; no warnings 'parenthesis' ; local $c, $d = (1,2); EXPECT Parentheses missing around "local" list at - line 3. Parentheses missing around "local" list at - line 4. +Parentheses missing around "local" list at - line 5. ######## # op.c use warnings 'bareword' ; @@ -1026,40 +1033,6 @@ EXPECT Format FRED redefined at - line 5. ######## # op.c -push FRED; -no warnings 'deprecated' ; -push FRED; -EXPECT -Array @FRED missing the @ in argument 1 of push() at - line 2. -######## -# op.c [Perl_ck_fun] -$fred = []; -push $fred; -pop $fred; -shift $fred; -unshift $fred; -splice $fred; -no warnings 'experimental::autoderef' ; -push $fred; -pop $fred; -shift $fred; -unshift $fred; -splice $fred; -EXPECT -push on reference is experimental at - line 3. -pop on reference is experimental at - line 4. -shift on reference is experimental at - line 5. -unshift on reference is experimental at - line 6. -splice on reference is experimental at - line 7. -######## -# op.c -@a = keys FRED ; -no warnings 'deprecated' ; -@a = keys FRED ; -EXPECT -Hash %FRED missing the % in argument 1 of keys() at - line 2. -######## -# op.c use warnings 'exec' ; exec "$^X -e 1" ; my $a @@ -1076,32 +1049,30 @@ EXPECT # op.c defined(@a); EXPECT -defined(@array) is deprecated at - line 2. - (Maybe you should just omit the defined()?) +OPTION fatal +Can't use 'defined(@array)' (Maybe you should just omit the defined()?) at - line 2. ######## # op.c my @a; defined(@a); EXPECT -defined(@array) is deprecated at - line 2. - (Maybe you should just omit the defined()?) +OPTION fatal +Can't use 'defined(@array)' (Maybe you should just omit the defined()?) at - line 2. ######## # op.c defined(@a = (1,2,3)); EXPECT -defined(@array) is deprecated at - line 2. - (Maybe you should just omit the defined()?) ######## # op.c defined(%h); EXPECT -defined(%hash) is deprecated at - line 2. - (Maybe you should just omit the defined()?) +OPTION fatal +Can't use 'defined(%hash)' (Maybe you should just omit the defined()?) at - line 2. ######## # op.c my %h; defined(%h); EXPECT -defined(%hash) is deprecated at - line 2. - (Maybe you should just omit the defined()?) +OPTION fatal +Can't use 'defined(%hash)' (Maybe you should just omit the defined()?) at - line 2. ######## # op.c no warnings 'exec' ; @@ -1148,6 +1119,12 @@ Prototype after '@' for main::foo : @\0 at (eval 1) line 1. Illegal character in prototype for main::foo : @\0 at (eval 1) line 1. ######## # op.c +BEGIN { + if (ord('A') == 193) { + print "SKIPPED\n# Different results on EBCDIC"; + exit 0; + } +} use utf8; use open qw( :utf8 :std ); use warnings; @@ -1376,20 +1353,6 @@ $[ used in numeric gt (>) (did you mean $] ?) at - line 18. $[ used in numeric le (<=) (did you mean $] ?) at - line 19. $[ used in numeric ge (>=) (did you mean $] ?) at - line 20. ######## -# op.c [Perl_ck_each] -$fred = {}; -keys $fred; -values $fred; -each $fred; -no warnings 'experimental::autoderef' ; -keys $fred; -values $fred; -each $fred; -EXPECT -keys on reference is experimental at - line 3. -values on reference is experimental at - line 4. -each on reference is experimental at - line 5. -######## # op.c [Perl_ck_length] use warnings 'syntax' ; length(@a); @@ -1503,6 +1466,81 @@ split /blah/g, "blah"; EXPECT Use of /g modifier is meaningless in split at - line 4. ######## +use feature "bitwise"; +$_ = $_ | $_; +$_ = $_ & $_; +$_ = $_ ^ $_; +$_ = ~$_; +$_ = $_ |. $_; +$_ = $_ &. $_; +$_ = $_ ^. $_; +$_ = ~.$_; +$_ |= $_; +$_ &= $_; +$_ ^= $_; +$_ |.= $_; +$_ &.= $_; +$_ ^.= $_; +use warnings "experimental::bitwise"; +$_ = $_ | $_; +$_ = $_ & $_; +$_ = $_ ^ $_; +$_ = ~$_; +$_ = $_ |. $_; +$_ = $_ &. $_; +$_ = $_ ^. $_; +$_ = ~.$_; +$_ |= $_; +$_ &= $_; +$_ ^= $_; +$_ |.= $_; +$_ &.= $_; +$_ ^.= $_; +no warnings "experimental::bitwise"; +$_ = $_ | $_; +$_ = $_ & $_; +$_ = $_ ^ $_; +$_ = ~$_; +$_ = $_ |. $_; +$_ = $_ &. $_; +$_ = $_ ^. $_; +$_ = ~.$_; +$_ |= $_; +$_ &= $_; +$_ ^= $_; +$_ |.= $_; +$_ &.= $_; +$_ ^.= $_; +EXPECT +The bitwise feature is experimental at - line 2. +The bitwise feature is experimental at - line 3. +The bitwise feature is experimental at - line 4. +The bitwise feature is experimental at - line 5. +The bitwise feature is experimental at - line 6. +The bitwise feature is experimental at - line 7. +The bitwise feature is experimental at - line 8. +The bitwise feature is experimental at - line 9. +The bitwise feature is experimental at - line 10. +The bitwise feature is experimental at - line 11. +The bitwise feature is experimental at - line 12. +The bitwise feature is experimental at - line 13. +The bitwise feature is experimental at - line 14. +The bitwise feature is experimental at - line 15. +The bitwise feature is experimental at - line 17. +The bitwise feature is experimental at - line 18. +The bitwise feature is experimental at - line 19. +The bitwise feature is experimental at - line 20. +The bitwise feature is experimental at - line 21. +The bitwise feature is experimental at - line 22. +The bitwise feature is experimental at - line 23. +The bitwise feature is experimental at - line 24. +The bitwise feature is experimental at - line 25. +The bitwise feature is experimental at - line 26. +The bitwise feature is experimental at - line 27. +The bitwise feature is experimental at - line 28. +The bitwise feature is experimental at - line 29. +The bitwise feature is experimental at - line 30. +######## # op.c use warnings 'precedence'; $a = $b & $c == $d; @@ -1513,6 +1551,25 @@ $a = $b >= $c ^ $d; $a = $b <= $c | $d; $a = $b <=> $c & $d; $a &= $b == $c; $a |= $b == $c; $a ^= $b == $c; # shouldn't warn +{ + use experimental 'bitwise'; + $a = $b & $c == $d; + $a = $b ^ $c != $d; + $a = $b | $c > $d; + $a = $b < $c & $d; + $a = $b >= $c ^ $d; + $a = $b <= $c | $d; + $a = $b <=> $c & $d; + $a &= $b == $c; $a |= $b == $c; $a ^= $b == $c; # shouldn't warn + $a = $b &. $c == $d; + $a = $b ^. $c != $d; + $a = $b |. $c > $d; + $a = $b < $c &. $d; + $a = $b >= $c ^. $d; + $a = $b <= $c |. $d; + $a = $b <=> $c &. $d; + $a &.= $b == $c; $a |.= $b == $c; $a ^.= $b == $c; # shouldn't warn +} no warnings 'precedence'; $a = $b & $c == $d; $a = $b ^ $c != $d; @@ -1521,6 +1578,25 @@ $a = $b < $c & $d; $a = $b >= $c ^ $d; $a = $b <= $c | $d; $a = $b <=> $c & $d; +{ + use experimental 'bitwise'; + $a = $b & $c == $d; + $a = $b ^ $c != $d; + $a = $b | $c > $d; + $a = $b < $c & $d; + $a = $b >= $c ^ $d; + $a = $b <= $c | $d; + $a = $b <=> $c & $d; + $a &= $b == $c; $a |= $b == $c; $a ^= $b == $c; # shouldn't warn + $a = $b &. $c == $d; + $a = $b ^. $c != $d; + $a = $b |. $c > $d; + $a = $b < $c &. $d; + $a = $b >= $c ^. $d; + $a = $b <= $c |. $d; + $a = $b <=> $c &. $d; + $a &.= $b == $c; $a |.= $b == $c; $a ^.= $b == $c; # shouldn't warn +} EXPECT Possible precedence problem on bitwise & operator at - line 3. Possible precedence problem on bitwise ^ operator at - line 4. @@ -1529,6 +1605,20 @@ Possible precedence problem on bitwise & operator at - line 6. Possible precedence problem on bitwise ^ operator at - line 7. Possible precedence problem on bitwise | operator at - line 8. Possible precedence problem on bitwise & operator at - line 9. +Possible precedence problem on bitwise & operator at - line 13. +Possible precedence problem on bitwise ^ operator at - line 14. +Possible precedence problem on bitwise | operator at - line 15. +Possible precedence problem on bitwise & operator at - line 16. +Possible precedence problem on bitwise ^ operator at - line 17. +Possible precedence problem on bitwise | operator at - line 18. +Possible precedence problem on bitwise & operator at - line 19. +Possible precedence problem on bitwise &. operator at - line 21. +Possible precedence problem on bitwise ^. operator at - line 22. +Possible precedence problem on bitwise |. operator at - line 23. +Possible precedence problem on bitwise &. operator at - line 24. +Possible precedence problem on bitwise ^. operator at - line 25. +Possible precedence problem on bitwise |. operator at - line 26. +Possible precedence problem on bitwise &. operator at - line 27. ######## # op.c use integer; @@ -1921,3 +2011,49 @@ sub bbb ($a) { 4 } $aaa = sub { 2 }; $bbb = sub ($a) { 4 }; EXPECT +######## +use warnings 'numeric'; +my $c = -4.5; +my $a = "y" x $c; +my $b = "y" x -3; +no warnings 'numeric'; +my $d = "y" x $c; +my $e = "y" x -3; +no warnings 'numeric'; +EXPECT +Negative repeat count does nothing at - line 3. +Negative repeat count does nothing at - line 4. +######## +my $a = "inf" + 0; +my $b = -$a; +my $c = "nan" + 0; +use warnings 'numeric'; +my $x = "x" x $a; +my $y = "y" x $b; +my $z = "z" x $c; +no warnings 'numeric'; +my $x = "x" x $a; +my $y = "y" x $b; +my $z = "z" x $c; +no warnings 'numeric'; +EXPECT +Non-finite repeat count does nothing at - line 5. +Non-finite repeat count does nothing at - line 6. +Non-finite repeat count does nothing at - line 7. +######## +# NAME warn on stat @array +@foo = ("op/stat.t"); +stat @foo; +my @bar = @foo; +stat @bar; +my $ref = \@foo; +stat @$ref; +use warnings 'syntax'; +stat @foo; +stat @bar; +stat @$ref; +EXPECT +Array passed to stat will be coerced to a scalar (did you want stat $foo[0]?) at - line 8. +Array passed to stat will be coerced to a scalar (did you want stat $bar[0]?) at - line 9. +Array passed to stat will be coerced to a scalar at - line 10. + diff --git a/gnu/usr.bin/perl/t/lib/warnings/perlio b/gnu/usr.bin/perl/t/lib/warnings/perlio index 0ccc5a884f4..2be984ff6c7 100644 --- a/gnu/usr.bin/perl/t/lib/warnings/perlio +++ b/gnu/usr.bin/perl/t/lib/warnings/perlio @@ -56,3 +56,17 @@ close F; END { 1 while unlink "bb" } # KEEP THIS WITH THE LAST TEST. EXPECT Unknown PerlIO layer "xyz" at - line 5. +######## +# NAME :win32 experimental warning +# SKIP ?$^O ne "MSWin32" && ":win32 only available on Win32" +open my $fh, ">:win32", "temp.txt" or die $^E; +END { unlink "temp.txt"; } +EXPECT +PerlIO layer ':win32' is experimental at - line 1. +######## +# NAME :win32 experimental warning disabled +# SKIP ?$^O ne "MSWin32" && ":win32 only available on Win32" +no warnings "experimental::win32_perlio"; +open my $fh, ">:win32", "temp.txt" or die $^E; +END { unlink "temp.txt"; } +EXPECT diff --git a/gnu/usr.bin/perl/t/lib/warnings/pp b/gnu/usr.bin/perl/t/lib/warnings/pp index ab8f9516518..3324ccc5638 100644 --- a/gnu/usr.bin/perl/t/lib/warnings/pp +++ b/gnu/usr.bin/perl/t/lib/warnings/pp @@ -128,3 +128,11 @@ use utf8 ; $_ = "\x80 \xff" ; reverse ; EXPECT +######## +# NAME deprecation of complement with above ff code points +$_ = ~ "\xff"; +$_ = ~ "\x{100}"; +EXPECT +OPTION regex +Use of strings with code points over 0xFF as arguments to 1's complement \(~\) operator is deprecated at - line \d+. +Use of code point 0xFF+EFF is deprecated; the permissible max is 0x7F+ at - line \d+. diff --git a/gnu/usr.bin/perl/t/lib/warnings/pp_hot b/gnu/usr.bin/perl/t/lib/warnings/pp_hot index 4e63073bff8..702df088772 100644 --- a/gnu/usr.bin/perl/t/lib/warnings/pp_hot +++ b/gnu/usr.bin/perl/t/lib/warnings/pp_hot @@ -343,3 +343,17 @@ print $x[$b]; EXPECT OPTION regex Use of reference ".*" as array index at - line 7. +######## +use warnings 'misc'; +use constant FOO => { a => 1 }; +() = $_[FOO->{a}]; + +EXPECT +######## +use warnings 'misc'; +use constant FOO => {}; +() = $_[FOO]; + +EXPECT +OPTION regex +Use of reference "HASH\(0x\w+\)" as array index at - line 3. diff --git a/gnu/usr.bin/perl/t/lib/warnings/pp_sys b/gnu/usr.bin/perl/t/lib/warnings/pp_sys index 69993275a2d..63389649a83 100644 --- a/gnu/usr.bin/perl/t/lib/warnings/pp_sys +++ b/gnu/usr.bin/perl/t/lib/warnings/pp_sys @@ -576,10 +576,15 @@ getpeername() on unopened socket FOO at - line 64. # pp_sys.c [pp_stat] use warnings 'newline' ; stat "abc\ndef"; +stat "abcdef\n"; +stat "abcdef\n\0"; no warnings 'newline' ; stat "abc\ndef"; +stat "abcdef\n"; +stat "abcdef\n\0"; EXPECT -Unsuccessful stat on filename containing newline at - line 3. +Unsuccessful stat on filename containing newline at - line 4. +Unsuccessful stat on filename containing newline at - line 5. ######## # pp_sys.c [pp_fttext] use warnings qw(unopened closed) ; @@ -607,10 +612,15 @@ stat() on unopened filehandle foo at - line 9. # pp_sys.c [pp_fttext] use warnings 'newline' ; -T "abc\ndef" ; +-T "abcdef\n" ; +-T "abcdef\n\0" ; no warnings 'newline' ; -T "abc\ndef" ; +-T "abcdef\n" ; +-T "abcdef\n\0" ; EXPECT -Unsuccessful open on filename containing newline at - line 3. +Unsuccessful open on filename containing newline at - line 4. +Unsuccessful open on filename containing newline at - line 5. ######## # pp_sys.c [pp_sysread] use warnings 'io' ; @@ -623,6 +633,7 @@ EOM } my $file = "./xcv" ; open(F, ">$file") ; +binmode F; my $a = sysread(F, $a,10) ; no warnings 'io' ; my $a = sysread(F, $a,10) ; @@ -634,11 +645,11 @@ sysread(NONEXISTENT, $a, 10); read(NONEXISTENT, $a, 10); unlink $file ; EXPECT -Filehandle F opened only for output at - line 12. -sysread() on closed filehandle F at - line 17. -read() on closed filehandle F at - line 18. -sysread() on unopened filehandle NONEXISTENT at - line 19. -read() on unopened filehandle NONEXISTENT at - line 20. +Filehandle F opened only for output at - line 13. +sysread() on closed filehandle F at - line 18. +read() on closed filehandle F at - line 19. +sysread() on unopened filehandle NONEXISTENT at - line 20. +read() on unopened filehandle NONEXISTENT at - line 21. ######## # pp_sys.c [pp_binmode] use warnings 'unopened' ; @@ -898,14 +909,8 @@ seekdir() attempted on invalid dirhandle $foo at - line 21. rewinddir() attempted on invalid dirhandle $foo at - line 22. closedir() attempted on invalid dirhandle $foo at - line 23. ######## + # pp_sys.c [pp_gmtime] -BEGIN { - print <<EOM; -SKIPPED -# NaN values not produced consistently in 5.20.x -EOM - exit; -} gmtime("NaN"); localtime("NaN"); use warnings "overflow"; @@ -917,3 +922,43 @@ gmtime(NaN) too large at - line 6. gmtime(NaN) failed at - line 6. localtime(NaN) too large at - line 7. localtime(NaN) failed at - line 7. + +######## +# pp_sys.c [pp_alarm] +alarm(-1); +no warnings "misc"; +alarm(-1); + +EXPECT +alarm() with negative argument at - line 2. + +######## +# pp_sys.c [pp_sleep] +sleep(-1); +no warnings "misc"; +sleep(-1); + +EXPECT +sleep() with negative argument at - line 2. +######## +# NAME sysread() deprecated on :utf8 +use warnings 'deprecated'; +open my $fh, "<:raw", "../harness" or die "# $!"; +my $buf; +sysread $fh, $buf, 10; +binmode $fh, ':utf8'; +sysread $fh, $buf, 10; +EXPECT +sysread() is deprecated on :utf8 handles at - line 6. +######## +# NAME syswrite() deprecated on :utf8 +my $file = "syswwarn.tmp"; +use warnings 'deprecated'; +open my $fh, ">:raw", $file or die "# $!"; +syswrite $fh, 'ABC'; +binmode $fh, ':utf8'; +syswrite $fh, 'ABC'; +close $fh; +unlink $file; +EXPECT +syswrite() is deprecated on :utf8 handles at - line 6. diff --git a/gnu/usr.bin/perl/t/lib/warnings/regcomp b/gnu/usr.bin/perl/t/lib/warnings/regcomp index b55959e0703..08cb27b00f1 100644 --- a/gnu/usr.bin/perl/t/lib/warnings/regcomp +++ b/gnu/usr.bin/perl/t/lib/warnings/regcomp @@ -1,5 +1,7 @@ regcomp.c These tests have been moved to t/re/reg_mesg.t - except for those that explicitly test line numbers. + except for those that explicitly test line numbers + and those that don't have a <-- HERE in them, and those that + die plus have warnings, or otherwise require special handling __END__ use warnings 'regexp'; @@ -7,3 +9,112 @@ $r=qr/(??{ q"\\b+" })/; "a" =~ /a$r/; # warning should come from this line EXPECT \b+ matches null string many times in regex; marked by <-- HERE in m/\b+ <-- HERE / at - line 3. +######## +# regcomp.c +use warnings 'digit' ; +my $a = qr/\o{1238456}\x{100}/; +my $a = qr/[\o{6548321}]\x{100}/; +no warnings 'digit' ; +my $a = qr/\o{1238456}\x{100}/; +my $a = qr/[\o{6548321}]\x{100}/; +EXPECT +Non-octal character '8'. Resolved as "\o{123}" at - line 3. +Non-octal character '8'. Resolved as "\o{654}" at - line 4. +######## +# regcomp.c +BEGIN { + if (ord('A') == 193) { + print "SKIPPED\n# Different results on EBCDIC"; + exit 0; + } +} +use warnings; +$a = qr/\c,/; +$a = qr/[\c,]/; +no warnings 'syntax'; +$a = qr/\c,/; +$a = qr/[\c,]/; +EXPECT +"\c," is more clearly written simply as "l" at - line 9. +"\c," is more clearly written simply as "l" at - line 10. +######## +# This is because currently a different error is output under +# use re 'strict', so can't go in reg_mesg.t +# NAME perl #126261, error message causes segfault +# OPTION fatal + qr/abc[\x{df}[.00./i +EXPECT +Unmatched [ in regex; marked by <-- HERE in m/abc[ <-- HERE \x{df}[.00./ at - line 4. +######## +# NAME perl #126261, with 'use utf8' +# OPTION fatal +use utf8; +no warnings 'utf8'; +qr/abc[fi[.00./i; +EXPECT +Unmatched [ in regex; marked by <-- HERE in m/abc[ <-- HERE fi[.00./ at - line 4. +######## +# NAME perl qr/(?[[[:word]]])/ XXX Why is 'syntax' lc? +# OPTION fatal +qr/(?[[[:word]]])/; +EXPECT +Assuming NOT a POSIX class since there is no terminating ':' in regex; marked by <-- HERE in m/(?[[[:word <-- HERE ]]])/ at - line 2. +syntax error in (?[...]) in regex m/(?[[[:word]]])/ at - line 2. +######## +# NAME qr/(?[ [[:digit: ])/ +# OPTION fatal +qr/(?[[[:digit: ])/; +EXPECT +Assuming NOT a POSIX class since no blanks are allowed in one in regex; marked by <-- HERE in m/(?[[[:digit: ] <-- HERE )/ at - line 2. +syntax error in (?[...]) in regex m/(?[[[:digit: ])/ at - line 2. +######## +# NAME qr/(?[ [:digit: ])/ +# OPTION fatal +qr/(?[[:digit: ])/ +EXPECT +Assuming NOT a POSIX class since no blanks are allowed in one in regex; marked by <-- HERE in m/(?[[:digit: ] <-- HERE )/ at - line 2. +syntax error in (?[...]) in regex m/(?[[:digit: ])/ at - line 2. +######## +# NAME [perl #126141] +# OPTION fatal +eval {/$_/}, print "$_ ==> ", $@ || "OK!\n" for "]]]]]]]]][\\", "]]]]][\\" +EXPECT +]]]]]]]]][\ ==> Unmatched [ in regex; marked by <-- HERE in m/]]]]]]]]][\ <-- HERE / at - line 2. +]]]]][\ ==> Unmatched [ in regex; marked by <-- HERE in m/]]]]][\ <-- HERE / at - line 2. +######## +# NAME [perl #123417] +use warnings 'regexp'; +qr/[\N{}]/; +qr/\N{}/; +no warnings 'regexp'; +qr/[\N{}]/; +qr/\N{}/; +no warnings 'deprecated'; +qr/[\N{}]/; +qr/\N{}/; +EXPECT +Unknown charname '' is deprecated at - line 2. +Ignoring zero length \N{} in character class in regex; marked by <-- HERE in m/[\N{} <-- HERE ]/ at - line 2. +Unknown charname '' is deprecated at - line 3. +Unknown charname '' is deprecated at - line 5. +Unknown charname '' is deprecated at - line 6. +######## +# NAME [perl #123417] +# OPTION fatal +use warnings 'regexp'; +no warnings 'experimental::re_strict'; +use re 'strict'; +qr/[\N{}]/; +EXPECT +Unknown charname '' is deprecated at - line 5. +Zero length \N{} in regex; marked by <-- HERE in m/[\N{} <-- HERE ]/ at - line 5. +######## +# NAME [perl #123417] +# OPTION fatal +use warnings 'regexp'; +no warnings 'experimental::re_strict'; +use re 'strict'; +qr/\N{}/; +EXPECT +Unknown charname '' is deprecated at - line 5. +Zero length \N{} in regex; marked by <-- HERE in m/\N{} <-- HERE / at - line 5. diff --git a/gnu/usr.bin/perl/t/lib/warnings/regexec b/gnu/usr.bin/perl/t/lib/warnings/regexec index 73696dfb1d6..900dd6ee7f4 100644 --- a/gnu/usr.bin/perl/t/lib/warnings/regexec +++ b/gnu/usr.bin/perl/t/lib/warnings/regexec @@ -117,3 +117,146 @@ $_ = 'a' x (2**15+1); # EXPECT +######## +# NAME Wide character in non-UTF-8 locale +require '../loc_tools.pl'; +unless (locales_enabled()) { + print("SKIPPED\n# locales not available\n"),exit; +} +eval { require POSIX; POSIX->import("locale_h") }; +if ($@) { + print("SKIPPED\n# no POSIX\n"),exit; +} +use warnings 'locale'; +use locale; +setlocale(&POSIX::LC_CTYPE, "C"); +"\x{100}" =~ /\x{100}|\x{101}/il; +"\x{100}" =~ /\x{100}|\x{101}/l; +"\x{100}" =~ /\w/l; +"\x{100}" =~ /\x{100}+/l; +"\x{100}" =~ /[\x{100}\x{102}]/l; +no warnings 'locale'; +EXPECT +Wide character (U+100) in pattern match (m//) at - line 12. +Wide character (U+100) in pattern match (m//) at - line 12. +Wide character (U+100) in pattern match (m//) at - line 13. +Wide character (U+100) in pattern match (m//) at - line 13. +Wide character (U+100) in pattern match (m//) at - line 13. +Wide character (U+100) in pattern match (m//) at - line 14. +Wide character (U+100) in pattern match (m//) at - line 14. +Wide character (U+100) in pattern match (m//) at - line 15. +Wide character (U+100) in pattern match (m//) at - line 16. +Wide character (U+100) in pattern match (m//) at - line 16. +######## +# NAME Wide character in UTF-8 locale +require '../loc_tools.pl'; +unless (locales_enabled()) { + print("SKIPPED\n# locales not available\n"),exit; +} +eval { require POSIX; POSIX->import("locale_h") }; +if ($@) { + print("SKIPPED\n# no POSIX\n"),exit; +} +my @utf8_locales = find_utf8_ctype_locale(); +unless (@utf8_locales) { + print("SKIPPED\n# no UTF-8 locales\n"),exit; +} +use warnings 'locale'; +use locale; +setlocale(&POSIX::LC_CTYPE, $utf8_locales[0]); +"\x{100}" =~ /\x{100}|\x{101}/il; +"\x{100}" =~ /\x{100}|\x{101}/l; +"\x{100}" =~ /\w/l; +"\x{100}" =~ /\x{100}+/l; +"\x{100}" =~ /[\x{100}\x{102}]/l; +EXPECT +######## +# NAME \b{} in non-UTF-8 locale +eval { require POSIX; POSIX->import("locale_h") }; +if ($@) { + print("SKIPPED\n# no POSIX\n"),exit; +} +use warnings 'locale'; +use locale; +setlocale(&POSIX::LC_CTYPE, "C"); +"a" =~ /\b{gcb}/l; +no warnings 'locale'; +"a" =~ /\b{gcb}/l; +EXPECT +Use of \b{} or \B{} for non-UTF-8 locale is wrong. Assuming a UTF-8 locale at - line 8. +Use of \b{} or \B{} for non-UTF-8 locale is wrong. Assuming a UTF-8 locale at - line 8. +######## +# NAME \b{} in UTF-8 locale +require '../loc_tools.pl'; +unless (locales_enabled()) { + print("SKIPPED\n# locales not available\n"),exit; +} +eval { require POSIX; POSIX->import("locale_h") }; +if ($@) { + print("SKIPPED\n# no POSIX\n"),exit; +} +my $utf8_locale = find_utf8_ctype_locale(); +unless ($utf8_locale) { + print("SKIPPED\n# No UTF-8 locale available\n"),exit; +} +use warnings 'locale'; +use locale; +setlocale(&POSIX::LC_CTYPE, "C"); + "abc def" =~ /\b{wb}.*?/; + "abc def" =~ /\B{wb}.*?/; +setlocale(&POSIX::LC_CTYPE, $utf8_locale); + "abc def" =~ /\b{wb}.*?/; + "abc def" =~ /\B{wb}.*?/; +EXPECT +Use of \b{} or \B{} for non-UTF-8 locale is wrong. Assuming a UTF-8 locale at - line 16. +Use of \b{} or \B{} for non-UTF-8 locale is wrong. Assuming a UTF-8 locale at - line 16. +Use of \b{} or \B{} for non-UTF-8 locale is wrong. Assuming a UTF-8 locale at - line 17. +Use of \b{} or \B{} for non-UTF-8 locale is wrong. Assuming a UTF-8 locale at - line 17. +Use of \b{} or \B{} for non-UTF-8 locale is wrong. Assuming a UTF-8 locale at - line 17. +######## +# NAME (?[ ]) in non-UTF-8 locale +eval { require POSIX; POSIX->import("locale_h") }; +if ($@) { + print("SKIPPED\n# no POSIX\n"),exit; +} +no warnings 'experimental::regex_sets'; +use warnings 'locale'; +use locale; +setlocale(&POSIX::LC_CTYPE, "C"); +"\N{KELVIN SIGN}" =~ /(?[ \N{KELVIN SIGN} ])/i; +"K" =~ /(?[ \N{KELVIN SIGN} ])/i; +"k" =~ /(?[ \N{KELVIN SIGN} ])/i; +":" =~ /(?[ \: ])/; +no warnings 'locale'; +EXPECT +Use of (?[ ]) for non-UTF-8 locale is wrong. Assuming a UTF-8 locale at - line 9. +Use of (?[ ]) for non-UTF-8 locale is wrong. Assuming a UTF-8 locale at - line 9. +Use of (?[ ]) for non-UTF-8 locale is wrong. Assuming a UTF-8 locale at - line 10. +Use of (?[ ]) for non-UTF-8 locale is wrong. Assuming a UTF-8 locale at - line 10. +Use of (?[ ]) for non-UTF-8 locale is wrong. Assuming a UTF-8 locale at - line 11. +Use of (?[ ]) for non-UTF-8 locale is wrong. Assuming a UTF-8 locale at - line 11. +Use of (?[ ]) for non-UTF-8 locale is wrong. Assuming a UTF-8 locale at - line 12. +Use of (?[ ]) for non-UTF-8 locale is wrong. Assuming a UTF-8 locale at - line 12. +######## +# NAME (?[ ]) in UTF-8 locale +require '../loc_tools.pl'; +unless (locales_enabled()) { + print("SKIPPED\n# locales not available\n"),exit; +} +eval { require POSIX; POSIX->import("locale_h") }; +if ($@) { + print("SKIPPED\n# no POSIX\n"),exit; +} +my $utf8_locale = find_utf8_ctype_locale(); +unless ($utf8_locale) { + print("SKIPPED\n# No UTF-8 locale available\n"),exit; +} +no warnings 'experimental::regex_sets'; +use warnings 'locale'; +use locale; +setlocale(&POSIX::LC_CTYPE, $utf8_locale); +"\N{KELVIN SIGN}" =~ /(?[ \N{KELVIN SIGN} ])/i; +"K" =~ /(?[ \N{KELVIN SIGN} ])/i; +"k" =~ /(?[ \N{KELVIN SIGN} ])/i; +":" =~ /(?[ \: ])/; +EXPECT diff --git a/gnu/usr.bin/perl/t/lib/warnings/sv b/gnu/usr.bin/perl/t/lib/warnings/sv index 41a4fab1948..5ddd4fe1303 100644 --- a/gnu/usr.bin/perl/t/lib/warnings/sv +++ b/gnu/usr.bin/perl/t/lib/warnings/sv @@ -363,6 +363,14 @@ EXPECT Argument "\x{100}\x{200}" isn't numeric in negation (-) at - line 3. ######## # sv.c +use warnings 'numeric' ; +$a = "\x{100}\x{1000}" x 10; $b = $a < 1; +no warnings 'numeric' ; +$a = "\x{100}\x{1000}" x 10; $b = $a < 1; +EXPECT +Argument "\x{100}\x{1000}\x{100}\x{1000}\x{100}..." isn't numeric in numeric lt (<) at - line 3. +######## +# sv.c use warnings 'redefine' ; use utf8; use open qw( :utf8 :std ); @@ -389,11 +397,19 @@ EXPECT Subroutine main::f렏 redefined at - line 7. ######## # sv.c -sprintf "%vd", new version v1.1_0; -use warnings 'printf' ; -sprintf "%vd", new version v1.1_0; -no warnings 'printf' ; -sprintf "%vd", new version v1.1_0; +my $x = "a_c"; +++$x; +use warnings "numeric"; +$x = "a_c"; ++$x; +$x = ${ qr/abc/ }; ++$x; +$x = "123x"; ++$x; +$x = "123e"; ++$x; +$x = 0; ++$x; # none of these should warn +$x = "ABC"; ++$x; +$x = "ABC123"; ++$x; +$x = " +10"; ++$x; EXPECT -vector argument not supported with alpha versions at - line 2. -vector argument not supported with alpha versions at - line 4. +Argument "a_c" isn't numeric in preincrement (++) at - line 5. +Argument "(?^:abc)" isn't numeric in preincrement (++) at - line 6. +Argument "123x" isn't numeric in preincrement (++) at - line 7. +Argument "123e" isn't numeric in preincrement (++) at - line 8. diff --git a/gnu/usr.bin/perl/t/lib/warnings/toke b/gnu/usr.bin/perl/t/lib/warnings/toke index c880f079922..493c8a222c2 100644 --- a/gnu/usr.bin/perl/t/lib/warnings/toke +++ b/gnu/usr.bin/perl/t/lib/warnings/toke @@ -150,32 +150,6 @@ EXPECT Use of bare << to mean <<"" is deprecated at - line 2. ######## # toke.c -eval "\$\cT"; -eval "\${\7LOBAL_PHASE}"; -eval "\${\cT}"; -eval "\${\n\cT}"; -eval "\${\cT\n}"; -my $ret = eval "\${\n\cT\n}"; -print "ok\n" if $ret == $^T; - -no warnings 'deprecated' ; -eval "\$\cT"; -eval "\${\7LOBAL_PHASE}"; -eval "\${\cT}"; -eval "\${\n\cT}"; -eval "\${\cT\n}"; -eval "\${\n\cT\n}"; - -EXPECT -Use of literal control characters in variable names is deprecated at (eval 1) line 1. -Use of literal control characters in variable names is deprecated at (eval 2) line 1. -Use of literal control characters in variable names is deprecated at (eval 3) line 1. -Use of literal control characters in variable names is deprecated at (eval 4) line 2. -Use of literal control characters in variable names is deprecated at (eval 5) line 1. -Use of literal control characters in variable names is deprecated at (eval 6) line 2. -ok -######## -# toke.c $a =~ m/$foo/eq; $a =~ s/$foo/fool/seq; @@ -783,15 +757,14 @@ use warnings "ambiguous"; print for keys %+; # should not warn EXPECT ######## -# toke.c +# toke.c [This does not warn any more.] sub fred {}; -fred ; sub hank : lvalue {$_} --hank; # This should *not* warn [perl #77240] EXPECT -Ambiguous use of -fred resolved as -&fred() at - line 3. ######## -# toke.c +# toke.c [This does not warn any more.] $^W = 0 ; sub fred {} ; -fred ; @@ -803,19 +776,15 @@ sub fred {} ; } -fred ; EXPECT -Ambiguous use of -fred resolved as -&fred() at - line 4. -Ambiguous use of -fred resolved as -&fred() at - line 9. -Ambiguous use of -fred resolved as -&fred() at - line 11. ######## -# toke.c +# toke.c [This does not warn any more.] use utf8; use open qw( :utf8 :std ); sub frèd {}; -frèd ; EXPECT -Ambiguous use of -frèd resolved as -&frèd() at - line 5. ######## -# toke.c +# toke.c [This does not warn any more.] $^W = 0 ; use utf8; use open qw( :utf8 :std ); @@ -829,19 +798,15 @@ sub frèd {} ; } -frèd ; EXPECT -Ambiguous use of -frèd resolved as -&frèd() at - line 6. -Ambiguous use of -frèd resolved as -&frèd() at - line 11. -Ambiguous use of -frèd resolved as -&frèd() at - line 13. ######## -# toke.c +# toke.c [This does not warn any more.] use utf8; use open qw( :utf8 :std ); sub ᒍᒘᒊ {}; -ᒍᒘᒊ ; EXPECT -Ambiguous use of -ᒍᒘᒊ resolved as -&ᒍᒘᒊ() at - line 5. ######## -# toke.c +# toke.c [This does not warn any more.] $^W = 0 ; use utf8; use open qw( :utf8 :std ); @@ -855,9 +820,6 @@ sub ᒍᒘᒊ {} ; } -ᒍᒘᒊ ; EXPECT -Ambiguous use of -ᒍᒘᒊ resolved as -&ᒍᒘᒊ() at - line 6. -Ambiguous use of -ᒍᒘᒊ resolved as -&ᒍᒘᒊ() at - line 11. -Ambiguous use of -ᒍᒘᒊ resolved as -&ᒍᒘᒊ() at - line 13. ######## # toke.c open FOO || time; @@ -1046,15 +1008,12 @@ EXPECT Useless use of \E at - line 3. ######## # toke.c -use feature 'postderef', 'postderef_qq'; +use feature 'postderef_qq'; (\$_)->$*; "$_->$*"; -no warnings 'experimental::postderef'; (\$_)->$*; "$_->$*"; EXPECT -Postfix dereference is experimental at - line 3. -Postfix dereference is experimental at - line 4. ######## # toke.c use warnings 'portable' ; @@ -1229,7 +1188,6 @@ $_ = $a = 1; $a !=~ /1/; $a !=~ m#1#; $a !=~/1/; -$a !=~ ?/?; $a !=~ y/1//; $a !=~ tr/1//; $a !=~ s/1//; @@ -1238,7 +1196,6 @@ no warnings "syntax"; $a !=~ /1/; $a !=~ m#1#; $a !=~/1/; -$a !=~ ?/?; $a !=~ y/1//; $a !=~ tr/1//; $a !=~ s/1//; @@ -1249,7 +1206,6 @@ EXPECT !=~ should be !~ at - line 7. !=~ should be !~ at - line 8. !=~ should be !~ at - line 9. -!=~ should be !~ at - line 10. ######## # toke.c our $foo :unique; @@ -1351,15 +1307,25 @@ Non-octal character '8'. Resolved as "\o{123}" at - line 3. ######## # toke.c use warnings; -my $a = "foo"; -print $a =~ ?f? ? "yes\n" : "no\n" foreach 0..2; +print ref ? "yes\n" : "no\n" foreach [], ''; # ? is unambiguosly an operator EXPECT -Use of ?PATTERN? without explicit operator is deprecated at - line 4. yes no -no +######## +# toke .c +use warnings; +$a =~ ?rand?; # ? is not a regex match +EXPECT +syntax error at - line 3, near "=~ ?" +Execution of - aborted due to compilation errors. ######## # toke.c +BEGIN { + if (ord('A') == 193) { + print "SKIPPED\n# result varies depending on which ebcdic platform"; + exit 0; + } +} use warnings; $a = "\c,"; $a = "\c`"; @@ -1367,15 +1333,34 @@ no warnings 'syntax'; $a = "\c,"; $a = "\c`"; EXPECT -"\c," is more clearly written simply as "l" at - line 3. -"\c`" is more clearly written simply as "\ " at - line 4. +"\c," is more clearly written simply as "l" at - line 9. +"\c`" is more clearly written simply as "\ " at - line 10. +######## +# toke.c +BEGIN { + if (ord('A') == 193) { + print "SKIPPED\n# test is ASCII-specific"; + exit 0; + } +} +use warnings; +my $a = "\c{ack}"; +EXPECT +OPTION fatal +Use ";" instead of "\c{" at - line 9. ######## # toke.c +BEGIN { + if (ord('A') == 65) { + print "SKIPPED\n# test is EBCDIC-specific"; + exit 0; + } +} use warnings; my $a = "\c{ack}"; EXPECT OPTION fatal -Use ";" instead of "\c{" at - line 3. +Sequence "\c{" invalid at - line 9. ######## # toke.c my $a = "\câ"; @@ -1453,56 +1438,37 @@ sub { # do not actually call require EXPECT ######## # toke.c -# [perl #113094], [perl #119101] -print "aa" =~ m{^a\{1,2\}$}, "\n"; -print "aa" =~ m{^a\x\{61\}$}, "\n"; -print "a\\x{6F}" =~ m{^a\\x\{6F\}$}, "\n"; -print "a\\o" =~ m{^a\\\x\{6F\}$}, "\n"; -print "a\\\\x{6F}" =~ m{^a\\\\x\{6F\}$}, "\n"; -print "a\\\\o" =~ m{^a\\\\\x\{6F\}$}, "\n"; -print "aa" =~ m{^a{1,2}$}, "\n"; -print "aq" =~ m[^a\[a-z\]$], "\n"; -print "aq" =~ m(^a\(q\)$), "\n"; -no warnings 'deprecated'; -print "aa" =~ m{^a\{1,2\}$}, "\n"; -print "aa" =~ m{^a\x\{61\}$}, "\n"; -print "a\\x{6F}" =~ m{^a\\x\{6F\}$}, "\n"; -print "a\\o" =~ m{^a\\\x\{6f\}$}, "\n"; -print "aq" =~ m[^a\[a-z\]$], "\n"; -print "aq" =~ m(^a\(q\)$), "\n"; -EXPECT -Useless use of '\'; doesn't escape metacharacter '{' at - line 3. -Useless use of '\'; doesn't escape metacharacter '{' at - line 4. -Useless use of '\'; doesn't escape metacharacter '{' at - line 6. -Useless use of '\'; doesn't escape metacharacter '{' at - line 8. -Useless use of '\'; doesn't escape metacharacter '[' at - line 10. -Useless use of '\'; doesn't escape metacharacter '(' at - line 11. -1 -1 -1 -1 -1 -1 -1 -1 -q -1 -1 -1 -1 -1 -q +# [perl #113094], [perl #119101], since reverted so no warnings generated +use warnings; +print "aa" =~ m{^a\{1,2\}$}, "A\n"; +print "aa" =~ m{^a\x\{61\}$}, "B\n"; +print "a\\x{6F}" =~ m{^a\\x\{6F\}$}, "C\n"; +print "a\\o" =~ m{^a\\\x\{6F\}$}, "D\n"; +print "a\\\\x{6F}" =~ m{^a\\\\x\{6F\}$}, "E\n"; +print "a\\\\o" =~ m{^a\\\\\x\{6F\}$}, "F\n"; +print "aa" =~ m{^a{1,2}$}, "G\n"; +print "aq" =~ m[^a\[a-z\]$], "H\n"; +print "aq" =~ m(^a\(q\)$), "I\n"; +EXPECT +Illegal hexadecimal digit '\' ignored at - line 5. +Illegal hexadecimal digit '\' ignored at - line 7. +Illegal hexadecimal digit '\' ignored at - line 9. +A +B +1C +D +1E +F +1G +H +I ######## # toke.c #[perl #119123] disallow literal control character variables -eval "\$\cQ = 25"; -eval "\${ \cX } = 24"; *{ Foo }; # shouldn't warn on {\n, even though \n is a control character EXPECT -Use of literal control characters in variable names is deprecated at (eval 1) line 1. -Use of literal control characters in variable names is deprecated at (eval 2) line 1. ######## # toke.c # [perl #120288] -X at start of line gave spurious warning, where X is not @@ -1534,10 +1500,12 @@ Comme ca! ######## # toke.c # Fix 'Use of "..." without parentheses is ambiguous' warning for -# Unicode function names +# Unicode function names. If not under PERL_UNICODE, this will generate +# a "Wide character" warning use utf8; use warnings; sub 𝛃(;$) { return 0; } my $v = 𝛃 - 5; EXPECT -Warning: Use of "𝛃" without parentheses is ambiguous at - line 7. +OPTION regex +(Wide character.*\n)?Warning: Use of "𝛃" without parentheses is ambiguous diff --git a/gnu/usr.bin/perl/t/lib/warnings/utf8 b/gnu/usr.bin/perl/t/lib/warnings/utf8 index 9004731cc6f..4263c04958a 100644 --- a/gnu/usr.bin/perl/t/lib/warnings/utf8 +++ b/gnu/usr.bin/perl/t/lib/warnings/utf8 @@ -17,7 +17,7 @@ __END__ # utf8.c [utf8_to_uvchr_buf] -W BEGIN { if (ord('A') == 193) { - print "SKIPPED\n# ebcdic platforms do not generate Malformed UTF-8 warnings."; + print "SKIPPED\n# ebcdic platforms generates different Malformed UTF-8 warnings."; exit 0; } } @@ -80,16 +80,21 @@ Operation "uc" returns its argument for non-Unicode code point 0x110000 at - lin use warnings 'utf8'; my $d800 = uc(chr(0xD800)); my $nonUnicode = uc(chr(0x110000)); -my $big_nonUnicode = uc(chr(0x8000_0000)); no warnings 'non_unicode'; my $d800 = uc(chr(0xD800)); my $nonUnicode = uc(chr(0x110000)); -my $big_nonUnicode = uc(chr(0x8000_0000)); EXPECT Operation "uc" returns its argument for UTF-16 surrogate U+D800 at - line 2. Operation "uc" returns its argument for non-Unicode code point 0x110000 at - line 3. -Operation "uc" returns its argument for non-Unicode code point 0x80000000 at - line 4. -Operation "uc" returns its argument for UTF-16 surrogate U+D800 at - line 6. +Operation "uc" returns its argument for UTF-16 surrogate U+D800 at - line 5. +######## +use warnings 'utf8'; +no warnings 'deprecated'; # This is above IV_MAX on 32 bit machines +my $big_nonUnicode = uc(chr(0x8000_0000)); +no warnings 'non_unicode'; +my $big_nonUnicode = uc(chr(0x8000_0000)); +EXPECT +Operation "uc" returns its argument for non-Unicode code point 0x80000000 at - line 3. ######## use warnings 'utf8'; my $d7ff = lc pack("U", 0xD7FF); @@ -349,92 +354,149 @@ my $file = tempfile(); open(my $fh, "+>:utf8", $file); print $fh "\x{D7FF}", "\n"; print $fh "\x{D800}", "\n"; +print $fh "\x{D900}", "\n"; +print $fh "\x{DA00}", "\n"; +print $fh "\x{DB00}", "\n"; +print $fh "\x{DC00}", "\n"; +print $fh "\x{DD00}", "\n"; +print $fh "\x{DE00}", "\n"; +print $fh "\x{DF00}", "\n"; print $fh "\x{DFFF}", "\n"; print $fh "\x{E000}", "\n"; print $fh "\x{FDCF}", "\n"; print $fh "\x{FDD0}", "\n"; +print $fh "\x{FDD1}", "\n"; print $fh "\x{FDEF}", "\n"; print $fh "\x{FDF0}", "\n"; +print $fh "\x{FDFE}", "\n"; +print $fh "\x{FDFF}", "\n"; +print $fh "\x{FE00}", "\n"; print $fh "\x{FEFF}", "\n"; print $fh "\x{FFFD}", "\n"; print $fh "\x{FFFE}", "\n"; print $fh "\x{FFFF}", "\n"; print $fh "\x{10000}", "\n"; +print $fh "\x{1FFFD}", "\n"; print $fh "\x{1FFFE}", "\n"; print $fh "\x{1FFFF}", "\n"; +print $fh "\x{20000}", "\n"; +print $fh "\x{2FFFD}", "\n"; print $fh "\x{2FFFE}", "\n"; print $fh "\x{2FFFF}", "\n"; +print $fh "\x{30000}", "\n"; +print $fh "\x{3FFFD}", "\n"; print $fh "\x{3FFFE}", "\n"; print $fh "\x{3FFFF}", "\n"; +print $fh "\x{40000}", "\n"; +print $fh "\x{4FFFD}", "\n"; print $fh "\x{4FFFE}", "\n"; print $fh "\x{4FFFF}", "\n"; +print $fh "\x{50000}", "\n"; +print $fh "\x{5FFFD}", "\n"; print $fh "\x{5FFFE}", "\n"; print $fh "\x{5FFFF}", "\n"; +print $fh "\x{60000}", "\n"; +print $fh "\x{6FFFD}", "\n"; print $fh "\x{6FFFE}", "\n"; print $fh "\x{6FFFF}", "\n"; +print $fh "\x{70000}", "\n"; +print $fh "\x{7FFFD}", "\n"; print $fh "\x{7FFFE}", "\n"; print $fh "\x{7FFFF}", "\n"; +print $fh "\x{80000}", "\n"; +print $fh "\x{8FFFD}", "\n"; print $fh "\x{8FFFE}", "\n"; print $fh "\x{8FFFF}", "\n"; +print $fh "\x{90000}", "\n"; +print $fh "\x{9FFFD}", "\n"; print $fh "\x{9FFFE}", "\n"; print $fh "\x{9FFFF}", "\n"; +print $fh "\x{A0000}", "\n"; +print $fh "\x{AFFFD}", "\n"; print $fh "\x{AFFFE}", "\n"; print $fh "\x{AFFFF}", "\n"; +print $fh "\x{B0000}", "\n"; +print $fh "\x{BFFFD}", "\n"; print $fh "\x{BFFFE}", "\n"; print $fh "\x{BFFFF}", "\n"; +print $fh "\x{C0000}", "\n"; +print $fh "\x{CFFFD}", "\n"; print $fh "\x{CFFFE}", "\n"; print $fh "\x{CFFFF}", "\n"; +print $fh "\x{D0000}", "\n"; +print $fh "\x{DFFFD}", "\n"; print $fh "\x{DFFFE}", "\n"; print $fh "\x{DFFFF}", "\n"; +print $fh "\x{E0000}", "\n"; +print $fh "\x{EFFFD}", "\n"; print $fh "\x{EFFFE}", "\n"; print $fh "\x{EFFFF}", "\n"; +print $fh "\x{F0000}", "\n"; +print $fh "\x{FFFFD}", "\n"; print $fh "\x{FFFFE}", "\n"; print $fh "\x{FFFFF}", "\n"; print $fh "\x{100000}", "\n"; +print $fh "\x{10FFFD}", "\n"; print $fh "\x{10FFFE}", "\n"; print $fh "\x{10FFFF}", "\n"; print $fh "\x{110000}", "\n"; +print $fh "\x{11FFFD}", "\n"; +print $fh "\x{11FFFE}", "\n"; +print $fh "\x{11FFFF}", "\n"; +print $fh "\x{120000}", "\n"; close $fh; EXPECT Unicode surrogate U+D800 is illegal in UTF-8 at - line 6. -Unicode surrogate U+DFFF is illegal in UTF-8 at - line 7. -Unicode non-character U+FDD0 is illegal for open interchange at - line 10. -Unicode non-character U+FDEF is illegal for open interchange at - line 11. -Unicode non-character U+FFFE is illegal for open interchange at - line 15. -Unicode non-character U+FFFF is illegal for open interchange at - line 16. -Unicode non-character U+1FFFE is illegal for open interchange at - line 18. -Unicode non-character U+1FFFF is illegal for open interchange at - line 19. -Unicode non-character U+2FFFE is illegal for open interchange at - line 20. -Unicode non-character U+2FFFF is illegal for open interchange at - line 21. -Unicode non-character U+3FFFE is illegal for open interchange at - line 22. -Unicode non-character U+3FFFF is illegal for open interchange at - line 23. -Unicode non-character U+4FFFE is illegal for open interchange at - line 24. -Unicode non-character U+4FFFF is illegal for open interchange at - line 25. -Unicode non-character U+5FFFE is illegal for open interchange at - line 26. -Unicode non-character U+5FFFF is illegal for open interchange at - line 27. -Unicode non-character U+6FFFE is illegal for open interchange at - line 28. -Unicode non-character U+6FFFF is illegal for open interchange at - line 29. -Unicode non-character U+7FFFE is illegal for open interchange at - line 30. -Unicode non-character U+7FFFF is illegal for open interchange at - line 31. -Unicode non-character U+8FFFE is illegal for open interchange at - line 32. -Unicode non-character U+8FFFF is illegal for open interchange at - line 33. -Unicode non-character U+9FFFE is illegal for open interchange at - line 34. -Unicode non-character U+9FFFF is illegal for open interchange at - line 35. -Unicode non-character U+AFFFE is illegal for open interchange at - line 36. -Unicode non-character U+AFFFF is illegal for open interchange at - line 37. -Unicode non-character U+BFFFE is illegal for open interchange at - line 38. -Unicode non-character U+BFFFF is illegal for open interchange at - line 39. -Unicode non-character U+CFFFE is illegal for open interchange at - line 40. -Unicode non-character U+CFFFF is illegal for open interchange at - line 41. -Unicode non-character U+DFFFE is illegal for open interchange at - line 42. -Unicode non-character U+DFFFF is illegal for open interchange at - line 43. -Unicode non-character U+EFFFE is illegal for open interchange at - line 44. -Unicode non-character U+EFFFF is illegal for open interchange at - line 45. -Unicode non-character U+FFFFE is illegal for open interchange at - line 46. -Unicode non-character U+FFFFF is illegal for open interchange at - line 47. -Unicode non-character U+10FFFE is illegal for open interchange at - line 49. -Unicode non-character U+10FFFF is illegal for open interchange at - line 50. -Code point 0x110000 is not Unicode, may not be portable at - line 51. +Unicode surrogate U+D900 is illegal in UTF-8 at - line 7. +Unicode surrogate U+DA00 is illegal in UTF-8 at - line 8. +Unicode surrogate U+DB00 is illegal in UTF-8 at - line 9. +Unicode surrogate U+DC00 is illegal in UTF-8 at - line 10. +Unicode surrogate U+DD00 is illegal in UTF-8 at - line 11. +Unicode surrogate U+DE00 is illegal in UTF-8 at - line 12. +Unicode surrogate U+DF00 is illegal in UTF-8 at - line 13. +Unicode surrogate U+DFFF is illegal in UTF-8 at - line 14. +Unicode non-character U+FDD0 is not recommended for open interchange in print at - line 17. +Unicode non-character U+FDD1 is not recommended for open interchange in print at - line 18. +Unicode non-character U+FDEF is not recommended for open interchange in print at - line 19. +Unicode non-character U+FFFE is not recommended for open interchange in print at - line 26. +Unicode non-character U+FFFF is not recommended for open interchange in print at - line 27. +Unicode non-character U+1FFFE is not recommended for open interchange in print at - line 30. +Unicode non-character U+1FFFF is not recommended for open interchange in print at - line 31. +Unicode non-character U+2FFFE is not recommended for open interchange in print at - line 34. +Unicode non-character U+2FFFF is not recommended for open interchange in print at - line 35. +Unicode non-character U+3FFFE is not recommended for open interchange in print at - line 38. +Unicode non-character U+3FFFF is not recommended for open interchange in print at - line 39. +Unicode non-character U+4FFFE is not recommended for open interchange in print at - line 42. +Unicode non-character U+4FFFF is not recommended for open interchange in print at - line 43. +Unicode non-character U+5FFFE is not recommended for open interchange in print at - line 46. +Unicode non-character U+5FFFF is not recommended for open interchange in print at - line 47. +Unicode non-character U+6FFFE is not recommended for open interchange in print at - line 50. +Unicode non-character U+6FFFF is not recommended for open interchange in print at - line 51. +Unicode non-character U+7FFFE is not recommended for open interchange in print at - line 54. +Unicode non-character U+7FFFF is not recommended for open interchange in print at - line 55. +Unicode non-character U+8FFFE is not recommended for open interchange in print at - line 58. +Unicode non-character U+8FFFF is not recommended for open interchange in print at - line 59. +Unicode non-character U+9FFFE is not recommended for open interchange in print at - line 62. +Unicode non-character U+9FFFF is not recommended for open interchange in print at - line 63. +Unicode non-character U+AFFFE is not recommended for open interchange in print at - line 66. +Unicode non-character U+AFFFF is not recommended for open interchange in print at - line 67. +Unicode non-character U+BFFFE is not recommended for open interchange in print at - line 70. +Unicode non-character U+BFFFF is not recommended for open interchange in print at - line 71. +Unicode non-character U+CFFFE is not recommended for open interchange in print at - line 74. +Unicode non-character U+CFFFF is not recommended for open interchange in print at - line 75. +Unicode non-character U+DFFFE is not recommended for open interchange in print at - line 78. +Unicode non-character U+DFFFF is not recommended for open interchange in print at - line 79. +Unicode non-character U+EFFFE is not recommended for open interchange in print at - line 82. +Unicode non-character U+EFFFF is not recommended for open interchange in print at - line 83. +Unicode non-character U+FFFFE is not recommended for open interchange in print at - line 86. +Unicode non-character U+FFFFF is not recommended for open interchange in print at - line 87. +Unicode non-character U+10FFFE is not recommended for open interchange in print at - line 90. +Unicode non-character U+10FFFF is not recommended for open interchange in print at - line 91. +Code point 0x110000 is not Unicode, may not be portable in print at - line 92. +Code point 0x11FFFD is not Unicode, may not be portable in print at - line 93. +Code point 0x11FFFE is not Unicode, may not be portable in print at - line 94. +Code point 0x11FFFF is not Unicode, may not be portable in print at - line 95. +Code point 0x120000 is not Unicode, may not be portable in print at - line 96. ######## require "../test.pl"; use warnings 'utf8'; @@ -446,8 +508,8 @@ print $fh "\x{110000}", "\n"; close $fh; EXPECT Unicode surrogate U+D800 is illegal in UTF-8 at - line 5. -Unicode non-character U+FFFF is illegal for open interchange at - line 6. -Code point 0x110000 is not Unicode, may not be portable at - line 7. +Unicode non-character U+FFFF is not recommended for open interchange in print at - line 6. +Code point 0x110000 is not Unicode, may not be portable in print at - line 7. ######## require "../test.pl"; use warnings 'utf8'; @@ -459,8 +521,8 @@ print $fh "\x{FFFF}", "\n"; print $fh "\x{110000}", "\n"; close $fh; EXPECT -Unicode non-character U+FFFF is illegal for open interchange at - line 7. -Code point 0x110000 is not Unicode, may not be portable at - line 8. +Unicode non-character U+FFFF is not recommended for open interchange in print at - line 7. +Code point 0x110000 is not Unicode, may not be portable in print at - line 8. ######## require "../test.pl"; use warnings 'utf8'; @@ -473,7 +535,7 @@ print $fh "\x{110000}", "\n"; close $fh; EXPECT Unicode surrogate U+D800 is illegal in UTF-8 at - line 6. -Code point 0x110000 is not Unicode, may not be portable at - line 8. +Code point 0x110000 is not Unicode, may not be portable in print at - line 8. ######## require "../test.pl"; use warnings 'utf8'; @@ -486,7 +548,7 @@ print $fh "\x{110000}", "\n"; close $fh; EXPECT Unicode surrogate U+D800 is illegal in UTF-8 at - line 6. -Unicode non-character U+FFFF is illegal for open interchange at - line 7. +Unicode non-character U+FFFF is not recommended for open interchange in print at - line 7. ######## # NAME C<use warnings "nonchar"> works in isolation require "../test.pl"; @@ -496,7 +558,7 @@ open(my $fh, "+>:utf8", $file); print $fh "\x{FFFF}", "\n"; close $fh; EXPECT -Unicode non-character U+FFFF is illegal for open interchange at - line 5. +Unicode non-character U+FFFF is not recommended for open interchange in print at - line 5. ######## # NAME C<use warnings "surrogate"> works in isolation require "../test.pl"; @@ -516,7 +578,7 @@ open(my $fh, "+>:utf8", $file); print $fh "\x{110000}", "\n"; close $fh; EXPECT -Code point 0x110000 is not Unicode, may not be portable at - line 5. +Code point 0x110000 is not Unicode, may not be portable in print at - line 5. ######## require "../test.pl"; no warnings 'utf8'; @@ -571,3 +633,137 @@ print $fh "\x{10FFFF}", "\n"; print $fh "\x{110000}", "\n"; close $fh; EXPECT +######## +# NAME Case change crosses 255/256 under non-UTF8 locale +require '../loc_tools.pl'; +unless (locales_enabled('LC_CTYPE')) { + print("SKIPPED\n# locales not available\n"),exit; +} +eval { require POSIX; POSIX->import("locale_h") }; +if ($@) { + print("SKIPPED\n# no POSIX\n"),exit; +} +use warnings 'locale'; +use feature 'fc'; +use locale; +setlocale(&POSIX::LC_CTYPE, "C"); +my $a; +$a = lc("\x{178}"); +$a = fc("\x{1E9E}"); +$a = fc("\x{FB05}"); +$a = uc("\x{FB00}"); +$a = ucfirst("\x{149}"); +$a = lcfirst("\x{178}"); +no warnings 'locale'; +$a = lc("\x{178}"); +$a = fc("\x{1E9E}"); +$a = fc("\x{FB05}"); +$a = uc("\x{FB00}"); +$a = ucfirst("\x{149}"); +$a = lcfirst("\x{178}"); +EXPECT +Can't do lc("\x{178}") on non-UTF-8 locale; resolved to "\x{178}". at - line 14. +Can't do fc("\x{1E9E}") on non-UTF-8 locale; resolved to "\x{17F}\x{17F}". at - line 15. +Can't do fc("\x{FB05}") on non-UTF-8 locale; resolved to "\x{FB06}". at - line 16. +Can't do uc("\x{FB00}") on non-UTF-8 locale; resolved to "\x{FB00}". at - line 17. +Can't do ucfirst("\x{149}") on non-UTF-8 locale; resolved to "\x{149}". at - line 18. +Can't do lcfirst("\x{178}") on non-UTF-8 locale; resolved to "\x{178}". at - line 19. +######## +# NAME Wide character in non-UTF-8 locale +require '../loc_tools.pl'; +unless (locales_enabled('LC_CTYPE')) { + print("SKIPPED\n# locales not available\n"),exit; +} +eval { require POSIX; POSIX->import("locale_h") }; +if ($@) { + print("SKIPPED\n# no POSIX\n"),exit; +} +use warnings 'locale'; +use feature 'fc'; +use locale; +setlocale(&POSIX::LC_CTYPE, "C"); +my $a; +$a = lc("\x{100}"); +$a = lcfirst("\x{101}"); +$a = fc("\x{102}"); +$a = uc("\x{103}"); +$a = ucfirst("\x{104}"); +no warnings 'locale'; +$a = lc("\x{100}"); +$a = lcfirst("\x{101}"); +$a = fc("\x{102}"); +$a = uc("\x{103}"); +$a = ucfirst("\x{104}"); +EXPECT +Wide character (U+100) in lc at - line 14. +Wide character (U+101) in lcfirst at - line 15. +Wide character (U+102) in fc at - line 16. +Wide character (U+103) in uc at - line 17. +Wide character (U+104) in ucfirst at - line 18. +######## +# NAME Wide character in UTF-8 locale +require '../loc_tools.pl'; +unless (locales_enabled('LC_CTYPE')) { + print("SKIPPED\n# locales not available\n"),exit; +} +eval { require POSIX; POSIX->import("locale_h") }; +if ($@) { + print("SKIPPED\n# no POSIX\n"),exit; +} +my @utf8_locales = find_utf8_ctype_locale(); +unless (@utf8_locales) { + print("SKIPPED\n# no UTF-8 locales\n"),exit; +} +use warnings 'locale'; +use feature 'fc'; +use locale; +setlocale(&POSIX::LC_CTYPE, $utf8_locales[0]); +my $a; +$a = lc("\x{100}"); +$a = lcfirst("\x{101}"); +$a = fc("\x{102}"); +$a = uc("\x{103}"); +$a = ucfirst("\x{104}"); +EXPECT +######## +# NAME Deprecation of too-large code points +require "../test.pl"; +use warnings 'non_unicode'; +my $max_cp = ~0 >> 1; +my $max_char = chr $max_cp; +my $to_warn_cp = $max_cp + 1; +my $to_warn_char = chr $to_warn_cp; +$max_char =~ /[\x{110000}\P{Unassigned}]/; +$to_warn_char =~ /[\x{110000}\P{Unassigned}]/; +my $temp = qr/$max_char/; +$temp = qr/$to_warn_char/; +$temp = uc($max_char); +$temp = uc($to_warn_char); +my $file = tempfile(); +open(my $fh, "+>:utf8", $file); +print $fh $max_char, "\n"; +print $fh $to_warn_char, "\n"; +close $fh; +EXPECT +OPTION regex +Use of code point 0x80+ is deprecated; the permissible max is 0x7F+ at - line \d+. +Use of code point 0x80+ is deprecated; the permissible max is 0x7F+ in pattern match \(m//\) at - line \d+. +Use of code point 0x80+ is deprecated; the permissible max is 0x7F+ in regexp compilation at - line \d+. +Use of code point 0x80+ is deprecated; the permissible max is 0x7F+ in regexp compilation at - line \d+. +Use of code point 0x80+ is deprecated; the permissible max is 0x7F+ at - line \d+. +Use of code point 0x80+ is deprecated; the permissible max is 0x7F+ in regexp compilation at - line \d+. +Operation "uc" returns its argument for non-Unicode code point 0x7F+ at - line \d+. +Use of code point 0x80+ is deprecated; the permissible max is 0x7F+ at - line \d+. +Operation "uc" returns its argument for non-Unicode code point 0x80+ at - line \d+. +Code point 0x7F+ is not Unicode, may not be portable in print at - line \d+. +Use of code point 0x80+ is deprecated; the permissible max is 0x7F+ in print at - line \d+. +######## +# NAME [perl #127262] +BEGIN{ + if (ord('A') == 193) { + print "SKIPPED\n# ebcdic platforms generates different Malformed UTF-8 warnings."; + exit 0; + } +{};$^H=2**400} +EXPECT +Malformed UTF-8 character (unexpected non-continuation byte 0x0a, immediately after start byte 0xc2) at - line 6. |