| 1 |
/* { dg-require-effective-target signal } */ |
| 2 |
#include <stdio.h> |
| 3 |
#include <signal.h> |
| 4 |
|
| 5 |
extern void body_of_program(void); |
| 6 |
|
| 7 |
/* Example of a non-static signal handler. */ |
| 8 |
|
| 9 |
void handler(int signum) |
| 10 |
{ |
| 11 |
fprintf(stderr, "LOG: %i", signum); /* { dg-warning "call to 'fprintf' from within signal handler" } */ |
| 12 |
} |
| 13 |
|
| 14 |
int main(int argc, const char *argv) |
| 15 |
{ |
| 16 |
signal(SIGINT, handler); /* { dg-message "registering 'handler' as signal handler" } */ |
| 17 |
|
| 18 |
body_of_program(); |
| 19 |
|
| 20 |
return 0; |
| 21 |
} |