Skip several analyzer socket tests on hppa*-*-hpux*
[official-gcc.git] / gcc / testsuite / c-c++-common / analyzer / fopen-2.c
blob82087f2fe25a88ae7c6eb00e569a18f215a6e1ff
1 typedef struct FILE FILE;
2 FILE *fopen (const char *pathname, const char *mode);
3 #include "../../gcc.dg/analyzer/analyzer-decls.h"
5 FILE *
6 test_passthrough (const char *pathname, const char *mode)
8 return fopen (pathname, mode);
11 FILE *
12 test_null_pathname (const char *pathname, const char *mode)
14 return fopen (NULL, mode);
17 FILE *
18 test_null_mode (const char *pathname)
20 return fopen (pathname, NULL);
23 FILE *
24 test_simple_r (void)
26 return fopen ("foo.txt", "r");
29 FILE *
30 test_swapped_args (void)
32 return fopen ("r", "foo.txt"); /* TODO: would be nice to detect this. */
35 FILE *
36 test_uninitialized_pathname (const char *mode)
38 char buf[10];
39 return fopen (buf, mode); /* { dg-warning "use of uninitialized value 'buf\\\[0\\\]'" } */
40 /* { dg-message "while looking for null terminator for argument 1 \\('&buf'\\) of 'fopen'..." "event" { target c } .-1 } */
41 /* { dg-message "while looking for null terminator for argument 1 \\('& buf'\\) of 'FILE\\* fopen\\(const char\\*, const char\\*\\)'..." "event" { target c++ } .-2 } */
44 FILE *
45 test_uninitialized_mode (const char *filename)
47 char buf[10];
48 return fopen (filename, buf); /* { dg-warning "use of uninitialized value 'buf\\\[0\\\]'" } */
49 /* { dg-message "while looking for null terminator for argument 2 \\('&buf'\\) of 'fopen'..." "event" { target c } .-1 } */
50 /* { dg-message "while looking for null terminator for argument 2 \\('& buf'\\) of 'FILE\\* fopen\\(const char\\*, const char\\*\\)'..." "event" { target c++ } .-2 } */