]>
Commit | Line | Data |
---|---|---|
9fe9dd24 | 1 | /* { dg-require-effective-target sockets } */ |
5219414f DM |
2 | |
3 | /* Needed on some targets until we have exception-handling working (PR 111475). */ | |
4 | /* { dg-additional-options "-fno-exceptions" } */ | |
5 | ||
86a90006 DM |
6 | /* { dg-additional-options "-fanalyzer-verbose-state-changes" } */ |
7 | ||
8 | #include <sys/socket.h> | |
9 | #include <sys/un.h> | |
10 | #include <unistd.h> | |
11 | #include <errno.h> | |
12 | ||
13 | void test_leak_unchecked_stream_socket (void) | |
14 | { | |
15 | int fd = socket (AF_UNIX, SOCK_STREAM, 0); /* { dg-message "meaning: \\{verb: 'acquire', noun: 'resource'\\}" } */ | |
16 | } /* { dg-warning "leak of file descriptor 'fd'" } */ | |
17 | ||
18 | void test_leak_unchecked_datagram_socket (void) | |
19 | { | |
20 | int fd = socket (AF_UNIX, SOCK_DGRAM, 0); /* { dg-message "meaning: \\{verb: 'acquire', noun: 'resource'\\}" } */ | |
21 | } /* { dg-warning "leak of file descriptor 'fd'" } */ | |
22 | ||
23 | void test_leak_unchecked_socket (int type) | |
24 | { | |
25 | int fd = socket (AF_UNIX, type, 0); /* { dg-message "meaning: \\{verb: 'acquire', noun: 'resource'\\}" } */ | |
26 | } /* { dg-warning "leak of file descriptor 'fd'" } */ |