![]() |
|
|||
0001 // SPDX-License-Identifier: (LGPL-2.1 OR BSD-2-Clause) 0002 0003 /* 0004 * BTF-to-C dumper tests for implicit and explicit padding between fields and 0005 * at the end of a struct. 0006 * 0007 * Copyright (c) 2019 Facebook 0008 */ 0009 /* ----- START-EXPECTED-OUTPUT ----- */ 0010 struct padded_implicitly { 0011 int a; 0012 long b; 0013 char c; 0014 }; 0015 0016 /* ------ END-EXPECTED-OUTPUT ------ */ 0017 0018 /* ----- START-EXPECTED-OUTPUT ----- */ 0019 /* 0020 *struct padded_explicitly { 0021 * int a; 0022 * int: 32; 0023 * int b; 0024 *}; 0025 * 0026 */ 0027 /* ------ END-EXPECTED-OUTPUT ------ */ 0028 0029 struct padded_explicitly { 0030 int a; 0031 int: 1; /* algo will explicitly pad with full 32 bits here */ 0032 int b; 0033 }; 0034 0035 /* ----- START-EXPECTED-OUTPUT ----- */ 0036 /* 0037 *struct padded_a_lot { 0038 * int a; 0039 * long: 32; 0040 * long: 64; 0041 * long: 64; 0042 * int b; 0043 *}; 0044 * 0045 */ 0046 /* ------ END-EXPECTED-OUTPUT ------ */ 0047 0048 struct padded_a_lot { 0049 int a; 0050 /* 32 bit of implicit padding here, which algo will make explicit */ 0051 long: 64; 0052 long: 64; 0053 int b; 0054 }; 0055 0056 /* ----- START-EXPECTED-OUTPUT ----- */ 0057 /* 0058 *struct padded_cache_line { 0059 * int a; 0060 * long: 32; 0061 * long: 64; 0062 * long: 64; 0063 * long: 64; 0064 * int b; 0065 * long: 32; 0066 * long: 64; 0067 * long: 64; 0068 * long: 64; 0069 *}; 0070 * 0071 */ 0072 /* ------ END-EXPECTED-OUTPUT ------ */ 0073 0074 struct padded_cache_line { 0075 int a; 0076 int b __attribute__((aligned(32))); 0077 }; 0078 0079 /* ----- START-EXPECTED-OUTPUT ----- */ 0080 /* 0081 *struct zone_padding { 0082 * char x[0]; 0083 *}; 0084 * 0085 *struct zone { 0086 * int a; 0087 * short b; 0088 * short: 16; 0089 * struct zone_padding __pad__; 0090 *}; 0091 * 0092 */ 0093 /* ------ END-EXPECTED-OUTPUT ------ */ 0094 0095 struct zone_padding { 0096 char x[0]; 0097 } __attribute__((__aligned__(8))); 0098 0099 struct zone { 0100 int a; 0101 short b; 0102 struct zone_padding __pad__; 0103 }; 0104 0105 int f(struct { 0106 struct padded_implicitly _1; 0107 struct padded_explicitly _2; 0108 struct padded_a_lot _3; 0109 struct padded_cache_line _4; 0110 struct zone _5; 0111 } *_) 0112 { 0113 return 0; 0114 }
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.1.0 LXR engine. The LXR team |
![]() ![]() |