Debian Codegraph @

gcc/testsuite/c-c++-common/analyzer/analyzer-verbosity-2a.c

raw
1 /* { dg-additional-options "-fanalyzer-verbosity=2" } */
2
3 typedef struct FILE FILE;
4
5 FILE* fopen (const char*, const char*);
6 int fclose (FILE*);
7
8 extern int foo ();
9 extern void bar ();
10
11 void test (const char *path, int flag)
12 {
13 FILE *fp = fopen (path, "r"); /* { dg-message "opened here" } */
14
15 /* We shouldn't report this control flow at -fanalyzer-verbosity=2. */
16 if (foo ()) /* { dg-bogus "" } */
17 bar ();
18 else
19 bar ();
20
21 if (flag) /* { dg-message "when 'flag == 0'" } */
22 fclose (fp);
23 } /* { dg-warning "leak of FILE 'fp'" } */