fixes for logical bugs in the lexwarn patch; other tweaks to avoid
[p5sagit/p5-mst-13.2.git] / t / pragma / warn / op
CommitLineData
599cee73 1 op.c AOK
2
3 "my" variable %s masks earlier declaration in same scope
4 my $x;
5 my $x ;
6
7 Variable "%s" may be unavailable
8 sub x {
9 my $x;
10 sub y {
11 $x
12 }
13 }
14
15 Variable "%s" will not stay shared
16 sub x {
17 my $x;
18 sub y {
19 sub { $x }
20 }
21 }
22
23 Found = in conditional, should be ==
24 1 if $a = 1 ;
25
26 Use of implicit split to @_ is deprecated
27 split ;
28
29 Use of implicit split to @_ is deprecated
30 $a = split ;
31
32 Useless use of time in void context
33 Useless use of a variable in void context
34 Useless use of a constant in void context
35 time ;
36 $a ;
37 "abc"
38
39 Applying %s to %s will act on scalar(%s)
40 my $a ; my @a = () ; my %a = () ; my $b = \@a ; my $c = \%a ;
41 @a =~ /abc/ ;
42 @a =~ s/a/b/ ;
43 @a =~ tr/a/b/ ;
44 @$b =~ /abc/ ;
45 @$b =~ s/a/b/ ;
46 @$b =~ tr/a/b/ ;
47 %a =~ /abc/ ;
48 %a =~ s/a/b/ ;
49 %a =~ tr/a/b/ ;
50 %$c =~ /abc/ ;
51 %$c =~ s/a/b/ ;
52 %$c =~ tr/a/b/ ;
53
54
df5b6949 55 Parentheses missing around "my" list at -e line 1.
599cee73 56 my $a, $b = (1,2);
57
df5b6949 58 Parentheses missing around "local" list at -e line 1.
599cee73 59 local $a, $b = (1,2);
60
61 Probable precedence problem on logical or at -e line 1.
62 use warning 'syntax'; my $x = print(ABC || 1);
63
64 Value of %s may be \"0\"; use \"defined\"
65 $x = 1 if $x = <FH> ;
66 $x = 1 while $x = <FH> ;
67
68 Subroutine fred redefined at -e line 1.
69 sub fred{1;} sub fred{1;}
70
71 Constant subroutine %s redefined
72 sub fred() {1;} sub fred() {1;}
73
74 Format FRED redefined at /tmp/x line 5.
75 format FRED =
76 .
77 format FRED =
78 .
79
80 Array @%s missing the @ in argument %d of %s()
81 push fred ;
82
83 Hash %%%s missing the %% in argument %d of %s()
84 keys joe ;
85
86 Statement unlikely to be reached
87 (Maybe you meant system() when you said exec()?
88 exec "true" ; my $a
89
f10b0346 90 defined(@array) is deprecated
69794302 91 (Maybe you should just omit the defined()?)
92 defined @a ;
93 my @a ; defined @a ;
94 defined (@a = (1,2,3)) ;
95
f10b0346 96 defined(%hash) is deprecated
69794302 97 (Maybe you should just omit the defined()?)
98 defined %h ;
99 my %h ; defined %h ;
599cee73 100
0453d815 101 Mandatory Warnings
102 ------------------
103 Prototype mismatch: [cv_ckproto]
104 sub fred() ;
105 sub fred($) {}
106
107 %s never introduced [pad_leavemy] TODO
108 Runaway prototype [newSUB] TODO
109 oops: oopsAV [oopsAV] TODO
110 oops: oopsHV [oopsHV] TODO
111
112
113
114
599cee73 115__END__
116# op.c
117use warning 'unsafe' ;
118my $x ;
119my $x ;
0453d815 120no warning 'unsafe' ;
121my $x ;
599cee73 122EXPECT
123"my" variable $x masks earlier declaration in same scope at - line 4.
124########
125# op.c
126use warning 'unsafe' ;
127sub x {
128 my $x;
129 sub y {
130 $x
131 }
132 }
133EXPECT
134Variable "$x" will not stay shared at - line 7.
135########
136# op.c
0453d815 137no warning 'unsafe' ;
138sub x {
139 my $x;
140 sub y {
141 $x
142 }
143 }
144EXPECT
145
146########
147# op.c
599cee73 148use warning 'unsafe' ;
149sub x {
150 my $x;
151 sub y {
152 sub { $x }
153 }
154 }
155EXPECT
156Variable "$x" may be unavailable at - line 6.
157########
158# op.c
0453d815 159no warning 'unsafe' ;
160sub x {
161 my $x;
162 sub y {
163 sub { $x }
164 }
165 }
166EXPECT
167
168########
169# op.c
599cee73 170use warning 'syntax' ;
1711 if $a = 1 ;
0453d815 172no warning 'syntax' ;
1731 if $a = 1 ;
599cee73 174EXPECT
175Found = in conditional, should be == at - line 3.
176########
177# op.c
178use warning 'deprecated' ;
179split ;
0453d815 180no warning 'deprecated' ;
181split ;
599cee73 182EXPECT
183Use of implicit split to @_ is deprecated at - line 3.
184########
185# op.c
186use warning 'deprecated' ;
187$a = split ;
0453d815 188no warning 'deprecated' ;
189$a = split ;
599cee73 190EXPECT
191Use of implicit split to @_ is deprecated at - line 3.
192########
193# op.c
194use warning 'void' ; close STDIN ;
1951 x 3 ; # OP_REPEAT
196 # OP_GVSV
197wantarray ; # OP_WANTARRAY
198 # OP_GV
199 # OP_PADSV
200 # OP_PADAV
201 # OP_PADHV
202 # OP_PADANY
203 # OP_AV2ARYLEN
204ref ; # OP_REF
205\@a ; # OP_REFGEN
206\$a ; # OP_SREFGEN
207defined $a ; # OP_DEFINED
208hex $a ; # OP_HEX
209oct $a ; # OP_OCT
210length $a ; # OP_LENGTH
211substr $a,1 ; # OP_SUBSTR
212vec $a,1,2 ; # OP_VEC
213index $a,1,2 ; # OP_INDEX
214rindex $a,1,2 ; # OP_RINDEX
215sprintf $a ; # OP_SPRINTF
216$a[0] ; # OP_AELEM
217 # OP_AELEMFAST
218@a[0] ; # OP_ASLICE
219#values %a ; # OP_VALUES
220#keys %a ; # OP_KEYS
221$a{0} ; # OP_HELEM
222@a{0} ; # OP_HSLICE
223unpack "a", "a" ; # OP_UNPACK
224pack $a,"" ; # OP_PACK
225join "" ; # OP_JOIN
226(@a)[0,1] ; # OP_LSLICE
227 # OP_ANONLIST
228 # OP_ANONHASH
229sort(1,2) ; # OP_SORT
230reverse(1,2) ; # OP_REVERSE
231 # OP_RANGE
232 # OP_FLIP
233(1 ..2) ; # OP_FLOP
234caller ; # OP_CALLER
235fileno STDIN ; # OP_FILENO
236eof STDIN ; # OP_EOF
237tell STDIN ; # OP_TELL
238readlink 1; # OP_READLINK
239time ; # OP_TIME
240localtime ; # OP_LOCALTIME
241gmtime ; # OP_GMTIME
dfe13c55 242eval { getgrnam 1 }; # OP_GGRNAM
243eval { getgrgid 1 }; # OP_GGRGID
244eval { getpwnam 1 }; # OP_GPWNAM
245eval { getpwuid 1 }; # OP_GPWUID
599cee73 246EXPECT
247Useless use of repeat in void context at - line 3.
248Useless use of wantarray in void context at - line 5.
249Useless use of reference-type operator in void context at - line 12.
250Useless use of reference constructor in void context at - line 13.
d6c467eb 251Useless use of single ref constructor in void context at - line 14.
599cee73 252Useless use of defined operator in void context at - line 15.
253Useless use of hex in void context at - line 16.
254Useless use of oct in void context at - line 17.
255Useless use of length in void context at - line 18.
256Useless use of substr in void context at - line 19.
257Useless use of vec in void context at - line 20.
258Useless use of index in void context at - line 21.
259Useless use of rindex in void context at - line 22.
260Useless use of sprintf in void context at - line 23.
261Useless use of array element in void context at - line 24.
262Useless use of array slice in void context at - line 26.
263Useless use of hash elem in void context at - line 29.
264Useless use of hash slice in void context at - line 30.
265Useless use of unpack in void context at - line 31.
266Useless use of pack in void context at - line 32.
267Useless use of join in void context at - line 33.
268Useless use of list slice in void context at - line 34.
269Useless use of sort in void context at - line 37.
270Useless use of reverse in void context at - line 38.
271Useless use of range (or flop) in void context at - line 41.
272Useless use of caller in void context at - line 42.
273Useless use of fileno in void context at - line 43.
274Useless use of eof in void context at - line 44.
275Useless use of tell in void context at - line 45.
276Useless use of readlink in void context at - line 46.
277Useless use of time in void context at - line 47.
278Useless use of localtime in void context at - line 48.
279Useless use of gmtime in void context at - line 49.
280Useless use of getgrnam in void context at - line 50.
281Useless use of getgrgid in void context at - line 51.
282Useless use of getpwnam in void context at - line 52.
283Useless use of getpwuid in void context at - line 53.
284########
285# op.c
0453d815 286no warning 'void' ; close STDIN ;
2871 x 3 ; # OP_REPEAT
288 # OP_GVSV
289wantarray ; # OP_WANTARRAY
290 # OP_GV
291 # OP_PADSV
292 # OP_PADAV
293 # OP_PADHV
294 # OP_PADANY
295 # OP_AV2ARYLEN
296ref ; # OP_REF
297\@a ; # OP_REFGEN
298\$a ; # OP_SREFGEN
299defined $a ; # OP_DEFINED
300hex $a ; # OP_HEX
301oct $a ; # OP_OCT
302length $a ; # OP_LENGTH
303substr $a,1 ; # OP_SUBSTR
304vec $a,1,2 ; # OP_VEC
305index $a,1,2 ; # OP_INDEX
306rindex $a,1,2 ; # OP_RINDEX
307sprintf $a ; # OP_SPRINTF
308$a[0] ; # OP_AELEM
309 # OP_AELEMFAST
310@a[0] ; # OP_ASLICE
311#values %a ; # OP_VALUES
312#keys %a ; # OP_KEYS
313$a{0} ; # OP_HELEM
314@a{0} ; # OP_HSLICE
315unpack "a", "a" ; # OP_UNPACK
316pack $a,"" ; # OP_PACK
317join "" ; # OP_JOIN
318(@a)[0,1] ; # OP_LSLICE
319 # OP_ANONLIST
320 # OP_ANONHASH
321sort(1,2) ; # OP_SORT
322reverse(1,2) ; # OP_REVERSE
323 # OP_RANGE
324 # OP_FLIP
325(1 ..2) ; # OP_FLOP
326caller ; # OP_CALLER
327fileno STDIN ; # OP_FILENO
328eof STDIN ; # OP_EOF
329tell STDIN ; # OP_TELL
330readlink 1; # OP_READLINK
331time ; # OP_TIME
332localtime ; # OP_LOCALTIME
333gmtime ; # OP_GMTIME
334eval { getgrnam 1 }; # OP_GGRNAM
335eval { getgrgid 1 }; # OP_GGRGID
336eval { getpwnam 1 }; # OP_GPWNAM
337eval { getpwuid 1 }; # OP_GPWUID
338EXPECT
339########
340# op.c
599cee73 341use warning 'void' ;
68c73484 342for (@{[0]}) { "$_" } # check warning isn't duplicated
0453d815 343no warning 'void' ;
344for (@{[0]}) { "$_" } # check warning isn't duplicated
68c73484 345EXPECT
346Useless use of string in void context at - line 3.
347########
348# op.c
349use warning 'void' ;
599cee73 350use Config ;
351BEGIN {
352 if ( ! $Config{d_telldir}) {
353 print <<EOM ;
354SKIPPED
355# telldir not present
356EOM
357 exit
358 }
359}
360telldir 1 ; # OP_TELLDIR
0453d815 361no warning 'void' ;
362telldir 1 ; # OP_TELLDIR
599cee73 363EXPECT
364Useless use of telldir in void context at - line 13.
365########
366# op.c
367use warning 'void' ;
368use Config ;
369BEGIN {
370 if ( ! $Config{d_getppid}) {
371 print <<EOM ;
372SKIPPED
373# getppid not present
374EOM
375 exit
376 }
377}
378getppid ; # OP_GETPPID
0453d815 379no warning 'void' ;
380getppid ; # OP_GETPPID
599cee73 381EXPECT
382Useless use of getppid in void context at - line 13.
383########
384# op.c
385use warning 'void' ;
386use Config ;
387BEGIN {
388 if ( ! $Config{d_getpgrp}) {
389 print <<EOM ;
390SKIPPED
391# getpgrp not present
392EOM
393 exit
394 }
395}
396getpgrp ; # OP_GETPGRP
0453d815 397no warning 'void' ;
398getpgrp ; # OP_GETPGRP
599cee73 399EXPECT
400Useless use of getpgrp in void context at - line 13.
401########
402# op.c
403use warning 'void' ;
404use Config ;
405BEGIN {
406 if ( ! $Config{d_times}) {
407 print <<EOM ;
408SKIPPED
409# times not present
410EOM
411 exit
412 }
413}
414times ; # OP_TMS
0453d815 415no warning 'void' ;
416times ; # OP_TMS
599cee73 417EXPECT
418Useless use of times in void context at - line 13.
419########
420# op.c
421use warning 'void' ;
422use Config ;
423BEGIN {
e96326af 424 if ( ! $Config{d_getprior} or $^O eq 'os2') { # Locks before fixpak22
599cee73 425 print <<EOM ;
426SKIPPED
427# getpriority not present
428EOM
429 exit
430 }
431}
432getpriority 1,2; # OP_GETPRIORITY
0453d815 433no warning 'void' ;
434getpriority 1,2; # OP_GETPRIORITY
599cee73 435EXPECT
436Useless use of getpriority in void context at - line 13.
437########
438# op.c
439use warning 'void' ;
440use Config ;
441BEGIN {
442 if ( ! $Config{d_getlogin}) {
443 print <<EOM ;
444SKIPPED
445# getlogin not present
446EOM
447 exit
448 }
449}
450getlogin ; # OP_GETLOGIN
0453d815 451no warning 'void' ;
452getlogin ; # OP_GETLOGIN
599cee73 453EXPECT
454Useless use of getlogin in void context at - line 13.
455########
456# op.c
457use warning 'void' ;
458use Config ; BEGIN {
459if ( ! $Config{d_socket}) {
460 print <<EOM ;
461SKIPPED
462# getsockname not present
463# getpeername not present
464# gethostbyname not present
465# gethostbyaddr not present
466# gethostent not present
467# getnetbyname not present
468# getnetbyaddr not present
469# getnetent not present
470# getprotobyname not present
471# getprotobynumber not present
472# getprotoent not present
473# getservbyname not present
474# getservbyport not present
475# getservent not present
476EOM
477 exit
478} }
479getsockname STDIN ; # OP_GETSOCKNAME
480getpeername STDIN ; # OP_GETPEERNAME
481gethostbyname 1 ; # OP_GHBYNAME
482gethostbyaddr 1,2; # OP_GHBYADDR
483gethostent ; # OP_GHOSTENT
484getnetbyname 1 ; # OP_GNBYNAME
485getnetbyaddr 1,2 ; # OP_GNBYADDR
486getnetent ; # OP_GNETENT
487getprotobyname 1; # OP_GPBYNAME
488getprotobynumber 1; # OP_GPBYNUMBER
489getprotoent ; # OP_GPROTOENT
490getservbyname 1,2; # OP_GSBYNAME
491getservbyport 1,2; # OP_GSBYPORT
492getservent ; # OP_GSERVENT
0453d815 493
494no warning 'void' ;
495getsockname STDIN ; # OP_GETSOCKNAME
496getpeername STDIN ; # OP_GETPEERNAME
497gethostbyname 1 ; # OP_GHBYNAME
498gethostbyaddr 1,2; # OP_GHBYADDR
499gethostent ; # OP_GHOSTENT
500getnetbyname 1 ; # OP_GNBYNAME
501getnetbyaddr 1,2 ; # OP_GNBYADDR
502getnetent ; # OP_GNETENT
503getprotobyname 1; # OP_GPBYNAME
504getprotobynumber 1; # OP_GPBYNUMBER
505getprotoent ; # OP_GPROTOENT
506getservbyname 1,2; # OP_GSBYNAME
507getservbyport 1,2; # OP_GSBYPORT
508getservent ; # OP_GSERVENT
dfe13c55 509INIT {
510 # some functions may not be there, so we exit without running
511 exit;
512}
599cee73 513EXPECT
514Useless use of getsockname in void context at - line 24.
515Useless use of getpeername in void context at - line 25.
516Useless use of gethostbyname in void context at - line 26.
517Useless use of gethostbyaddr in void context at - line 27.
518Useless use of gethostent in void context at - line 28.
519Useless use of getnetbyname in void context at - line 29.
520Useless use of getnetbyaddr in void context at - line 30.
521Useless use of getnetent in void context at - line 31.
522Useless use of getprotobyname in void context at - line 32.
523Useless use of getprotobynumber in void context at - line 33.
524Useless use of getprotoent in void context at - line 34.
525Useless use of getservbyname in void context at - line 35.
526Useless use of getservbyport in void context at - line 36.
527Useless use of getservent in void context at - line 37.
528########
529# op.c
530use warning 'void' ;
531*a ; # OP_RV2GV
532$a ; # OP_RV2SV
533@a ; # OP_RV2AV
534%a ; # OP_RV2HV
0453d815 535no warning 'void' ;
536*a ; # OP_RV2GV
537$a ; # OP_RV2SV
538@a ; # OP_RV2AV
539%a ; # OP_RV2HV
599cee73 540EXPECT
541Useless use of a variable in void context at - line 3.
542Useless use of a variable in void context at - line 4.
543Useless use of a variable in void context at - line 5.
544Useless use of a variable in void context at - line 6.
545########
546# op.c
547use warning 'void' ;
548"abc"; # OP_CONST
5497 ; # OP_CONST
0453d815 550no warning 'void' ;
551"abc"; # OP_CONST
5527 ; # OP_CONST
599cee73 553EXPECT
554Useless use of a constant in void context at - line 3.
555Useless use of a constant in void context at - line 4.
556########
557# op.c
f248d071 558$ENV{PERL_DESTRUCT_LEVEL} = 0 unless $ENV{PERL_DESTRUCT_LEVEL} > 3; # known scalar leak
599cee73 559use warning 'unsafe' ;
560my $a ; my @a = () ; my %a = () ; my $b = \@a ; my $c = \%a ;
561@a =~ /abc/ ;
562@a =~ s/a/b/ ;
563@a =~ tr/a/b/ ;
564@$b =~ /abc/ ;
565@$b =~ s/a/b/ ;
566@$b =~ tr/a/b/ ;
567%a =~ /abc/ ;
568%a =~ s/a/b/ ;
569%a =~ tr/a/b/ ;
570%$c =~ /abc/ ;
571%$c =~ s/a/b/ ;
572%$c =~ tr/a/b/ ;
0453d815 573{
574no warning 'unsafe' ;
575my $a ; my @a = () ; my %a = () ; my $b = \@a ; my $c = \%a ;
576@a =~ /abc/ ;
577@a =~ s/a/b/ ;
578@a =~ tr/a/b/ ;
579@$b =~ /abc/ ;
580@$b =~ s/a/b/ ;
581@$b =~ tr/a/b/ ;
582%a =~ /abc/ ;
583%a =~ s/a/b/ ;
584%a =~ tr/a/b/ ;
585%$c =~ /abc/ ;
586%$c =~ s/a/b/ ;
587%$c =~ tr/a/b/ ;
588}
599cee73 589EXPECT
f248d071 590Applying pattern match to @array will act on scalar(@array) at - line 5.
591Applying substitution to @array will act on scalar(@array) at - line 6.
592Can't modify private array in substitution at - line 6, near "s/a/b/ ;"
593Applying character translation to @array will act on scalar(@array) at - line 7.
594Applying pattern match to @array will act on scalar(@array) at - line 8.
595Applying substitution to @array will act on scalar(@array) at - line 9.
596Applying character translation to @array will act on scalar(@array) at - line 10.
597Applying pattern match to %hash will act on scalar(%hash) at - line 11.
598Applying substitution to %hash will act on scalar(%hash) at - line 12.
599Applying character translation to %hash will act on scalar(%hash) at - line 13.
600Applying pattern match to %hash will act on scalar(%hash) at - line 14.
601Applying substitution to %hash will act on scalar(%hash) at - line 15.
602Applying character translation to %hash will act on scalar(%hash) at - line 16.
603BEGIN not safe after errors--compilation aborted at - line 18.
599cee73 604########
605# op.c
606use warning 'syntax' ;
607my $a, $b = (1,2);
0453d815 608no warning 'syntax' ;
609my $c, $d = (1,2);
599cee73 610EXPECT
df5b6949 611Parentheses missing around "my" list at - line 3.
599cee73 612########
613# op.c
614use warning 'syntax' ;
615local $a, $b = (1,2);
0453d815 616no warning 'syntax' ;
617local $c, $d = (1,2);
599cee73 618EXPECT
df5b6949 619Parentheses missing around "local" list at - line 3.
599cee73 620########
621# op.c
622use warning 'syntax' ;
623print (ABC || 1) ;
0453d815 624no warning 'syntax' ;
625print (ABC || 1) ;
599cee73 626EXPECT
627Probable precedence problem on logical or at - line 3.
628########
629--FILE-- abc
630
631--FILE--
632# op.c
633use warning 'unsafe' ;
634open FH, "<abc" ;
635$x = 1 if $x = <FH> ;
0453d815 636no warning 'unsafe' ;
637$x = 1 if $x = <FH> ;
599cee73 638EXPECT
639Value of <HANDLE> construct can be "0"; test with defined() at - line 4.
640########
641# op.c
642use warning 'unsafe' ;
643opendir FH, "." ;
644$x = 1 if $x = readdir FH ;
0453d815 645no warning 'unsafe' ;
646$x = 1 if $x = readdir FH ;
599cee73 647closedir FH ;
648EXPECT
649Value of readdir() operator can be "0"; test with defined() at - line 4.
650########
651# op.c
652use warning 'unsafe' ;
653$x = 1 if $x = <*> ;
0453d815 654no warning 'unsafe' ;
655$x = 1 if $x = <*> ;
599cee73 656EXPECT
657Value of glob construct can be "0"; test with defined() at - line 3.
658########
659# op.c
660use warning 'unsafe' ;
661%a = (1,2,3,4) ;
662$x = 1 if $x = each %a ;
0453d815 663no warning 'unsafe' ;
664$x = 1 if $x = each %a ;
599cee73 665EXPECT
666Value of each() operator can be "0"; test with defined() at - line 4.
667########
668# op.c
669use warning 'unsafe' ;
670$x = 1 while $x = <*> and 0 ;
0453d815 671no warning 'unsafe' ;
672$x = 1 while $x = <*> and 0 ;
599cee73 673EXPECT
674Value of glob construct can be "0"; test with defined() at - line 3.
675########
676# op.c
677use warning 'unsafe' ;
678opendir FH, "." ;
679$x = 1 while $x = readdir FH and 0 ;
0453d815 680no warning 'unsafe' ;
681$x = 1 while $x = readdir FH and 0 ;
599cee73 682closedir FH ;
683EXPECT
684Value of readdir() operator can be "0"; test with defined() at - line 4.
685########
686# op.c
687use warning 'redefine' ;
688sub fred {}
689sub fred {}
0453d815 690no warning 'redefine' ;
691sub fred {}
599cee73 692EXPECT
693Subroutine fred redefined at - line 4.
694########
695# op.c
696use warning 'redefine' ;
697sub fred () { 1 }
698sub fred () { 1 }
0453d815 699no warning 'redefine' ;
700sub fred () { 1 }
599cee73 701EXPECT
702Constant subroutine fred redefined at - line 4.
703########
704# op.c
705use warning 'redefine' ;
706format FRED =
707.
708format FRED =
709.
0453d815 710no warning 'redefine' ;
711format FRED =
712.
599cee73 713EXPECT
714Format FRED redefined at - line 5.
715########
716# op.c
717use warning 'syntax' ;
718push FRED;
0453d815 719no warning 'syntax' ;
720push FRED;
599cee73 721EXPECT
722Array @FRED missing the @ in argument 1 of push() at - line 3.
723########
724# op.c
725use warning 'syntax' ;
726@a = keys FRED ;
0453d815 727no warning 'syntax' ;
728@a = keys FRED ;
599cee73 729EXPECT
730Hash %FRED missing the % in argument 1 of keys() at - line 3.
731########
732# op.c
733use warning 'syntax' ;
dfe13c55 734exec "$^X -e 1" ;
599cee73 735my $a
736EXPECT
737Statement unlikely to be reached at - line 4.
738(Maybe you meant system() when you said exec()?)
69794302 739########
740# op.c
741use warning 'deprecated' ;
742defined(@a);
743EXPECT
f10b0346 744defined(@array) is deprecated at - line 3.
69794302 745(Maybe you should just omit the defined()?)
746########
747# op.c
748use warning 'deprecated' ;
749my @a; defined(@a);
750EXPECT
f10b0346 751defined(@array) is deprecated at - line 3.
69794302 752(Maybe you should just omit the defined()?)
753########
754# op.c
755use warning 'deprecated' ;
756defined(@a = (1,2,3));
757EXPECT
f10b0346 758defined(@array) is deprecated at - line 3.
69794302 759(Maybe you should just omit the defined()?)
760########
761# op.c
762use warning 'deprecated' ;
763defined(%h);
764EXPECT
f10b0346 765defined(%hash) is deprecated at - line 3.
69794302 766(Maybe you should just omit the defined()?)
767########
768# op.c
769use warning 'deprecated' ;
770my %h; defined(%h);
771EXPECT
f10b0346 772defined(%hash) is deprecated at - line 3.
69794302 773(Maybe you should just omit the defined()?)
0453d815 774########
775# op.c
776no warning 'syntax' ;
777exec "$^X -e 1" ;
778my $a
779EXPECT
780
781########
782# op.c
783sub fred();
784sub fred($) {}
785EXPECT
786Prototype mismatch: sub main::fred () vs ($) at - line 3.
787########
788# op.c
789$^W = 0 ;
790sub fred() ;
791sub fred($) {}
792{
793 no warning 'unsafe' ;
794 sub Fred() ;
795 sub Fred($) {}
796 use warning 'unsafe' ;
797 sub freD() ;
798 sub freD($) {}
799}
800sub FRED() ;
801sub FRED($) {}
802EXPECT
803Prototype mismatch: sub main::fred () vs ($) at - line 4.
804Prototype mismatch: sub main::freD () vs ($) at - line 11.
805Prototype mismatch: sub main::FRED () vs ($) at - line 14.