Lines Matching defs:F
18 FILE *F = fopen("file", "r");
19 if (!F)
21 clang_analyzer_eval(feof(F)); // expected-warning {{FALSE}}
22 clang_analyzer_eval(ferror(F)); // expected-warning {{FALSE}}
23 fclose(F);
27 FILE *F = fdopen(fd, "r");
28 if (!F)
30 clang_analyzer_eval(feof(F)); // expected-warning {{FALSE}}
31 clang_analyzer_eval(ferror(F)); // expected-warning {{FALSE}}
32 fclose(F);
36 FILE *F = fopen("file", "r");
37 if (!F)
39 F = freopen(0, "w", F);
40 if (!F)
42 clang_analyzer_eval(feof(F)); // expected-warning {{FALSE}}
43 clang_analyzer_eval(ferror(F)); // expected-warning {{FALSE}}
44 fclose(F);
48 FILE *F = fopen("file", "r");
49 if (!F)
51 StreamTesterChecker_make_feof_stream(F);
52 clang_analyzer_eval(feof(F)); // expected-warning {{TRUE}}
53 clang_analyzer_eval(ferror(F)); // expected-warning {{FALSE}}
54 clearerr(F);
55 clang_analyzer_eval(feof(F)); // expected-warning {{FALSE}}
56 clang_analyzer_eval(ferror(F)); // expected-warning {{FALSE}}
57 StreamTesterChecker_make_ferror_indeterminate_stream(F);
58 clang_analyzer_eval(feof(F)); // expected-warning {{FALSE}}
59 fclose(F);
63 FILE *F = fopen("file", "r");
64 if (!F)
66 StreamTesterChecker_make_ferror_stream(F);
67 clang_analyzer_eval(feof(F)); // expected-warning {{FALSE}}
68 clang_analyzer_eval(ferror(F)); // expected-warning {{TRUE}}
69 clearerr(F);
70 clang_analyzer_eval(feof(F)); // expected-warning {{FALSE}}
71 clang_analyzer_eval(ferror(F)); // expected-warning {{FALSE}}
72 StreamTesterChecker_make_ferror_indeterminate_stream(F);
73 clang_analyzer_eval(ferror(F)); // expected-warning {{TRUE}}
74 fclose(F);
78 FILE *F = tmpfile();
79 if (!F)
82 int Ret = fread(Buf, 1, 10, F);
84 clang_analyzer_eval(feof(F) || ferror(F)); // expected-warning {{FALSE}}
86 clang_analyzer_eval(feof(F) || ferror(F)); // expected-warning {{TRUE}}
87 if (feof(F)) {
89 fread(Buf, 1, 10, F); // expected-warning {{Read function called when stream is in EOF state}}
90 clang_analyzer_eval(feof(F)); // expected-warning {{TRUE}}
91 clang_analyzer_eval(ferror(F)); // expected-warning {{FALSE}}
93 if (ferror(F)) {
95 fread(Buf, 1, 10, F); // expected-warning {{might be 'indeterminate'}}
98 fclose(F);
99 Ret = fread(Buf, 1, 10, F); // expected-warning {{Use of a stream that might be already closed}}
103 FILE *F = tmpfile();
104 if (!F)
107 int Ret = fwrite(Buf, 1, 10, F);
109 clang_analyzer_eval(feof(F) || ferror(F)); // expected-warning {{FALSE}}
111 clang_analyzer_eval(feof(F)); // expected-warning {{FALSE}}
112 clang_analyzer_eval(ferror(F)); // expected-warning {{TRUE}}
113 fwrite(0, 1, 10, F); // expected-warning {{might be 'indeterminate'}}
115 fclose(F);
116 Ret = fwrite(0, 1, 10, F); // expected-warning {{Use of a stream that might be already closed}}
120 FILE *F = tmpfile();
121 if (!F)
123 int Ret = fgetc(F);
125 clang_analyzer_eval(feof(F) || ferror(F)); // expected-warning {{FALSE}}
128 clang_analyzer_eval(feof(F) || ferror(F)); // expected-warning {{TRUE}}
129 if (feof(F)) {
130 clang_analyzer_eval(ferror(F)); // expected-warning {{FALSE}}
131 fgetc(F); // expected-warning {{Read function called when stream is in EOF state}}
133 clang_analyzer_eval(ferror(F)); // expected-warning {{TRUE}}
134 fgetc(F); // expected-warning {{might be 'indeterminate'}}
137 fclose(F);
138 fgetc(F); // expected-warning {{Use of a stream that might be already closed}}
142 FILE *F = tmpfile();
144 if (!F)
146 char *Ret = fgets(Buf, sizeof(Buf), F);
148 clang_analyzer_eval(feof(F) || ferror(F)); // expected-warning {{FALSE}}
151 clang_analyzer_eval(feof(F) || ferror(F)); // expected-warning {{TRUE}}
152 if (feof(F)) {
153 clang_analyzer_eval(ferror(F)); // expected-warning {{FALSE}}
154 fgets(Buf, sizeof(Buf), F); // expected-warning {{Read function called when stream is in EOF state}}
156 clang_analyzer_eval(ferror(F)); // expected-warning {{TRUE}}
157 fgets(Buf, sizeof(Buf), F); // expected-warning {{might be 'indeterminate'}}
160 fclose(F);
161 fgets(Buf, sizeof(Buf), F); // expected-warning {{Use of a stream that might be already closed}}
165 FILE *F = fdopen(fd, "w");
166 if (!F)
168 int Ret = fputc('X', F);
170 clang_analyzer_eval(ferror(F)); // expected-warning {{TRUE}}
171 clang_analyzer_eval(feof(F)); // expected-warning {{FALSE}}
172 fputc('Y', F); // expected-warning {{might be 'indeterminate'}}
175 clang_analyzer_eval(feof(F) || ferror(F)); // expected-warning {{FALSE}}
176 fputc('Y', F); // no-warning
178 fclose(F);
179 fputc('A', F); // expected-warning {{Use of a stream that might be already closed}}
183 FILE *F = tmpfile();
184 if (!F)
186 int Ret = fputs("XYZ", F);
188 clang_analyzer_eval(feof(F) || ferror(F)); // expected-warning {{FALSE}}
189 fputs("QWD", F); // no-warning
192 clang_analyzer_eval(ferror(F)); // expected-warning {{TRUE}}
193 clang_analyzer_eval(feof(F)); // expected-warning {{FALSE}}
194 fputs("QWD", F); // expected-warning {{might be 'indeterminate'}}
196 fclose(F);
197 fputs("ABC", F); // expected-warning {{Use of a stream that might be already closed}}
201 FILE *F = tmpfile();
202 if (!F)
204 int Ret = fprintf(F, "aaa");
206 clang_analyzer_eval(feof(F) || ferror(F)); // expected-warning {{FALSE}}
207 fprintf(F, "bbb"); // no-warning
209 clang_analyzer_eval(ferror(F)); // expected-warning {{TRUE}}
210 clang_analyzer_eval(feof(F)); // expected-warning {{FALSE}}
211 fprintf(F, "bbb"); // expected-warning {{might be 'indeterminate'}}
213 fclose(F);
214 fprintf(F, "ccc"); // expected-warning {{Use of a stream that might be already closed}}
218 FILE *F = tmpfile();
219 if (!F)
221 int Ret = fscanf(F, "a%ib", A);
223 clang_analyzer_eval(feof(F) || ferror(F)); // expected-warning {{FALSE}}
224 fscanf(F, "bbb"); // no-warning
226 if (ferror(F)) {
228 fscanf(F, "bbb"); // expected-warning {{might be 'indeterminate'}}
229 } else if (feof(F)) {
231 fscanf(F, "bbb"); // expected-warning {{is in EOF state}}
232 clang_analyzer_eval(feof(F)); // expected-warning {{TRUE}}
235 fscanf(F, "bbb"); // expected-warning {{might be 'indeterminate'}}
238 fclose(F);
239 fscanf(F, "ccc"); // expected-warning {{Use of a stream that might be already closed}}
243 FILE *F = tmpfile();
244 if (!F)
246 int Ret = ungetc('X', F);
247 clang_analyzer_eval(feof(F) || ferror(F)); // expected-warning {{FALSE}}
253 fputc('Y', F); // no-warning
255 StreamTesterChecker_make_ferror_indeterminate_stream(F);
256 ungetc('X', F); // expected-warning {{might be 'indeterminate'}}
258 fclose(F);
259 ungetc('A', F); // expected-warning {{Use of a stream that might be already closed}}
263 FILE *F = tmpfile();
264 if (!F)
266 ssize_t Ret = getdelim(&P, &Sz, '\t', F);
268 clang_analyzer_eval(feof(F) || ferror(F)); // expected-warning {{FALSE}}
271 clang_analyzer_eval(feof(F) || ferror(F)); // expected-warning {{TRUE}}
272 if (feof(F)) {
273 clang_analyzer_eval(ferror(F)); // expected-warning {{FALSE}}
274 getdelim(&P, &Sz, '\n', F); // expected-warning {{Read function called when stream is in EOF state}}
276 clang_analyzer_eval(ferror(F)); // expected-warning {{TRUE}}
277 getdelim(&P, &Sz, '\n', F); // expected-warning {{might be 'indeterminate'}}
280 fclose(F);
281 getdelim(&P, &Sz, '\n', F); // expected-warning {{Use of a stream that might be already closed}}
285 FILE *F = tmpfile();
286 if (!F)
288 ssize_t Ret = getline(&P, &Sz, F);
290 clang_analyzer_eval(feof(F) || ferror(F)); // expected-warning {{FALSE}}
293 clang_analyzer_eval(feof(F) || ferror(F)); // expected-warning {{TRUE}}
294 if (feof(F)) {
295 clang_analyzer_eval(ferror(F)); // expected-warning {{FALSE}}
296 getline(&P, &Sz, F); // expected-warning {{Read function called when stream is in EOF state}}
298 clang_analyzer_eval(ferror(F)); // expected-warning {{TRUE}}
299 getline(&P, &Sz, F); // expected-warning {{might be 'indeterminate'}}
302 fclose(F);
303 getline(&P, &Sz, F); // expected-warning {{Use of a stream that might be already closed}}
307 FILE *F = tmpfile();
308 if (!F)
310 StreamTesterChecker_make_feof_stream(F);
311 if (fputs("QWD", F) >= 0) // no-warning
312 clang_analyzer_eval(feof(F) || ferror(F)); // expected-warning {{FALSE}}
313 StreamTesterChecker_make_feof_stream(F);
314 if (fputc('Q', F) == 'Q') // no-warning
315 clang_analyzer_eval(feof(F) || ferror(F)); // expected-warning {{FALSE}}
316 StreamTesterChecker_make_feof_stream(F);
317 if (fwrite("012345678", 1, 10, F) == 10) // no-warning
318 clang_analyzer_eval(feof(F) || ferror(F)); // expected-warning {{FALSE}}
319 fclose(F);
322 void freadwrite_zerosize(FILE *F) {
324 Ret = fwrite(0, 1, 0, F);
326 Ret = fwrite(0, 0, 1, F);
328 Ret = fread(0, 1, 0, F);
330 Ret = fread(0, 0, 1, F);
334 void freadwrite_zerosize_eofstate(FILE *F) {
335 fwrite(0, 1, 0, F);
336 fwrite(0, 0, 1, F);
337 fread(0, 1, 0, F); // expected-warning {{Read function called when stream is in EOF state}}
338 fread(0, 0, 1, F); // expected-warning {{Read function called when stream is in EOF state}}
342 FILE *F = fopen("file", "r");
343 if (!F)
346 freadwrite_zerosize(F);
347 clang_analyzer_eval(feof(F)); // expected-warning {{FALSE}}
348 clang_analyzer_eval(ferror(F)); // expected-warning {{FALSE}}
350 StreamTesterChecker_make_ferror_stream(F);
351 freadwrite_zerosize(F);
352 clang_analyzer_eval(feof(F)); // expected-warning {{FALSE}}
353 clang_analyzer_eval(ferror(F)); // expected-warning {{TRUE}}
355 StreamTesterChecker_make_feof_stream(F);
356 freadwrite_zerosize_eofstate(F);
357 clang_analyzer_eval(feof(F)); // expected-warning {{TRUE}}
358 clang_analyzer_eval(ferror(F)); // expected-warning {{FALSE}}
360 fclose(F);
364 FILE *F = fopen("file", "r");
365 if (!F)
367 int rc = fseek(F, 1, SEEK_SET);
370 int IsFEof = feof(F), IsFError = ferror(F);
376 clang_analyzer_eval(feof(F)); // expected-warning {{FALSE}}
378 clang_analyzer_eval(ferror(F)); // expected-warning {{TRUE}}
380 clang_analyzer_eval(feof(F)); // expected-warning {{FALSE}}
381 clang_analyzer_eval(ferror(F)); // expected-warning {{FALSE}}
383 clang_analyzer_eval(feof(F)); // expected-warning {{FALSE}}
384 clang_analyzer_eval(ferror(F)); // expected-warning {{FALSE}}
386 fclose(F);
390 FILE *F = fopen("file", "r");
391 if (!F)
393 int rc = fseeko(F, 1, SEEK_SET);
396 clang_analyzer_eval(ferror(F)); // expected-warning {{FALSE}} \
398 clang_analyzer_eval(feof(F)); // expected-warning {{FALSE}}
400 clang_analyzer_eval(feof(F)); // expected-warning {{FALSE}}
401 clang_analyzer_eval(ferror(F)); // expected-warning {{FALSE}}
403 fclose(F);
407 FILE *F = fopen("file", "r");
408 if (!F)
410 int rc = fseek(F, 0, SEEK_SET);
412 int IsFEof = feof(F), IsFError = ferror(F);
420 clang_analyzer_eval(feof(F)); // expected-warning {{FALSE}}
422 clang_analyzer_eval(ferror(F)); // expected-warning {{TRUE}}
424 clang_analyzer_eval(ferror(F)); // expected-warning {{FALSE}}
426 clang_analyzer_eval(feof(F)); // expected-warning {{FALSE}}
427 clang_analyzer_eval(ferror(F)); // expected-warning {{FALSE}}
429 clang_analyzer_eval(feof(F)); // expected-warning {{FALSE}}
430 clang_analyzer_eval(ferror(F)); // expected-warning {{FALSE}}
432 fclose(F);
436 FILE *F = fopen("file", "r");
437 if (!F)
439 int rc = fseeko(F, 0, SEEK_SET);
441 int IsFEof = feof(F), IsFError = ferror(F);
449 clang_analyzer_eval(feof(F)); // expected-warning {{FALSE}}
450 clang_analyzer_eval(ferror(F)); // expected-warning {{FALSE}}
452 fclose(F);
456 FILE *F = fopen("file", "r");
457 if (!F)
459 long rc = ftell(F);
464 clang_analyzer_eval(feof(F) && ferror(F)); // expected-warning {{FALSE}}
465 StreamTesterChecker_make_feof_stream(F);
466 rc = ftell(F);
467 clang_analyzer_eval(feof(F)); // expected-warning {{TRUE}}
468 clang_analyzer_eval(ferror(F)); // expected-warning {{FALSE}}
469 StreamTesterChecker_make_ferror_stream(F);
470 rc = ftell(F);
471 clang_analyzer_eval(feof(F)); // expected-warning {{FALSE}}
472 clang_analyzer_eval(ferror(F)); // expected-warning {{TRUE}}
474 StreamTesterChecker_make_ferror_indeterminate_stream(F);
475 ftell(F); // expected-warning {{might be 'indeterminate'}}
477 fclose(F);
481 FILE *F = fopen("file", "r");
482 if (!F)
484 off_t rc = ftello(F);
489 clang_analyzer_eval(feof(F) && ferror(F)); // expected-warning {{FALSE}}
490 StreamTesterChecker_make_feof_stream(F);
491 rc = ftello(F);
492 clang_analyzer_eval(feof(F)); // expected-warning {{TRUE}}
493 clang_analyzer_eval(ferror(F)); // expected-warning {{FALSE}}
494 StreamTesterChecker_make_ferror_stream(F);
495 rc = ftello(F);
496 clang_analyzer_eval(feof(F)); // expected-warning {{FALSE}}
497 clang_analyzer_eval(ferror(F)); // expected-warning {{TRUE}}
499 StreamTesterChecker_make_ferror_indeterminate_stream(F);
500 ftell(F); // expected-warning {{might be 'indeterminate'}}
502 fclose(F);
506 FILE *F = fopen("file", "r");
507 if (!F)
509 int N = fileno(F);
511 clang_analyzer_eval(feof(F) && ferror(F)); // expected-warning {{FALSE}}
512 StreamTesterChecker_make_feof_stream(F);
513 N = fileno(F);
514 clang_analyzer_eval(feof(F)); // expected-warning {{TRUE}}
515 clang_analyzer_eval(ferror(F)); // expected-warning {{FALSE}}
516 StreamTesterChecker_make_ferror_stream(F);
517 N = fileno(F);
518 clang_analyzer_eval(feof(F)); // expected-warning {{FALSE}}
519 clang_analyzer_eval(ferror(F)); // expected-warning {{TRUE}}
520 StreamTesterChecker_make_ferror_indeterminate_stream(F);
521 fileno(F); // no warning
522 fclose(F);
567 FILE *F = fopen("file", "r+");
568 if (!F)
571 int rc = fseek(F, 0, SEEK_SET);
573 if (feof(F)) {
574 fwrite(Buf, 1, 10, F); // no warning
575 } else if (ferror(F)) {
576 fwrite(Buf, 1, 10, F); // expected-warning {{might be 'indeterminate'}}
578 fwrite(Buf, 1, 10, F); // expected-warning {{might be 'indeterminate'}}
581 fclose(F);
585 FILE *F = fopen("file", "r+");
586 if (!F)
589 int rc = fseek(F, 0, SEEK_SET);
591 if (feof(F)) {
592 clearerr(F);
593 fwrite(Buf, 1, 10, F); // no warning
594 } else if (ferror(F)) {
595 clearerr(F);
596 fwrite(Buf, 1, 10, F); // expected-warning {{might be 'indeterminate'}}
598 clearerr(F);
599 fwrite(Buf, 1, 10, F); // expected-warning {{might be 'indeterminate'}}
602 fclose(F);
606 FILE *F = fopen("file", "r+");
607 if (!F)
610 if (fread(Buf, 1, 10, F) < 10) {
611 if (feof(F)) {
613 fwrite("1", 1, 1, F); // no warning
616 fclose(F);
620 FILE *F = fopen("file", "r+");
621 if (!F)
624 if (fread(Buf, 1, 10, F) < 10) {
625 if (ferror(F) == 0) {
627 fwrite("1", 1, 1, F); // no warning
630 fclose(F);