1 /* As per inlining-3.c, but testing how the ASCII art version of
2 the path looks. */
3
4 /* { dg-additional-options "-O2 -fdiagnostics-show-path-depths" } */
5 /* { dg-additional-options "-fdiagnostics-path-format=inline-events -fdiagnostics-show-caret" } */
6
7 typedef __SIZE_TYPE__ size_t;
8 #define NULL ((void *)0)
9
10 struct input_file_st
11 {
12 char inpname[1];
13 };
14
15 typedef struct input_file_st input_file;
16
17 static inline const char*
18 get_input_file_name (const input_file *inpf)
19 {
20 if (inpf)
21 return inpf->inpname;
22 return NULL;
23 }
24
25 size_t
26 test (const input_file *inpf)
27 {
28 const char *f = get_input_file_name (inpf);
29 return __builtin_strlen (f); /* { dg-warning "use of NULL" "warning" } */
30 }
31
32 /* { dg-begin-multiline-output "" }
33 return __builtin_strlen (f);
34 ^~~~~~~~~~~~~~~~~~~~
35 'test': events 1-2 (depth 1)
36 |
37 | test (const input_file *inpf)
38 | ^~~~
39 | |
40 | (1) entry to 'test'
41 |
42 | const char *f = get_input_file_name (inpf);
43 | ~
44 | |
45 | (2) inlined call to 'get_input_file_name' from 'test'
46 |
47 +--> 'get_input_file_name': event 3 (depth 2)
48 |
49 | if (inpf)
50 | ^
51 | |
52 | (3) following 'false' branch (when 'inpf' is NULL)...
53 |
54 <------+
55 |
56 'test': events 4-5 (depth 1)
57 |
58 | return __builtin_strlen (f);
59 | ^~~~~~~~~~~~~~~~~~~~
60 | |
61 | (4) ...to here
62 | (5) argument 1 ('<unknown>') NULL where non-null expected
63 |
64 { dg-end-multiline-output "" } */