Merge pull request #1958 from dsnopek/rid-alignment
Fix alignment on `RID` and other classes that use `uint8_t opaque[SIZE]`
This commit is contained in:
@ -768,7 +768,10 @@ def generate_builtin_class_header(builtin_api, size, used_classes, fully_used_cl
|
||||
|
||||
result.append(f"class {class_name} {{")
|
||||
result.append(f"\tstatic constexpr size_t {snake_class_name}_SIZE = {size};")
|
||||
result.append(f"\tuint8_t opaque[{snake_class_name}_SIZE] = {{}};")
|
||||
# We don't get alignment information from the JSON so we have to guess.
|
||||
# This logic should be correct for all built-in types as they exist right now.
|
||||
alignment = 8 if size >= 8 else 4
|
||||
result.append(f"\talignas({alignment}) uint8_t opaque[{snake_class_name}_SIZE] = {{}};")
|
||||
|
||||
result.append("")
|
||||
result.append("\tfriend class Variant;")
|
||||
|
||||
Reference in New Issue
Block a user