Mercurial > hg > CbC > CbC_gcc
comparison gcc/testsuite/gcc.dg/analyzer/signal-exit.c @ 152:2b5abeee2509
update gcc11
author | anatofuz |
---|---|
date | Mon, 25 May 2020 07:50:57 +0900 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
145:1830386684a0 | 152:2b5abeee2509 |
---|---|
1 /* Example of a bad call within a signal handler with replacement | |
2 alternative. 'handler' calls 'exit', and 'exit' is not allowed | |
3 from a signal handler. But '_exit' is allowed. */ | |
4 | |
5 #include <signal.h> | |
6 #include <stdlib.h> | |
7 | |
8 extern void body_of_program(void); | |
9 | |
10 static void handler(int signum) | |
11 { | |
12 exit(1); /* { dg-warning "call to 'exit' from within signal handler" "warning" } */ | |
13 /* { dg-message "note: '_exit' is a possible signal-safe alternative for 'exit'" "replacement note" { target *-*-* } .-1 } */ | |
14 } | |
15 | |
16 int main(int argc, const char *argv) | |
17 { | |
18 signal(SIGINT, handler); /* { dg-message "registering 'handler' as signal handler" } */ | |
19 | |
20 body_of_program(); | |
21 | |
22 return 0; | |
23 } |