arm: cleanup legacy ARM_PE code
[official-gcc.git] / gcc / testsuite / c-c++-common / analyzer / isatty-1.c
blobc5d376da498f4793906651a4ac15b51f03c13716
1 /* { dg-skip-if "" { powerpc*-*-aix* } } */
2 /* { dg-skip-if "" { "avr-*-*" } } */
4 #include <errno.h>
5 #include "../../gcc.dg/analyzer/analyzer-decls.h"
7 extern int isatty(int fd);
8 extern int close(int fd);
10 int test_pass_through (int fd)
12 return isatty (fd);
15 void test_merging (int fd)
17 isatty (fd);
18 __analyzer_dump_exploded_nodes (0); /* { dg-warning "1 processed enode" } */
21 int test_outcomes (int fd)
23 errno = 0;
24 int result = isatty (fd);
25 switch (result)
27 default:
28 __analyzer_dump_path (); /* { dg-bogus "path" } */
29 break;
30 case 0:
31 __analyzer_dump_path (); /* { dg-message "path" } */
32 __analyzer_eval (errno > 0); /* { dg-warning "TRUE" } */
33 break;
34 case 1:
35 __analyzer_dump_path (); /* { dg-message "path" } */
36 __analyzer_eval (errno == 0); /* { dg-warning "TRUE" } */
37 break;
39 return result;
42 int test_isatty_on_invalid_fd (void)
44 errno = 0;
45 int result = isatty (-1);
46 __analyzer_eval (result == 0); /* { dg-warning "TRUE" } */
47 __analyzer_eval (errno > 0); /* { dg-warning "TRUE" } */
48 return result;
51 int test_isatty_on_closed_fd (int fd)
53 close (fd);
54 errno = 0;
55 int result = isatty (fd);
56 __analyzer_eval (result == 0); /* { dg-warning "TRUE" } */
57 __analyzer_eval (errno > 0); /* { dg-warning "TRUE" } */
58 return result;