xref: /openbsd-src/gnu/usr.bin/perl/t/lib/warnings/gv (revision 99fd087599a8791921855f21bd7e36130f39aadc)
1  gv.c AOK
2
3     Can't locate package %s for @%s::ISA
4	@ISA = qw(Fred); joe()
5
6     Name "main::a" used only once: possible typo
7
8  Mandatory Warnings ALL TODO
9  ------------------
10
11    Had to create %SVf unexpectedly		[gv_fetchpv]
12    Attempt to free unreferenced glob pointers	[gp_free]
13
14__END__
15# gv.c
16use warnings 'syntax' ;
17@ISA = qw(Fred); joe()
18EXPECT
19Can't locate package Fred for @main::ISA at - line 3.
20Undefined subroutine &main::joe called at - line 3.
21########
22# gv.c
23no warnings 'syntax' ;
24@ISA = qw(Fred); joe()
25EXPECT
26Undefined subroutine &main::joe called at - line 3.
27########
28# gv.c
29$a = ${^ENCODING};
30$a = ${^E_NCODING};
31${^E_NCODING} = 1; # We pretend this variable never existed.
32EXPECT
33########
34# gv.c
35use warnings 'syntax' ;
36use utf8;
37use open qw( :utf8 :std );
38package Y;
39@ISA = qw(Fred); joe()
40EXPECT
41Can't locate package Fred for @Y::ISA at - line 6.
42Undefined subroutine &Y::joe called at - line 6.
43########
44# gv.c
45use warnings;
46$x = 1;
47if ($x) {
48    print $y;
49}
50$a++; # These two should
51$b++; # be exempt.
52$Foo::a++;
53$Foo::b++;
54EXPECT
55Name "main::y" used only once: possible typo at - line 5.
56Use of uninitialized value $y in print at - line 5.
57########
58# gv.c
59use warnings;
60$x = 1;
61if ($x) {
62    $x++;
63    print $y;
64}
65EXPECT
66Name "main::y" used only once: possible typo at - line 6.
67Use of uninitialized value $y in print at - line 6.
68########
69# gv.c
70use warnings;
71$x = 0;
72if ($x) {
73    print "1\n";
74} elsif (!$x) {
75    print $y;
76} else {
77    print "0\n";
78}
79EXPECT
80Name "main::y" used only once: possible typo at - line 7.
81Use of uninitialized value $y in print at - line 7.
82########
83# gv.c
84use warnings;
85$x = 0;
86if ($x) {
87    print "1\n";
88} elsif (!$x) {
89    $x++;
90    print $y;
91} else {
92    print "0\n";
93}
94EXPECT
95Name "main::y" used only once: possible typo at - line 8.
96Use of uninitialized value $y in print at - line 8.
97########
98# gv.c
99use utf8;
100use open qw( :utf8 :std );
101use warnings;
102$ㄒ = 1;
103if ($ㄒ) {
104    print $ʎ;
105}
106EXPECT
107Name "main::ʎ" used only once: possible typo at - line 7.
108Use of uninitialized value $ʎ in print at - line 7.
109########
110# gv.c
111use utf8;
112use open qw( :utf8 :std );
113use warnings;
114$ㄒ = 1;
115if ($ㄒ) {
116    $ㄒ++;
117    print $ʎ;
118}
119EXPECT
120Name "main::ʎ" used only once: possible typo at - line 8.
121Use of uninitialized value $ʎ in print at - line 8.
122########
123# gv.c
124use utf8;
125use open qw( :utf8 :std );
126use warnings;
127$ㄒ = 0;
128if ($ㄒ) {
129    print "1\n";
130} elsif (!$ㄒ) {
131    print $ʎ;
132} else {
133    print "0\n";
134}
135EXPECT
136Name "main::ʎ" used only once: possible typo at - line 9.
137Use of uninitialized value $ʎ in print at - line 9.
138########
139# gv.c
140use utf8;
141use open qw( :utf8 :std );
142use warnings;
143$ㄒ = 0;
144if ($ㄒ) {
145    print "1\n";
146} elsif (!$ㄒ) {
147    $ㄒ++;
148    print $ʎ;
149} else {
150    print "0\n";
151}
152EXPECT
153Name "main::ʎ" used only once: possible typo at - line 10.
154Use of uninitialized value $ʎ in print at - line 10.
155########
156# gv.c
157use utf8;
158use open qw( :utf8 :std );
159use warnings;
160package 팣칵ぇ;
161$ㄒ = 1;
162if ($ㄒ) {
163    print $ʎ;
164}
165EXPECT
166Name "팣칵ぇ::ʎ" used only once: possible typo at - line 8.
167Use of uninitialized value $팣칵ぇ::ʎ in print at - line 8.
168########
169# gv.c
170use utf8;
171use open qw( :utf8 :std );
172use warnings;
173package 팣칵ぇ;
174$ㄒ = 1;
175if ($ㄒ) {
176    $ㄒ++;
177    print $ʎ;
178}
179EXPECT
180Name "팣칵ぇ::ʎ" used only once: possible typo at - line 9.
181Use of uninitialized value $팣칵ぇ::ʎ in print at - line 9.
182########
183# gv.c
184use utf8;
185use open qw( :utf8 :std );
186use warnings;
187package 팣칵ぇ;
188$ㄒ = 0;
189if ($ㄒ) {
190    print "1\n";
191} elsif (!$ㄒ) {
192    print $ʎ;
193} else {
194    print "0\n";
195}
196EXPECT
197Name "팣칵ぇ::ʎ" used only once: possible typo at - line 10.
198Use of uninitialized value $팣칵ぇ::ʎ in print at - line 10.
199########
200# gv.c
201use utf8;
202use open qw( :utf8 :std );
203use warnings;
204package 팣칵ぇ;
205$ㄒ = 0;
206if ($ㄒ) {
207    print "1\n";
208} elsif (!$ㄒ) {
209    $ㄒ++;
210    print $ʎ;
211} else {
212    print "0\n";
213}
214EXPECT
215Name "팣칵ぇ::ʎ" used only once: possible typo at - line 11.
216Use of uninitialized value $팣칵ぇ::ʎ in print at - line 11.
217