blob: c5d376da498f4793906651a4ac15b51f03c13716 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
|
/* { dg-skip-if "" { powerpc*-*-aix* } } */
/* { dg-skip-if "" { "avr-*-*" } } */
#include <errno.h>
#include "../../gcc.dg/analyzer/analyzer-decls.h"
extern int isatty(int fd);
extern int close(int fd);
int test_pass_through (int fd)
{
return isatty (fd);
}
void test_merging (int fd)
{
isatty (fd);
__analyzer_dump_exploded_nodes (0); /* { dg-warning "1 processed enode" } */
}
int test_outcomes (int fd)
{
errno = 0;
int result = isatty (fd);
switch (result)
{
default:
__analyzer_dump_path (); /* { dg-bogus "path" } */
break;
case 0:
__analyzer_dump_path (); /* { dg-message "path" } */
__analyzer_eval (errno > 0); /* { dg-warning "TRUE" } */
break;
case 1:
__analyzer_dump_path (); /* { dg-message "path" } */
__analyzer_eval (errno == 0); /* { dg-warning "TRUE" } */
break;
}
return result;
}
int test_isatty_on_invalid_fd (void)
{
errno = 0;
int result = isatty (-1);
__analyzer_eval (result == 0); /* { dg-warning "TRUE" } */
__analyzer_eval (errno > 0); /* { dg-warning "TRUE" } */
return result;
}
int test_isatty_on_closed_fd (int fd)
{
close (fd);
errno = 0;
int result = isatty (fd);
__analyzer_eval (result == 0); /* { dg-warning "TRUE" } */
__analyzer_eval (errno > 0); /* { dg-warning "TRUE" } */
return result;
}
|