On Fri, Sep 30, 2022 at 9:50 AM Eduard Zingerman <eddyz87@xxxxxxxxx> wrote: > > Verify that `bpftool btf dump file ... format c` correctly prints > newlines for structures that consist of anonymous-only padding fields. > > Signed-off-by: Eduard Zingerman <eddyz87@xxxxxxxxx> > --- > .../bpf/progs/btf_dump_test_case_padding.c | 16 ++++++++++++++++ > 1 file changed, 16 insertions(+) > > diff --git a/tools/testing/selftests/bpf/progs/btf_dump_test_case_padding.c b/tools/testing/selftests/bpf/progs/btf_dump_test_case_padding.c > index f2661c8d2d90..08e43ee38188 100644 > --- a/tools/testing/selftests/bpf/progs/btf_dump_test_case_padding.c > +++ b/tools/testing/selftests/bpf/progs/btf_dump_test_case_padding.c > @@ -102,12 +102,28 @@ struct zone { > struct zone_padding __pad__; > }; > > +/* ----- START-EXPECTED-OUTPUT ----- */ > +/* > + *struct padding_wo_named_members { > + * long: 64; > + * long: 64; > + *}; > + * > + */ > +/* ------ END-EXPECTED-OUTPUT ------ */ > + > +struct padding_wo_named_members { > + long: 64; > + long: 64; > +} __attribute__((aligned(8))); you don't really need aligned(8) attribute, if you drop it you can have a single copy of the struct (just like padded_implicitly above) > + > int f(struct { > struct padded_implicitly _1; > struct padded_explicitly _2; > struct padded_a_lot _3; > struct padded_cache_line _4; > struct zone _5; > + struct padding_wo_named_members _6; > } *_) > { > return 0; > -- > 2.37.3 >