gcc versions might have (parentheses) in them.
[p5sagit/p5-mst-13.2.git] / t / pragma / warn / pp_sys
CommitLineData
599cee73 1 pp_sys.c AOK
2
767a6a26 3 untie attempted while %d inner references still exist [pp_untie]
599cee73 4 sub TIESCALAR { bless [] } ; tie $a, 'main'; untie $a ;
5
767a6a26 6 Filehandle %s opened only for input [pp_leavewrite]
599cee73 7 format STDIN =
8 .
9 write STDIN;
10
9a7dcd9c 11 write() on closed filehandle %s [pp_leavewrite]
599cee73 12 format STDIN =
13 .
14 close STDIN;
15 write STDIN ;
16
767a6a26 17 page overflow [pp_leavewrite]
599cee73 18
767a6a26 19 Filehandle %s never opened [pp_prtf]
599cee73 20 $a = "abc"; printf $a "fred"
21
767a6a26 22 Filehandle %s opened only for input [pp_prtf]
599cee73 23 $a = "abc";
24 printf $a "fred"
25
9a7dcd9c 26 printf() on closed filehandle %s [pp_prtf]
599cee73 27 close STDIN ;
28 printf STDIN "fred"
29
69282e91 30 syswrite() on closed filehandle %s [pp_send]
599cee73 31 close STDIN;
32 syswrite STDIN, "fred", 1;
33
69282e91 34 send() on closed socket %s [pp_send]
599cee73 35 close STDIN;
36 send STDIN, "fred", 1
37
69282e91 38 bind() on closed socket %s [pp_bind]
599cee73 39 close STDIN;
40 bind STDIN, "fred" ;
41
42
69282e91 43 connect() on closed socket %s [pp_connect]
599cee73 44 close STDIN;
45 connect STDIN, "fred" ;
46
69282e91 47 listen() on closed socket %s [pp_listen]
599cee73 48 close STDIN;
49 listen STDIN, 2;
50
69282e91 51 accept() on closed socket %s [pp_accept]
599cee73 52 close STDIN;
69282e91 53 accept "fred", STDIN ;
599cee73 54
69282e91 55 shutdown() on closed socket %s [pp_shutdown]
599cee73 56 close STDIN;
57 shutdown STDIN, 0;
58
69282e91 59 setsockopt() on closed socket %s [pp_ssockopt]
60 getsockopt() on closed socket %s [pp_ssockopt]
599cee73 61 close STDIN;
62 setsockopt STDIN, 1,2,3;
63 getsockopt STDIN, 1,2;
64
69282e91 65 getsockname() on closed socket %s [pp_getpeername]
66 getpeername() on closed socket %s [pp_getpeername]
599cee73 67 close STDIN;
68 getsockname STDIN;
69 getpeername STDIN;
70
69282e91 71 flock() on closed socket %s [pp_flock]
72 close STDIN;
73 flock STDIN, 8;
74
9d837945 75 lstat() on filehandle %s [pp_stat]
76 lstat(STDIN);
77
767a6a26 78 warn(warn_nl, "stat"); [pp_stat]
599cee73 79
9ddeeac9 80 -T on unopened filehandle %s
81 stat() on unopened filehandle %s
599cee73 82 close STDIN ; -T STDIN ;
83
767a6a26 84 warn(warn_nl, "open"); [pp_fttext]
599cee73 85 -T "abc\ndef" ;
86
767a6a26 87 Filehandle %s opened only for output [pp_sysread]
88 my $file = "./xcv" ;
89 open(F, ">$file") ;
90 my $a = sysread(F, $a,10) ;
91
599cee73 92
93
94__END__
767a6a26 95# pp_sys.c [pp_untie]
4438c4b7 96use warnings 'untie' ;
599cee73 97sub TIESCALAR { bless [] } ;
98$b = tie $a, 'main';
99untie $a ;
4438c4b7 100no warnings 'untie' ;
0453d815 101$c = tie $d, 'main';
102untie $d ;
599cee73 103EXPECT
104untie attempted while 1 inner references still exist at - line 5.
105########
767a6a26 106# pp_sys.c [pp_leavewrite]
4438c4b7 107use warnings 'io' ;
599cee73 108format STDIN =
109.
110write STDIN;
4438c4b7 111no warnings 'io' ;
0453d815 112write STDIN;
599cee73 113EXPECT
43693395 114Filehandle STDIN opened only for input at - line 5.
599cee73 115########
767a6a26 116# pp_sys.c [pp_leavewrite]
4438c4b7 117use warnings 'closed' ;
599cee73 118format STDIN =
119.
120close STDIN;
121write STDIN;
69282e91 122opendir STDIN, ".";
123write STDIN;
124closedir STDIN;
4438c4b7 125no warnings 'closed' ;
0453d815 126write STDIN;
69282e91 127opendir STDIN, ".";
128write STDIN;
599cee73 129EXPECT
43693395 130write() on closed filehandle STDIN at - line 6.
131write() on closed filehandle STDIN at - line 8.
132 (Are you trying to call write() on dirhandle STDIN?)
599cee73 133########
767a6a26 134# pp_sys.c [pp_leavewrite]
4438c4b7 135use warnings 'io' ;
599cee73 136format STDOUT_TOP =
137abc
138.
139format STDOUT =
140def
141ghi
142.
143$= = 1 ;
144$- =1 ;
3eeba6fb 145open STDOUT, ">".($^O eq 'VMS'? 'NL:' : '/dev/null') ;
599cee73 146write ;
4438c4b7 147no warnings 'io' ;
0453d815 148write ;
599cee73 149EXPECT
150page overflow at - line 13.
151########
767a6a26 152# pp_sys.c [pp_prtf]
4438c4b7 153use warnings 'unopened' ;
599cee73 154$a = "abc";
0453d815 155printf $a "fred";
4438c4b7 156no warnings 'unopened' ;
0453d815 157printf $a "fred";
599cee73 158EXPECT
43693395 159Filehandle abc never opened at - line 4.
599cee73 160########
767a6a26 161# pp_sys.c [pp_prtf]
4438c4b7 162use warnings 'closed' ;
599cee73 163close STDIN ;
0453d815 164printf STDIN "fred";
69282e91 165opendir STDIN, ".";
166printf STDIN "fred";
167closedir STDIN;
4438c4b7 168no warnings 'closed' ;
0453d815 169printf STDIN "fred";
69282e91 170opendir STDIN, ".";
171printf STDIN "fred";
599cee73 172EXPECT
43693395 173printf() on closed filehandle STDIN at - line 4.
174printf() on closed filehandle STDIN at - line 6.
175 (Are you trying to call printf() on dirhandle STDIN?)
599cee73 176########
767a6a26 177# pp_sys.c [pp_prtf]
4438c4b7 178use warnings 'io' ;
0453d815 179printf STDIN "fred";
4438c4b7 180no warnings 'io' ;
0453d815 181printf STDIN "fred";
599cee73 182EXPECT
43693395 183Filehandle STDIN opened only for input at - line 3.
599cee73 184########
767a6a26 185# pp_sys.c [pp_send]
4438c4b7 186use warnings 'closed' ;
599cee73 187close STDIN;
188syswrite STDIN, "fred", 1;
69282e91 189opendir STDIN, ".";
190syswrite STDIN, "fred", 1;
191closedir STDIN;
4438c4b7 192no warnings 'closed' ;
0453d815 193syswrite STDIN, "fred", 1;
69282e91 194opendir STDIN, ".";
195syswrite STDIN, "fred", 1;
599cee73 196EXPECT
43693395 197syswrite() on closed filehandle STDIN at - line 4.
198syswrite() on closed filehandle STDIN at - line 6.
199 (Are you trying to call syswrite() on dirhandle STDIN?)
69282e91 200########
201# pp_sys.c [pp_flock]
f0963acb 202use Config;
203BEGIN {
204 if ( $^O eq 'VMS' and ! $Config{d_flock}) {
205 print <<EOM ;
206SKIPPED
207# flock not present
208EOM
209 exit ;
210 }
211}
69282e91 212use warnings 'closed' ;
213close STDIN;
214flock STDIN, 8;
215opendir STDIN, ".";
216flock STDIN, 8;
217no warnings 'closed' ;
218flock STDIN, 8;
219opendir STDIN, ".";
220flock STDIN, 8;
221EXPECT
43693395 222flock() on closed filehandle STDIN at - line 14.
223flock() on closed filehandle STDIN at - line 16.
224 (Are you trying to call flock() on dirhandle STDIN?)
599cee73 225########
767a6a26 226# pp_sys.c [pp_prtf pp_send pp_bind pp_connect pp_listen pp_accept pp_shutdown pp_ssockopt ppp_getpeername]
4438c4b7 227use warnings 'io' ;
599cee73 228use Config;
229BEGIN {
230 if ( $^O ne 'VMS' and ! $Config{d_socket}) {
231 print <<EOM ;
232SKIPPED
233# send not present
234# bind not present
235# connect not present
236# accept not present
237# shutdown not present
238# setsockopt not present
239# getsockopt not present
240# getsockname not present
241# getpeername not present
242EOM
243 exit ;
244 }
245}
246close STDIN;
247send STDIN, "fred", 1;
248bind STDIN, "fred" ;
249connect STDIN, "fred" ;
250listen STDIN, 2;
69282e91 251accept "fred", STDIN;
252shutdown STDIN, 0;
253setsockopt STDIN, 1,2,3;
254getsockopt STDIN, 1,2;
255getsockname STDIN;
256getpeername STDIN;
257opendir STDIN, ".";
258send STDIN, "fred", 1;
259bind STDIN, "fred" ;
260connect STDIN, "fred" ;
261listen STDIN, 2;
262accept "fred", STDIN;
599cee73 263shutdown STDIN, 0;
264setsockopt STDIN, 1,2,3;
265getsockopt STDIN, 1,2;
266getsockname STDIN;
267getpeername STDIN;
69282e91 268closedir STDIN;
4438c4b7 269no warnings 'io' ;
0453d815 270send STDIN, "fred", 1;
271bind STDIN, "fred" ;
272connect STDIN, "fred" ;
273listen STDIN, 2;
274accept STDIN, "fred" ;
275shutdown STDIN, 0;
276setsockopt STDIN, 1,2,3;
277getsockopt STDIN, 1,2;
278getsockname STDIN;
279getpeername STDIN;
69282e91 280opendir STDIN, ".";
281send STDIN, "fred", 1;
282bind STDIN, "fred" ;
283connect STDIN, "fred" ;
284listen STDIN, 2;
285accept "fred", STDIN;
286shutdown STDIN, 0;
287setsockopt STDIN, 1,2,3;
288getsockopt STDIN, 1,2;
289getsockname STDIN;
290getpeername STDIN;
599cee73 291EXPECT
43693395 292send() on closed socket STDIN at - line 22.
293bind() on closed socket STDIN at - line 23.
294connect() on closed socket STDIN at - line 24.
295listen() on closed socket STDIN at - line 25.
296accept() on closed socket STDIN at - line 26.
297shutdown() on closed socket STDIN at - line 27.
298setsockopt() on closed socket STDIN at - line 28.
299getsockopt() on closed socket STDIN at - line 29.
300getsockname() on closed socket STDIN at - line 30.
301getpeername() on closed socket STDIN at - line 31.
302send() on closed socket STDIN at - line 33.
303 (Are you trying to call send() on dirhandle STDIN?)
304bind() on closed socket STDIN at - line 34.
305 (Are you trying to call bind() on dirhandle STDIN?)
306connect() on closed socket STDIN at - line 35.
307 (Are you trying to call connect() on dirhandle STDIN?)
308listen() on closed socket STDIN at - line 36.
309 (Are you trying to call listen() on dirhandle STDIN?)
310accept() on closed socket STDIN at - line 37.
311 (Are you trying to call accept() on dirhandle STDIN?)
312shutdown() on closed socket STDIN at - line 38.
313 (Are you trying to call shutdown() on dirhandle STDIN?)
314setsockopt() on closed socket STDIN at - line 39.
315 (Are you trying to call setsockopt() on dirhandle STDIN?)
316getsockopt() on closed socket STDIN at - line 40.
317 (Are you trying to call getsockopt() on dirhandle STDIN?)
318getsockname() on closed socket STDIN at - line 41.
319 (Are you trying to call getsockname() on dirhandle STDIN?)
320getpeername() on closed socket STDIN at - line 42.
321 (Are you trying to call getpeername() on dirhandle STDIN?)
599cee73 322########
767a6a26 323# pp_sys.c [pp_stat]
4438c4b7 324use warnings 'newline' ;
599cee73 325stat "abc\ndef";
4438c4b7 326no warnings 'newline' ;
0453d815 327stat "abc\ndef";
599cee73 328EXPECT
329Unsuccessful stat on filename containing newline at - line 3.
330########
9d837945 331# pp_sys.c [pp_stat]
332use Config;
333BEGIN {
334 if ($^O eq 'd_lstat') {
335 print <<EOM ;
336SKIPPED
337# lstat not present
338EOM
339 exit ;
340 }
341}
342use warnings 'io' ;
343lstat(STDIN) ;
344no warnings 'io' ;
345lstat(STDIN) ;
346EXPECT
347lstat() on filehandle STDIN at - line 13.
348########
767a6a26 349# pp_sys.c [pp_fttext]
4438c4b7 350use warnings 'unopened' ;
599cee73 351close STDIN ;
352-T STDIN ;
9ddeeac9 353stat(STDIN) ;
4438c4b7 354no warnings 'unopened' ;
0453d815 355-T STDIN ;
9ddeeac9 356stat(STDIN);
599cee73 357EXPECT
9ddeeac9 358-T on unopened filehandle STDIN at - line 4.
359stat() on unopened filehandle STDIN at - line 5.
599cee73 360########
767a6a26 361# pp_sys.c [pp_fttext]
4438c4b7 362use warnings 'newline' ;
599cee73 363-T "abc\ndef" ;
4438c4b7 364no warnings 'newline' ;
0453d815 365-T "abc\ndef" ;
599cee73 366EXPECT
367Unsuccessful open on filename containing newline at - line 3.
767a6a26 368########
369# pp_sys.c [pp_sysread]
370use warnings 'io' ;
371my $file = "./xcv" ;
372open(F, ">$file") ;
373my $a = sysread(F, $a,10) ;
374no warnings 'io' ;
375my $a = sysread(F, $a,10) ;
376close F ;
377unlink $file ;
378EXPECT
43693395 379Filehandle F opened only for output at - line 5.