force_align was applied after struct size was set.

Change-Id: I9a35afac41f27dfdbc5e793c41ec768732cdc2a1
Tested: on Windows.
This commit is contained in:
Wouter van Oortmerssen
2014-06-23 11:34:19 -07:00
parent 58703a4f4c
commit 65cfa18855

View File

@@ -638,8 +638,6 @@ void Parser::ParseDecl() {
struct_def.attributes.Lookup("original_order") == nullptr && !fixed;
Expect('{');
while (token_ != '}') ParseField(struct_def);
struct_def.PadLastField(struct_def.minalign);
Expect('}');
auto force_align = struct_def.attributes.Lookup("force_align");
if (fixed && force_align) {
auto align = static_cast<size_t>(atoi(force_align->constant.c_str()));
@@ -651,6 +649,8 @@ void Parser::ParseDecl() {
"struct\'s natural alignment to 256");
struct_def.minalign = align;
}
struct_def.PadLastField(struct_def.minalign);
Expect('}');
}
bool Parser::SetRootType(const char *name) {