Skip to content

Support automatic alignment for casetype ? #145

@tahina-pro

Description

@tahina-pro

So far align makes 3D compute automatic alignment padding for structs, but not casetypes.

Case 1: user-defined casetypes

While a user can arbitrarily nest align structs as field members of a casetype, 3D currently provides no automatic mechanism to produce alignment padding for the whole casetype. This would be useful for casetypes refining C union types.

Case 2: #if

However, this should not be allowed if the casetype was generated as a support for #if. Yet automatic alignment support may become harder for #ifs since the alignment may depend on the conditional. Rather, we should make sure each case of such casetype is properly aligned.

What should we do with:

aligned typedef struct _test {
  UINT16 foo;
#if MYCOND
  UINT32 bar;
#else
  UINT64 baz;
#endif
} test;

Alignment padding after foo will depend on MYCOND (2 or 6 bytes.)

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions