You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// Make sure that we don't recommend aligning an empty struct to zero bytes (PR#51620)
103
+
structStructWithNoFields {};
104
+
105
+
structContainsStructWithNoFields {
106
+
StructWithNoFields s;
107
+
};
108
+
109
+
// Make sure that an empty struct is treated like "char" for padding and alignment purposes
110
+
structContainsStructWithNoFields2 {
111
+
StructWithNoFields s;
112
+
double d;
113
+
StructWithNoFields t;
114
+
};
115
+
// CHECK-MESSAGES: :[[@LINE-5]]:8: warning: accessing fields in struct 'ContainsStructWithNoFields2' is inefficient due to padding; only needs 10 bytes but is using 24 bytes [altera-struct-pack-align]
116
+
// CHECK-MESSAGES: :[[@LINE-6]]:8: note: use "__attribute__((packed))" to reduce the amount of padding applied to struct 'ContainsStructWithNoFields2'
117
+
// CHECK-MESSAGES: :[[@LINE-7]]:8: warning: accessing fields in struct 'ContainsStructWithNoFields2' is inefficient due to poor alignment; currently aligned to 8 bytes, but recommended alignment is 16 bytes [altera-struct-pack-align]
118
+
// CHECK-MESSAGES: :[[@LINE-8]]:8: note: use "__attribute__((aligned(16)))" to align struct 'ContainsStructWithNoFields2' to 16 bytes
0 commit comments