Debian Codegraph @

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

raw
1 /* Verify that -fno-diagnostics-show-event-links works.
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 "-fno-diagnostics-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 NN | __builtin_free (p);
38 | ~~~~~~~~~~~~~~~~~~
39 | |
40 | (2) ...to here
41 | (3) first 'free' here
42 NN | switch (val)
43 | ~~~~~~
44 | |
45 | (4) following 'case 42:' branch...
46 ......
47 NN | case 42:
48 | ~~~~
49 | |
50 | (5) ...to here
51 NN | __builtin_free (p);
52 | ~~~~~~~~~~~~~~~~~~
53 | |
54 | (6) second 'free' here; first 'free' was at (3)
55 { dg-end-multiline-output "" } */