Debian Codegraph @

gcc/testsuite/c-c++-common/analyzer/inlining-3-multiline.c

raw
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 #include "../../gcc.dg/analyzer/analyzer-decls.h"
8 typedef __SIZE_TYPE__ size_t;
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 "" { target c } } */
65
66
67 /* { dg-begin-multiline-output "" }
68 return __builtin_strlen (f);
69 ~~~~~~~~~~~~~~~~~^~~
70 'size_t test(const input_file*)': events 1-2 (depth 1)
71 |
72 | test (const input_file *inpf)
73 | ^~~~
74 | |
75 | (1) entry to 'test'
76 |
77 | const char *f = get_input_file_name (inpf);
78 | ~
79 | |
80 | (2) inlined call to 'get_input_file_name' from 'test'
81 |
82 +--> 'const char* get_input_file_name(const input_file*)': event 3 (depth 2)
83 |
84 | if (inpf)
85 | ^~
86 | |
87 | (3) following 'false' branch (when 'inpf' is NULL)...
88 |
89 <------+
90 |
91 'size_t test(const input_file*)': events 4-5 (depth 1)
92 |
93 | return __builtin_strlen (f);
94 | ~~~~~~~~~~~~~~~~~^~~
95 | |
96 | (4) ...to here
97 | (5) argument 1 ('<unknown>') NULL where non-null expected
98 |
99 { dg-end-multiline-output "" { target c++ } } */