| 1 |
/* Test BTF generation for enum-type bitfields |
| 2 |
|
| 3 |
It is allowed to have a bitfield type be an enum type. |
| 4 |
We expect the following types: |
| 5 |
|
| 6 |
[1] enum 'foo'(1U#B) size=4U#B |
| 7 |
'BAR' value=0 |
| 8 |
'BAZ' value=1 |
| 9 |
'QUZ' value=2 |
| 10 |
'QUX' value=3 |
| 11 |
[2] int 'unsigned int' size=4 offset=0 bits=32 |
| 12 |
[3] struct 'bitt' size=4 |
| 13 |
member 'f' type=1 bitfield_size=2 bit_offset=0 |
| 14 |
*/ |
| 15 |
|
| 16 |
/* { dg-do compile } */ |
| 17 |
/* { dg-options "-O0 -gbtf -gno-strict-dwarf -dA" } */ |
| 18 |
|
| 19 |
/* Enum with 4 members. */ |
| 20 |
/* { dg-final { scan-assembler-times "\[\t \]0x6000004\[\t \]+\[^\n\]*btt_info" 1 } } */ |
| 21 |
/* Struct with 1 bitfield member. */ |
| 22 |
/* { dg-final { scan-assembler-times "\[\t \]0x84000001\[\t \]+\[^\n\]*btt_info" 1 } } */ |
| 23 |
|
| 24 |
/* Bitfield "f" points to type ID 1. */ |
| 25 |
/* { dg-final { scan-assembler-times " btm_type: \\(BTF_KIND_ENUM 'foo'" 1 } } */ |
| 26 |
|
| 27 |
enum foo |
| 28 |
{ |
| 29 |
BAR = 0, |
| 30 |
BAZ = 1, |
| 31 |
QUZ = 2, |
| 32 |
QUX = 3 |
| 33 |
}; |
| 34 |
|
| 35 |
struct bitt |
| 36 |
{ |
| 37 |
enum foo f : 2; |
| 38 |
} bitty; |