1 // SPDX-License-Identifier: (LGPL-2.1 OR BSD-2-Clause)
4 * BTF-to-C dumper tests for bitfield.
6 * Copyright (c) 2019 Facebook
10 /* ----- START-EXPECTED-OUTPUT ----- */
12 *struct bitfields_only_mixed_types {
26 /* ------ END-EXPECTED-OUTPUT ------ */
28 struct bitfields_only_mixed_types
{
31 bool c
: 1; /* it's really a _Bool type */
33 A
, /* A = 0, dumper is very explicit */
37 /* 20-bit padding here */
38 unsigned f
: 30; /* this gets aligned on 4-byte boundary */
41 /* ----- START-EXPECTED-OUTPUT ----- */
43 *struct bitfield_mixed_with_others {
54 /* ------ END-EXPECTED-OUTPUT ------ */
55 struct bitfield_mixed_with_others
{
56 long: 4; /* char is enough as a backing field */
58 /* 8-bit implicit padding */
59 short b
; /* combined with previous bitfield */
60 /* 4 more bytes of implicit padding */
63 /* 24 bits implicit padding */
64 int e
; /* combined with previous bitfield */
66 /* 4 bytes of padding */
69 /* ----- START-EXPECTED-OUTPUT ----- */
71 *struct bitfield_flushed {
78 /* ------ END-EXPECTED-OUTPUT ------ */
79 struct bitfield_flushed
{
81 long: 0; /* flush until next natural alignment boundary */
86 struct bitfields_only_mixed_types _1
;
87 struct bitfield_mixed_with_others _2
;
88 struct bitfield_flushed _3
;