Debian Codegraph @

gcc/testsuite/c-c++-common/analyzer/file-meaning-1.c

raw
1 /* { dg-additional-options "-fanalyzer-verbose-state-changes" } */
2
3 typedef struct FILE FILE;
4 FILE* fopen (const char*, const char*);
5 int fclose (FILE*);
6
7 void test_1 (const char *path)
8 {
9 FILE *f = fopen (path, "r"); /* { dg-message "meaning: \\{verb: 'acquire', noun: 'resource'\\}" } */
10 if (!f)
11 return;
12
13 fclose (f); /* { dg-message "meaning: \\{verb: 'release', noun: 'resource'\\}" } */
14 fclose (f); /* { dg-warning "double 'fclose' of FILE 'f'" "warning" } */
15 }