mirror of
https://github.com/google/flatbuffers.git
synced 2026-06-27 20:58:05 +00:00
force_align was applied after struct size was set.
Change-Id: I9a35afac41f27dfdbc5e793c41ec768732cdc2a1 Tested: on Windows.
This commit is contained in:
@@ -638,8 +638,6 @@ void Parser::ParseDecl() {
|
|||||||
struct_def.attributes.Lookup("original_order") == nullptr && !fixed;
|
struct_def.attributes.Lookup("original_order") == nullptr && !fixed;
|
||||||
Expect('{');
|
Expect('{');
|
||||||
while (token_ != '}') ParseField(struct_def);
|
while (token_ != '}') ParseField(struct_def);
|
||||||
struct_def.PadLastField(struct_def.minalign);
|
|
||||||
Expect('}');
|
|
||||||
auto force_align = struct_def.attributes.Lookup("force_align");
|
auto force_align = struct_def.attributes.Lookup("force_align");
|
||||||
if (fixed && force_align) {
|
if (fixed && force_align) {
|
||||||
auto align = static_cast<size_t>(atoi(force_align->constant.c_str()));
|
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\'s natural alignment to 256");
|
||||||
struct_def.minalign = align;
|
struct_def.minalign = align;
|
||||||
}
|
}
|
||||||
|
struct_def.PadLastField(struct_def.minalign);
|
||||||
|
Expect('}');
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Parser::SetRootType(const char *name) {
|
bool Parser::SetRootType(const char *name) {
|
||||||
|
|||||||
Reference in New Issue
Block a user