Follow that camel ... another sync.
[p5sagit/p5-mst-13.2.git] / t / pragma / warn / op
index dce52d8..9a278ef 100644 (file)
@@ -59,7 +59,7 @@
        local $a, $b = (1,2);
  
      Probable precedence problem on logical or at -e line 1.
-       use warning 'syntax'; my $x = print(ABC || 1);
+       use warnings 'syntax'; my $x = print(ABC || 1);
  
      Value of %s may be \"0\"; use \"defined\" 
        $x = 1 if $x = <FH> ;
 
      defined(@array) is deprecated
      (Maybe you should just omit the defined()?)
-       defined @a ;
        my @a ; defined @a ;
        defined (@a = (1,2,3)) ;
 
      defined(%hash) is deprecated
      (Maybe you should just omit the defined()?)
-       defined %h ;
        my %h ; defined %h ;
+    
+     /---/ should probably be written as "---"
+        join(/---/, @foo);
+
+    %s() called too early to check prototype           [Perl_peep]
+        fred() ; sub fred ($$) {}
+
 
     Mandatory Warnings 
     ------------------
     oops: oopsAV               [oopsAV]        TODO
     oops: oopsHV               [oopsHV]        TODO
     
-    
-
 
 __END__
 # op.c
-use warning 'unsafe' ;
+use warnings 'unsafe' ;
 my $x ;
 my $x ;
-no warning 'unsafe' ;
+no warnings 'unsafe' ;
 my $x ;
 EXPECT
 "my" variable $x masks earlier declaration in same scope at - line 4.
 ########
 # op.c
