Loading...
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 | // SPDX-License-Identifier: (LGPL-2.1 OR BSD-2-Clause) /* * BTF-to-C dumper tests for implicit and explicit padding between fields and * at the end of a struct. * * Copyright (c) 2019 Facebook */ /* ----- START-EXPECTED-OUTPUT ----- */ struct padded_implicitly { int a; long int b; char c; }; /* ------ END-EXPECTED-OUTPUT ------ */ /* ----- START-EXPECTED-OUTPUT ----- */ /* *struct padded_explicitly { * int a; * int: 32; * int b; *}; * */ /* ------ END-EXPECTED-OUTPUT ------ */ struct padded_explicitly { int a; int: 1; /* algo will explicitly pad with full 32 bits here */ int b; }; /* ----- START-EXPECTED-OUTPUT ----- */ /* *struct padded_a_lot { * int a; * long: 32; * long: 64; * long: 64; * int b; *}; * */ /* ------ END-EXPECTED-OUTPUT ------ */ struct padded_a_lot { int a; /* 32 bit of implicit padding here, which algo will make explicit */ long: 64; long: 64; int b; }; /* ----- START-EXPECTED-OUTPUT ----- */ /* *struct padded_cache_line { * int a; * long: 32; * long: 64; * long: 64; * long: 64; * int b; * long: 32; * long: 64; * long: 64; * long: 64; *}; * */ /* ------ END-EXPECTED-OUTPUT ------ */ struct padded_cache_line { int a; int b __attribute__((aligned(32))); }; /* ----- START-EXPECTED-OUTPUT ----- */ /* *struct zone_padding { * char x[0]; *}; * *struct zone { * int a; * short b; * short: 16; * struct zone_padding __pad__; *}; * */ /* ------ END-EXPECTED-OUTPUT ------ */ struct zone_padding { char x[0]; } __attribute__((__aligned__(8))); struct zone { int a; short b; struct zone_padding __pad__; }; int f(struct { struct padded_implicitly _1; struct padded_explicitly _2; struct padded_a_lot _3; struct padded_cache_line _4; struct zone _5; } *_) { return 0; } |