Debian Codegraph @

gcc/testsuite/gcc.dg/debug/btf/btf-prune-2.c

raw
1 /* Test that -gprune-btf does not chase pointer-to-struct members. */
2
3 /* { dg-do compile } */
4 /* { dg-options "-gbtf -gprune-btf -dA" } */
5
6 /* Only use of B is via a pointer member of C.
7 Full BTF for B is replaced with a forward. */
8 /* { dg-final { scan-assembler-not "BTF_KIND_STRUCT 'B'" } } */
9 /* { dg-final { scan-assembler-times "TYPE \[0-9\]+ BTF_KIND_FWD 'B'" 1 } } */
10
11 /* Detailed info for B is omitted, and A is otherwise unused. */
12 /* { dg-final { scan-assembler-not "BTF_KIND_\[A-Z\]+ 'A'" } } */
13
14 /* { dg-final { scan-assembler "BTF_KIND_STRUCT 'C'" } } */
15
16 struct A;
17
18 struct B {
19 int x;
20 int (*do_A_thing) (int, int);
21 struct A *other;
22 };
23
24 struct C {
25 unsigned int x;
26 struct B * a;
27 };
28
29 int
30 foo (struct C *c)
31 {
32 return c->x;
33 }