Skip to content

Remove __packed__ attribute from header structs#46

Merged
WinterMute merged 3 commits intodevkitPro:masterfrom
chishm:struct-packing
Jul 20, 2020
Merged

Remove __packed__ attribute from header structs#46
WinterMute merged 3 commits intodevkitPro:masterfrom
chishm:struct-packing

Conversation

@chishm
Copy link
Copy Markdown
Contributor

@chishm chishm commented Jul 20, 2020

The attribute causes GCC warnings when -Waddress-of-packed-member is enabled. It is not needed because the structs are already laid out in a packed way.

To verify that the structs remain as expected, add compile-time asserts.

The attribute causes GCC warnings when `-Waddress-of-packed-member` is
enabled. It is not needed because the structs are already laid out in a
packed way.

To verify that the structs remain as expected, add compile-time asserts.
@chishm
Copy link
Copy Markdown
Contributor Author

chishm commented Jul 20, 2020

This is the PR requested by Wintermute.

chishm referenced this pull request in chishm/nitrohax Jul 20, 2020
The struct doesn't actually need to be packed. But because it is defined as
such, the compiler warns that it can't be cast to a uint32 without
potential misaligned memory accesses. This is not a concern for the address
of the NDS header that's actually used (0x027FFE00), so disable the
warning.

Signed-off-by: Michael "Chishm" Chisholm <chishm@chishm.com>
@WinterMute WinterMute merged commit 62b4973 into devkitPro:master Jul 20, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants