arm: fix typo in dg-require-effective-target [PR118089]
[official-gcc.git] / gcc / testsuite / gcc.dg / plugin / diagnostic-test-paths-4.c
blob847b6d423e40f032449e8ccbb91fe4deb09fb8e5
1 /* { dg-do compile } */
2 /* { dg-options "-fdiagnostics-path-format=inline-events -fdiagnostics-show-caret -fdiagnostics-show-line-numbers" } */
3 /* { dg-enable-nn-line-numbers "" } */
5 #include <stdio.h>
6 #include <signal.h>
7 #include <stdlib.h>
9 extern void body_of_program(void);
11 void custom_logger(const char *msg)
13 fprintf(stderr, "LOG: %s", msg); /* { dg-warning "call to 'fprintf' from within signal handler" } */
16 static void int_handler(int signum)
18 custom_logger("got signal");
21 static void register_handler ()
23 signal(SIGINT, int_handler);
26 void test (void)
28 register_handler ();
29 body_of_program();
32 /* { dg-begin-multiline-output "" }
33 NN | fprintf(stderr, "LOG: %s", msg);
34 | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
35 'test': events 1-2
37 | NN | {
38 | | ^
39 | | |
40 | | (1) entering 'test'
41 | NN | register_handler ();
42 | | ~~~~~~~~~~~~~~~~~~~
43 | | |
44 | | (2) calling 'register_handler'
46 +--> 'register_handler': events 3-4
48 | NN | {
49 | | ^
50 | | |
51 | | (3) entering 'register_handler'
52 | NN | signal(SIGINT, int_handler);
53 | | ~~~~~~~~~~~~~~~~~~~~~~~~~~~
54 | | |
55 | | (4) registering 'int_handler' as signal handler
57 event 5
59 |cc1:
60 | (5): later on, when the signal is delivered to the process
62 +--> 'int_handler': events 6-7
64 | NN | {
65 | | ^
66 | | |
67 | | (6) entering 'int_handler'
68 | NN | custom_logger("got signal");
69 | | ~~~~~~~~~~~~~~~~~~~~~~~~~~~
70 | | |
71 | | (7) calling 'custom_logger'
73 +--> 'custom_logger': events 8-9
75 | NN | {
76 | | ^
77 | | |
78 | | (8) entering 'custom_logger'
79 | NN | fprintf(stderr, "LOG: %s", msg);
80 | | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
81 | | |
82 | | (9) calling 'fprintf'
84 { dg-end-multiline-output "" } */