Debian Codegraph @

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

raw
1 /* PR111735. Test BTF generation for forward-declared enum.
2
3 The BTF representation for forward-declared enums is not formally
4 defined, but the de-facto representation used by various tools is
5 to encode them as a BTF_KIND_ENUM type with vlen=0 and size=0. */
6
7 /* { dg-do compile } */
8 /* { dg-options "-O0 -gbtf -dA" } */
9
10 enum Foo;
11 enum Foo *pfoo;
12
13 /* Check that there is one BTF_KIND_ENUM with vlen=0, and no BTF_KIND_FWD. */
14 /* { dg-final { scan-assembler-times "\[\t \]0x6000000\[\t \]+\[^\n\]*btt_info" 1 } } */
15 /* { dg-final { scan-assembler-times "\[\t \]0x7000000\[\t \]+\[^\n\]*btt_info" 0 } } */
16
17 /* Verify the reference to the enum-forward. */
18 /* { dg-final { scan-assembler-times "btt_type: \\(BTF_KIND_ENUM 'Foo'\\)" 1 } } */