Rename warning to warnings, from Paul Marquess.
[p5sagit/p5-mst-13.2.git] / t / pragma / warn / sv
CommitLineData
0453d815 1 sv.c
599cee73 2
3 warn(warn_uninit);
4
5 warn(warn_uninit);
6
7 warn(warn_uninit);
8
9 warn(warn_uninit);
10
11 not_a_number(sv);
12
13 not_a_number(sv);
14
15 warn(warn_uninit);
16
17 not_a_number(sv);
18
19 warn(warn_uninit);
20
21 not_a_number(sv);
22
23 not_a_number(sv);
24
25 warn(warn_uninit);
26
27 warn(warn_uninit);
28
29 Subroutine %s redefined
30
31 Invalid conversion in %s:
32
33 Undefined value assigned to typeglob
34
0453d815 35 Mandatory Warnings
36 ------------------
37 Malformed UTF-8 character [sv_pos_b2u]
38 my $a = rindex "a\xff bc ", "bc" ;
39
40 Mandatory Warnings TODO
41 ------------------
42 Attempt to free non-arena SV: 0x%lx [del_sv]
43 Reference miscount in sv_replace() [sv_replace]
44 Attempt to free unreferenced scalar [sv_free]
45 Attempt to free temp prematurely: SV 0x%lx [sv_free]
46 semi-panic: attempt to dup freed string [newSVsv]
47
599cee73 48
49__END__
50# sv.c
51use integer ;
4438c4b7 52use warnings 'uninitialized' ;
599cee73 53$x = 1 + $a[0] ; # a
4438c4b7 54no warnings 'uninitialized' ;
0453d815 55$x = 1 + $b[0] ; # a
599cee73 56EXPECT
57Use of uninitialized value at - line 4.
58########
59# sv.c (sv_2iv)
60package fred ;
61sub TIESCALAR { my $x ; bless \$x}
62sub FETCH { return undef }
63sub STORE { return 1 }
64package main ;
65tie $A, 'fred' ;
66use integer ;
4438c4b7 67use warnings 'uninitialized' ;
599cee73 68$A *= 2 ;
4438c4b7 69no warnings 'uninitialized' ;
0453d815 70$A *= 2 ;
599cee73 71EXPECT
72Use of uninitialized value at - line 10.
73########
74# sv.c
75use integer ;
4438c4b7 76use warnings 'uninitialized' ;
599cee73 77my $x *= 2 ; #b
4438c4b7 78no warnings 'uninitialized' ;
0453d815 79my $y *= 2 ; #b
599cee73 80EXPECT
81Use of uninitialized value at - line 4.
82########
83# sv.c (sv_2uv)
84package fred ;
85sub TIESCALAR { my $x ; bless \$x}
86sub FETCH { return undef }
87sub STORE { return 1 }
88package main ;
89tie $A, 'fred' ;
4438c4b7 90use warnings 'uninitialized' ;
599cee73 91$B = 0 ;
92$B |= $A ;
4438c4b7 93no warnings 'uninitialized' ;
0453d815 94$B = 0 ;
95$B |= $A ;
599cee73 96EXPECT
97Use of uninitialized value at - line 10.
98########
99# sv.c
4438c4b7 100use warnings 'uninitialized' ;
599cee73 101my $Y = 1 ;
0453d815 102my $x = 1 | $a[$Y] ;
4438c4b7 103no warnings 'uninitialized' ;
0453d815 104my $Y = 1 ;
105$x = 1 | $b[$Y] ;
599cee73 106EXPECT
107Use of uninitialized value at - line 4.
108########
109# sv.c
4438c4b7 110use warnings 'uninitialized' ;
599cee73 111my $x *= 1 ; # d
4438c4b7 112no warnings 'uninitialized' ;
0453d815 113my $y *= 1 ; # d
599cee73 114EXPECT
115Use of uninitialized value at - line 3.
116########
117# sv.c
4438c4b7 118use warnings 'uninitialized' ;
599cee73 119$x = 1 + $a[0] ; # e
4438c4b7 120no warnings 'uninitialized' ;
0453d815 121$x = 1 + $b[0] ; # e
599cee73 122EXPECT
123Use of uninitialized value at - line 3.
124########
125# sv.c (sv_2nv)
126package fred ;
127sub TIESCALAR { my $x ; bless \$x}
128sub FETCH { return undef }
129sub STORE { return 1 }
130package main ;
131tie $A, 'fred' ;
4438c4b7 132use warnings 'uninitialized' ;
599cee73 133$A *= 2 ;
4438c4b7 134no warnings 'uninitialized' ;
0453d815 135$A *= 2 ;
599cee73 136EXPECT
137Use of uninitialized value at - line 9.
138########
139# sv.c
4438c4b7 140use warnings 'uninitialized' ;
599cee73 141$x = $y + 1 ; # f
4438c4b7 142no warnings 'uninitialized' ;
0453d815 143$x = $z + 1 ; # f
599cee73 144EXPECT
145Use of uninitialized value at - line 3.
146########
147# sv.c
4438c4b7 148use warnings 'uninitialized' ;
599cee73 149$x = chop undef ; # g
4438c4b7 150no warnings 'uninitialized' ;
0453d815 151$x = chop undef ; # g
599cee73 152EXPECT
b0c98cec 153Modification of a read-only value attempted at - line 3.
599cee73 154########
155# sv.c
4438c4b7 156use warnings 'uninitialized' ;
599cee73 157$x = chop $y ; # h
4438c4b7 158no warnings 'uninitialized' ;
0453d815 159$x = chop $z ; # h
599cee73 160EXPECT
161Use of uninitialized value at - line 3.
162########
163# sv.c (sv_2pv)
164package fred ;
165sub TIESCALAR { my $x ; bless \$x}
166sub FETCH { return undef }
167sub STORE { return 1 }
168package main ;
169tie $A, 'fred' ;
4438c4b7 170use warnings 'uninitialized' ;
599cee73 171$B = "" ;
172$B .= $A ;
4438c4b7 173no warnings 'uninitialized' ;
0453d815 174$C = "" ;
175$C .= $A ;
599cee73 176EXPECT
177Use of uninitialized value at - line 10.
178########
179# sv.c
4438c4b7 180use warnings 'numeric' ;
599cee73 181sub TIESCALAR{bless[]} ;
182sub FETCH {"def"} ;
183tie $a,"main" ;
0453d815 184my $b = 1 + $a;
4438c4b7 185no warnings 'numeric' ;
0453d815 186my $c = 1 + $a;
599cee73 187EXPECT
188Argument "def" isn't numeric in add at - line 6.
189########
190# sv.c
4438c4b7 191use warnings 'numeric' ;
599cee73 192my $x = 1 + "def" ;
4438c4b7 193no warnings 'numeric' ;
0453d815 194my $z = 1 + "def" ;
599cee73 195EXPECT
196Argument "def" isn't numeric in add at - line 3.
197########
198# sv.c
4438c4b7 199use warnings 'numeric' ;
599cee73 200my $a = "def" ;
201my $x = 1 + $a ;
4438c4b7 202no warnings 'numeric' ;
0453d815 203my $y = 1 + $a ;
599cee73 204EXPECT
205Argument "def" isn't numeric in add at - line 4.
206########
207# sv.c
4438c4b7 208use warnings 'numeric' ; use integer ;
599cee73 209my $a = "def" ;
210my $x = 1 + $a ;
4438c4b7 211no warnings 'numeric' ;
0453d815 212my $z = 1 + $a ;
599cee73 213EXPECT
214Argument "def" isn't numeric in i_add at - line 4.
215########
216# sv.c
4438c4b7 217use warnings 'numeric' ;
599cee73 218my $x = 1 & "def" ;
4438c4b7 219no warnings 'numeric' ;
0453d815 220my $z = 1 & "def" ;
599cee73 221EXPECT
222Argument "def" isn't numeric in bit_and at - line 3.
223########
224# sv.c
4438c4b7 225use warnings 'redefine' ;
599cee73 226sub fred {}
227sub joe {}
228*fred = \&joe ;
4438c4b7 229no warnings 'redefine' ;
0453d815 230sub jim {}
231*jim = \&joe ;
599cee73 232EXPECT
233Subroutine fred redefined at - line 5.
234########
235# sv.c
4438c4b7 236use warnings 'printf' ;
3eeba6fb 237open F, ">".($^O eq 'VMS'? 'NL:' : '/dev/null') ;
cf2093f6 238printf F "%z\n" ;
239my $a = sprintf "%z" ;
599cee73 240printf F "%" ;
241$a = sprintf "%" ;
242printf F "%\x02" ;
243$a = sprintf "%\x02" ;
4438c4b7 244no warnings 'printf' ;
cf2093f6 245printf F "%z\n" ;
246$a = sprintf "%z" ;
0453d815 247printf F "%" ;
248$a = sprintf "%" ;
249printf F "%\x02" ;
250$a = sprintf "%\x02" ;
599cee73 251EXPECT
cf2093f6 252Invalid conversion in sprintf: "%z" at - line 5.
599cee73 253Invalid conversion in sprintf: end of string at - line 7.
254Invalid conversion in sprintf: "%\002" at - line 9.
cf2093f6 255Invalid conversion in printf: "%z" at - line 4.
599cee73 256Invalid conversion in printf: end of string at - line 6.
257Invalid conversion in printf: "%\002" at - line 8.
258########
259# sv.c
4438c4b7 260use warnings 'unsafe' ;
599cee73 261*a = undef ;
4438c4b7 262no warnings 'unsafe' ;
0453d815 263*b = undef ;
599cee73 264EXPECT
265Undefined value assigned to typeglob at - line 3.
0453d815 266########
267# sv.c
268use utf8 ;
269$^W =0 ;
270{
4438c4b7 271 use warnings 'utf8' ;
0453d815 272 my $a = rindex "a\xff bc ", "bc" ;
4438c4b7 273 no warnings 'utf8' ;
0453d815 274 $a = rindex "a\xff bc ", "bc" ;
275}
276my $a = rindex "a\xff bc ", "bc" ;
277EXPECT
278\xff will produce malformed UTF-8 character; use \x{ff} for that at - line 6.
279Malformed UTF-8 character at - line 6.
280Malformed UTF-8 character at - line 10.