WIP FPC-III support
[linux/fpc-iii.git] / tools / testing / selftests / bpf / progs / btf_dump_test_case_padding.c
blob35c512818a56b8928a4337208ae3ac28ea962d2d
1 // SPDX-License-Identifier: (LGPL-2.1 OR BSD-2-Clause)
3 /*
4 * BTF-to-C dumper tests for implicit and explicit padding between fields and
5 * at the end of a struct.
7 * Copyright (c) 2019 Facebook
8 */
9 /* ----- START-EXPECTED-OUTPUT ----- */
10 struct padded_implicitly {
11 int a;
12 long int b;
13 char c;
16 /* ------ END-EXPECTED-OUTPUT ------ */
18 /* ----- START-EXPECTED-OUTPUT ----- */
20 *struct padded_explicitly {
21 * int a;
22 * int: 32;
23 * int b;
24 *};
27 /* ------ END-EXPECTED-OUTPUT ------ */
29 struct padded_explicitly {
30 int a;
31 int: 1; /* algo will explicitly pad with full 32 bits here */
32 int b;
35 /* ----- START-EXPECTED-OUTPUT ----- */
37 *struct padded_a_lot {
38 * int a;
39 * long: 32;
40 * long: 64;
41 * long: 64;
42 * int b;
43 *};
46 /* ------ END-EXPECTED-OUTPUT ------ */
48 struct padded_a_lot {
49 int a;
50 /* 32 bit of implicit padding here, which algo will make explicit */
51 long: 64;
52 long: 64;
53 int b;
56 /* ----- START-EXPECTED-OUTPUT ----- */
58 *struct padded_cache_line {
59 * int a;
60 * long: 32;
61 * long: 64;
62 * long: 64;
63 * long: 64;
64 * int b;
65 * long: 32;
66 * long: 64;
67 * long: 64;
68 * long: 64;
69 *};
72 /* ------ END-EXPECTED-OUTPUT ------ */
74 struct padded_cache_line {
75 int a;
76 int b __attribute__((aligned(32)));
79 /* ----- START-EXPECTED-OUTPUT ----- */
81 *struct zone_padding {
82 * char x[0];
83 *};
85 *struct zone {
86 * int a;
87 * short b;
88 * short: 16;
89 * struct zone_padding __pad__;
90 *};
93 /* ------ END-EXPECTED-OUTPUT ------ */
95 struct zone_padding {
96 char x[0];
97 } __attribute__((__aligned__(8)));
99 struct zone {
100 int a;
101 short b;
102 struct zone_padding __pad__;
105 int f(struct {
106 struct padded_implicitly _1;
107 struct padded_explicitly _2;
108 struct padded_a_lot _3;
109 struct padded_cache_line _4;
110 struct zone _5;
111 } *_)
113 return 0;