Debian Codegraph @

gcc/testsuite/gcc.dg/analyzer/event-links-ascii.c

raw
1 /* Verify that we print event links for the analyzer, using ASCII.
2 C only: we don't care about any C/C++ differences between source
3 locations here. */
4
5 /* { dg-additional-options "-fdiagnostics-path-format=inline-events" } */
6 /* { dg-additional-options "-fdiagnostics-show-line-numbers" } */
7 /* { dg-additional-options "-fdiagnostics-show-caret" } */
8 /* { dg-additional-options "-fdiagnostics-show-event-links" } */
9 /* { dg-enable-nn-line-numbers "" } */
10
11 void test (int flag_a, int val, void *p)
12 {
13 if (flag_a)
14 __builtin_free (p);
15 switch (val)
16 {
17 default:
18 break;
19 case 41:
20 break;
21 case 42:
22 __builtin_free (p); /* { dg-warning "double-'free' of 'p'" } */
23 break;
24 case 43:
25 break;
26 }
27 }
28
29 /* { dg-begin-multiline-output "" }
30 NN | __builtin_free (p);
31 | ^~~~~~~~~~~~~~~~~~
32 'test': events 1-6
33 NN | if (flag_a)
34 | ^
35 | |
36 | (1) following 'true' branch (when 'flag_a != 0')... ->-+
37 | |
38 | |
39 |+------------------------------------------------------------+
40 NN || __builtin_free (p);
41 || ~~~~~~~~~~~~~~~~~~
42 || |
43 |+--->(2) ...to here
44 | (3) first 'free' here
45 NN | switch (val)
46 | ~~~~~~
47 | |
48 | (4) following 'case 42:' branch... ->-+
49 | |
50 ......
51 | |
52 |+----------------------------------------+
53 NN || case 42:
54 || ~~~~
55 || |
56 |+--->(5) ...to here
57 NN | __builtin_free (p);
58 | ~~~~~~~~~~~~~~~~~~
59 | |
60 | (6) second 'free' here; first 'free' was at (3)
61 { dg-end-multiline-output "" } */