]> gcc.gnu.org Git - gcc.git/blame - gcc/testsuite/c-c++-common/analyzer/fd-socket-meaning.c
testsuite: fix analyzer C++ failures on Solaris [PR111475]
[gcc.git] / gcc / testsuite / c-c++-common / analyzer / fd-socket-meaning.c
CommitLineData
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
13void 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
18void 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
23void 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'" } */
This page took 1.802231 seconds and 5 git commands to generate.