-use warning 'unsafe' ;
+use warnings 'unsafe' ;
 sub x {
       my $x;
       sub y {
@@ -134,7 +137,7 @@ EXPECT
 Variable "$x" will not stay shared at - line 7.
 ########
 # op.c
-no warning 'unsafe' ;
+no warnings 'unsafe' ;
 sub x {
       my $x;
       sub y {
@@ -145,7 +148,7 @@ EXPECT
 
 ########
 # op.c
-use warning 'unsafe' ;
+use warnings 'unsafe' ;
 sub x {
       my $x;
       sub y {
@@ -156,7 +159,7 @@ EXPECT
 Variable "$x" may be unavailable at - line 6.
 ########
 # op.c
-no warning 'unsafe' ;
+no warnings 'unsafe' ;
 sub x {
       my $x;
       sub y {
@@ -167,31 +170,31 @@ EXPECT
 
 ########
 # op.c
-use warning 'syntax' ;
+use warnings 'syntax' ;
 1 if $a = 1 ;
-no warning 'syntax' ;
+no warnings 'syntax' ;
 1 if $a = 1 ;
 EXPECT
 Found = in conditional, should be == at - line 3.
 ########
 # op.c
-use warning 'deprecated' ;
+use warnings 'deprecated' ;
 split ;
-no warning 'deprecated' ;
+no warnings 'deprecated' ;
 split ;
 EXPECT
 Use of implicit split to @_ is deprecated at - line 3.
 ########
 # op.c
-use warning 'deprecated' ;
+use warnings 'deprecated' ;
 $a = split ;
-no warning 'deprecated' ;
+no warnings 'deprecated' ;
 $a = split ;
 EXPECT
 Use of implicit split to @_ is deprecated at - line 3.
 ########
 # op.c
-use warning 'void' ; close STDIN ;
+use warnings 'void' ; close STDIN ;
 1 x 3 ;                        # OP_REPEAT
                        # OP_GVSV
 wantarray ;            # OP_WANTARRAY
@@ -244,7 +247,7 @@ eval { getgrgid 1 };        # OP_GGRGID
 eval { getpwnam 1 };   # OP_GPWNAM
 eval { getpwuid 1 };   # OP_GPWUID
 EXPECT
-Useless use of repeat in void context at - line 3.
+Useless use of repeat (x) in void context at - line 3.
 Useless use of wantarray in void context at - line 5.
 Useless use of reference-type operator in void context at - line 12.
 Useless use of reference constructor in void context at - line 13.
@@ -260,7 +263,7 @@ Useless use of rindex in void context at - line 22.
 Useless use of sprintf in void context at - line 23.
 Useless use of array element in void context at - line 24.
 Useless use of array slice in void context at - line 26.
-Useless use of hash elem in void context at - line 29.
+Useless use of hash element in void context at - line 29.
 Useless use of hash slice in void context at - line 30.
 Useless use of unpack in void context at - line 31.
 Useless use of pack in void context at - line 32.
@@ -283,7 +286,7 @@ Useless use of getpwnam in void context at - line 52.
 Useless use of getpwuid in void context at - line 53.
 ########
 # op.c
-no warning 'void' ; close STDIN ;
+no warnings 'void' ; close STDIN ;
 1 x 3 ;                        # OP_REPEAT
                        # OP_GVSV
 wantarray ;            # OP_WANTARRAY
@@ -338,15 +341,15 @@ eval { getpwuid 1 };      # OP_GPWUID
 EXPECT
 ########
 # op.c
-use warning 'void' ;
+use warnings 'void' ;
 for (@{[0]}) { "$_" }          # check warning isn't duplicated
-no warning 'void' ;
+no warnings 'void' ;
 for (@{[0]}) { "$_" }          # check warning isn't duplicated
 EXPECT
 Useless use of string in void context at - line 3.
 ########
 # op.c
-use warning 'void' ;
+use warnings 'void' ;
 use Config ;
 BEGIN {
     if ( ! $Config{d_telldir}) {
@@ -358,13 +361,13 @@ EOM
     }
 }
 telldir 1 ;            # OP_TELLDIR
-no warning 'void' ;
+no warnings 'void' ;
 telldir 1 ;            # OP_TELLDIR
 EXPECT
 Useless use of telldir in void context at - line 13.
 ########
 # op.c
-use warning 'void' ;
+use warnings 'void' ;
 use Config ;
 BEGIN {
     if ( ! $Config{d_getppid}) {
@@ -376,13 +379,13 @@ EOM
     }
 }
 getppid ;              # OP_GETPPID
-no warning 'void' ;
+no warnings 'void' ;
 getppid ;              # OP_GETPPID
 EXPECT
 Useless use of getppid in void context at - line 13.
 ########
 # op.c
-use warning 'void' ;
+use warnings 'void' ;
 use Config ;
 BEGIN {
     if ( ! $Config{d_getpgrp}) {
@@ -394,13 +397,13 @@ EOM
     }
 }
 getpgrp ;              # OP_GETPGRP
-no warning 'void' ;
+no warnings 'void' ;
 getpgrp ;              # OP_GETPGRP
 EXPECT
 Useless use of getpgrp in void context at - line 13.
 ########
 # op.c
-use warning 'void' ;
+use warnings 'void' ;
 use Config ;
 BEGIN {
     if ( ! $Config{d_times}) {
@@ -412,13 +415,13 @@ EOM
     }
 }
 times ;                        # OP_TMS
-no warning 'void' ;
+no warnings 'void' ;
 times ;                        # OP_TMS
 EXPECT
 Useless use of times in void context at - line 13.
 ########
 # op.c
-use warning 'void' ;
+use warnings 'void' ;
 use Config ;
 BEGIN {
     if ( ! $Config{d_getprior} or $^O eq 'os2') { # Locks before fixpak22
@@ -430,13 +433,13 @@ EOM
     }
 }
 getpriority 1,2;       # OP_GETPRIORITY
-no warning 'void' ;
+no warnings 'void' ;
 getpriority 1,2;       # OP_GETPRIORITY
 EXPECT
 Useless use of getpriority in void context at - line 13.
 ########
 # op.c
-use warning 'void' ;
+use warnings 'void' ;
 use Config ;
 BEGIN {
     if ( ! $Config{d_getlogin}) {
@@ -448,13 +451,13 @@ EOM
     }
 }
 getlogin ;                     # OP_GETLOGIN
-no warning 'void' ;
+no warnings 'void' ;
 getlogin ;                     # OP_GETLOGIN
 EXPECT
 Useless use of getlogin in void context at - line 13.
 ########
 # op.c
-use warning 'void' ;
+use warnings 'void' ;
 use Config ; BEGIN {
 if ( ! $Config{d_socket}) {
     print <<EOM ;
@@ -491,7 +494,7 @@ getservbyname 1,2;  # OP_GSBYNAME
 getservbyport 1,2;     # OP_GSBYPORT
 getservent ;           # OP_GSERVENT
 
-no warning 'void' ;
+no warnings 'void' ;
 getsockname STDIN ;    # OP_GETSOCKNAME
 getpeername STDIN ;    # OP_GETPEERNAME
 gethostbyname 1 ;      # OP_GHBYNAME
@@ -527,12 +530,12 @@ Useless use of getservbyport in void context at - line 36.
 Useless use of getservent in void context at - line 37.
 ########
 # op.c
-use warning 'void' ;
+use warnings 'void' ;
 *a ; # OP_RV2GV
 $a ; # OP_RV2SV
 @a ; # OP_RV2AV
 %a ; # OP_RV2HV
-no warning 'void' ;
+no warnings 'void' ;
 *a ; # OP_RV2GV
 $a ; # OP_RV2SV
 @a ; # OP_RV2AV
@@ -544,10 +547,10 @@ Useless use of a variable in void context at - line 5.
 Useless use of a variable in void context at - line 6.
 ########
 # op.c
-use warning 'void' ;
+use warnings 'void' ;
 "abc"; # OP_CONST
 7 ; # OP_CONST
-no warning 'void' ;
+no warnings 'void' ;
 "abc"; # OP_CONST
 7 ; # OP_CONST
 EXPECT
@@ -555,7 +558,8 @@ Useless use of a constant in void context at - line 3.
 Useless use of a constant in void context at - line 4.
 ########
 # op.c
-use warning 'unsafe' ;
+BEGIN{ $ENV{PERL_DESTRUCT_LEVEL} = 0 unless $ENV{PERL_DESTRUCT_LEVEL} > 3; } # known scalar leak
+use warnings 'unsafe' ;
 my $a ; my @a = () ; my %a = () ; my $b = \@a ; my $c = \%a ;
 @a =~ /abc/ ;
 @a =~ s/a/b/ ;
@@ -570,7 +574,7 @@ my $a ; my @a = () ; my %a = () ; my $b = \@a ; my $c = \%a ;
 %$c =~ s/a/b/ ;
 %$c =~ tr/a/b/ ;
 {
-no warning 'unsafe' ;
+no warnings 'unsafe' ;
 my $a ; my @a = () ; my %a = () ; my $b = \@a ; my $c = \%a ;
 @a =~ /abc/ ;
 @a =~ s/a/b/ ;
@@ -586,150 +590,150 @@ my $a ; my @a = () ; my %a = () ; my $b = \@a ; my $c = \%a ;
 %$c =~ tr/a/b/ ;
 }
 EXPECT
-Applying pattern match to @array will act on scalar(@array) at - line 4.
-Applying substitution to @array will act on scalar(@array) at - line 5.
-Can't modify private array in substitution at - line 5, near "s/a/b/ ;"
-Applying character translation to @array will act on scalar(@array) at - line 6.
-Applying pattern match to @array will act on scalar(@array) at - line 7.
-Applying substitution to @array will act on scalar(@array) at - line 8.
-Applying character translation to @array will act on scalar(@array) at - line 9.
-Applying pattern match to %hash will act on scalar(%hash) at - line 10.
-Applying substitution to %hash will act on scalar(%hash) at - line 11.
-Applying character translation to %hash will act on scalar(%hash) at - line 12.
-Applying pattern match to %hash will act on scalar(%hash) at - line 13.
-Applying substitution to %hash will act on scalar(%hash) at - line 14.
-Applying character translation to %hash will act on scalar(%hash) at - line 15.
-BEGIN not safe after errors--compilation aborted at - line 17.
-########
-# op.c
-use warning 'syntax' ;
+Applying pattern match (m//) to @array will act on scalar(@array) at - line 5.
+Applying substitution (s///) to @array will act on scalar(@array) at - line 6.
+Can't modify private array in substitution (s///) at - line 6, near "s/a/b/ ;"
+Applying transliteration (tr///) to @array will act on scalar(@array) at - line 7.
+Applying pattern match (m//) to @array will act on scalar(@array) at - line 8.
+Applying substitution (s///) to @array will act on scalar(@array) at - line 9.
+Applying transliteration (tr///) to @array will act on scalar(@array) at - line 10.
+Applying pattern match (m//) to %hash will act on scalar(%hash) at - line 11.
+Applying substitution (s///) to %hash will act on scalar(%hash) at - line 12.
+Applying transliteration (tr///) to %hash will act on scalar(%hash) at - line 13.
+Applying pattern match (m//) to %hash will act on scalar(%hash) at - line 14.
+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.
+BEGIN not safe after errors--compilation aborted at - line 18.
+########
+# op.c
+use warnings 'syntax' ;
 my $a, $b = (1,2);
-no warning 'syntax' ;
+no warnings 'syntax' ;
 my $c, $d = (1,2);
 EXPECT
 Parentheses missing around "my" list at - line 3.
 ########
 # op.c
-use warning 'syntax' ;
+use warnings 'syntax' ;
 local $a, $b = (1,2);
-no warning 'syntax' ;
+no warnings 'syntax' ;
 local $c, $d = (1,2);
 EXPECT
 Parentheses missing around "local" list at - line 3.
 ########
 # op.c
-use warning 'syntax' ;
+use warnings 'syntax' ;
 print (ABC || 1) ;
-no warning 'syntax' ;
+no warnings 'syntax' ;
 print (ABC || 1) ;
 EXPECT
-Probable precedence problem on logical or at - line 3.
+Probable precedence problem on logical or (||) at - line 3.
 ########
 --FILE-- abc
 
 --FILE--
 # op.c
-use warning 'unsafe' ;
+use warnings 'unsafe' ;
 open FH, "<abc" ;
 $x = 1 if $x = <FH> ;
-no warning 'unsafe' ;
+no warnings 'unsafe' ;
 $x = 1 if $x = <FH> ;
 EXPECT
 Value of <HANDLE> construct can be "0"; test with defined() at - line 4.
 ########
 # op.c
-use warning 'unsafe' ;
+use warnings 'unsafe' ;
 opendir FH, "." ;
 $x = 1 if $x = readdir FH ;
-no warning 'unsafe' ;
+no warnings 'unsafe' ;
 $x = 1 if $x = readdir FH ;
 closedir FH ;
 EXPECT
 Value of readdir() operator can be "0"; test with defined() at - line 4.
 ########
 # op.c
-use warning 'unsafe' ;
+use warnings 'unsafe' ;
 $x = 1 if $x = <*> ;
-no warning 'unsafe' ;
+no warnings 'unsafe' ;
 $x = 1 if $x = <*> ;
 EXPECT
 Value of glob construct can be "0"; test with defined() at - line 3.
 ########
 # op.c
-use warning 'unsafe' ;
+use warnings 'unsafe' ;
 %a = (1,2,3,4) ;
 $x = 1 if $x = each %a ;
-no warning 'unsafe' ;
+no warnings 'unsafe' ;
 $x = 1 if $x = each %a ;
 EXPECT
 Value of each() operator can be "0"; test with defined() at - line 4.
 ########
 # op.c
-use warning 'unsafe' ;
+use warnings 'unsafe' ;
 $x = 1 while $x = <*> and 0 ;
-no warning 'unsafe' ;
+no warnings 'unsafe' ;
 $x = 1 while $x = <*> and 0 ;
 EXPECT
 Value of glob construct can be "0"; test with defined() at - line 3.
 ########
 # op.c
-use warning 'unsafe' ;
+use warnings 'unsafe' ;
 opendir FH, "." ;
 $x = 1 while $x = readdir FH and 0 ;
-no warning 'unsafe' ;
+no warnings 'unsafe' ;
 $x = 1 while $x = readdir FH and 0 ;
 closedir FH ;
 EXPECT
 Value of readdir() operator can be "0"; test with defined() at - line 4.
 ########
 # op.c
-use warning 'redefine' ;
+use warnings 'redefine' ;
 sub fred {}
 sub fred {}
-no warning 'redefine' ;
+no warnings 'redefine' ;
 sub fred {}
 EXPECT
 Subroutine fred redefined at - line 4.
 ########
 # op.c
-use warning 'redefine' ;
+use warnings 'redefine' ;
 sub fred () { 1 }
 sub fred () { 1 }
-no warning 'redefine' ;
+no warnings 'redefine' ;
 sub fred () { 1 }
 EXPECT
 Constant subroutine fred redefined at - line 4.
 ########
 # op.c
-use warning 'redefine' ;
+use warnings 'redefine' ;
 format FRED =
 .
 format FRED =
 .
-no warning 'redefine' ;
+no warnings 'redefine' ;
 format FRED =
 .
 EXPECT
 Format FRED redefined at - line 5.
 ########
 # op.c
-use warning 'syntax' ;
+use warnings 'syntax' ;
 push FRED;
-no warning 'syntax' ;
+no warnings 'syntax' ;
 push FRED;
 EXPECT
 Array @FRED missing the @ in argument 1 of push() at - line 3.
 ########
 # op.c
-use warning 'syntax' ;
+use warnings 'syntax' ;
 @a = keys FRED ;
-no warning 'syntax' ;
+no warnings 'syntax' ;
 @a = keys FRED ;
 EXPECT
 Hash %FRED missing the % in argument 1 of keys() at - line 3.
 ########
 # op.c
-use warning 'syntax' ;
+use warnings 'syntax' ;
 exec "$^X -e 1" ; 
 my $a
 EXPECT
@@ -737,42 +741,28 @@ Statement unlikely to be reached at - line 4.
 (Maybe you meant system() when you said exec()?)
 ########
 # op.c
-use warning 'deprecated' ;
-defined(@a);
-EXPECT
-defined(@array) is deprecated at - line 3.
-(Maybe you should just omit the defined()?)
-########
-# op.c
-use warning 'deprecated' ;
+use warnings 'deprecated' ;
 my @a; defined(@a);
 EXPECT
 defined(@array) is deprecated at - line 3.
 (Maybe you should just omit the defined()?)
 ########
 # op.c
-use warning 'deprecated' ;
+use warnings 'deprecated' ;
 defined(@a = (1,2,3));
 EXPECT
 defined(@array) is deprecated at - line 3.
 (Maybe you should just omit the defined()?)
 ########
 # op.c
-use warning 'deprecated' ;
-defined(%h);
-EXPECT
-defined(%hash) is deprecated at - line 3.
-(Maybe you should just omit the defined()?)
-########
-# op.c
-use warning 'deprecated' ;
+use warnings 'deprecated' ;
 my %h; defined(%h);
 EXPECT
 defined(%hash) is deprecated at - line 3.
 (Maybe you should just omit the defined()?)
 ########
 # op.c
-no warning 'syntax' ;
+no warnings 'syntax' ;
 exec "$^X -e 1" ; 
 my $a
 EXPECT
@@ -789,10 +779,10 @@ $^W = 0 ;
 sub fred() ;
 sub fred($) {}
 {
-    no warning 'unsafe' ;
+    no warnings 'unsafe' ;
     sub Fred() ;
     sub Fred($) {}
-    use warning 'unsafe' ;
+    use warnings 'unsafe' ;
     sub freD() ;
     sub freD($) {}
 }
@@ -802,3 +792,19 @@ EXPECT
 Prototype mismatch: sub main::fred () vs ($) at - line 4.
 Prototype mismatch: sub main::freD () vs ($) at - line 11.
 Prototype mismatch: sub main::FRED () vs ($) at - line 14.
+########
+# op.c
+use warnings 'syntax' ;
+join /---/, 'x', 'y', 'z';
+EXPECT
+/---/ should probably be written as "---" at - line 3.
+########
+# op.c [Perl_peep]
+use warnings 'unsafe' ;
+fred() ; 
+sub fred ($$) {}
+no warnings 'unsafe' ;
+joe() ; 
+sub joe ($$) {}
+EXPECT
+main::fred() called too early to check prototype at - line 3.