Uh oh!
There was an error while loading. Please reload this page.
tools: Add tool for checking size and alignment of C types - #20951
Merged
Conversation
Prints _Static_asserts for the size and alignment of all the basic built-in C types. The output can be run through a compiler for the specified target to verify that Zig's values are the same as those used by a C compiler for the target.
alexrp
reviewed
Aug 6, 2024
Uh oh!
There was an error while loading. Please reload this page.
alexrp
approved these changes
Aug 6, 2024
alexrp
commented
Aug 6, 2024
Member
Already finding bugs: ❯ zig run generate_c_size_and_align_checks.zig -- sparc64-linux-gnu | sparc64-linux-gnu-gcc -fsyntax-only -xc -<stdin>:35:1: error: static assertion failed: "_Alignof(long double) == 8" |
alexrp
commented
Aug 6, 2024
Member
Another nice addition here would be to test |
andrewrk
commented
Aug 6, 2024
Member
Thanks! |
nektro
commented
Aug 6, 2024
Contributor
a nice followup enhancement would be adding a test step that creates run steps with the output of this program for a matrix of targets that we support |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for freeto join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Requested by @alexrp
Prints _Static_asserts for the size and alignment of all the basic built-in C types.
The output can be run through a compiler for the specified target to verify that Zig's values are the same as those used by a C compiler for the target.
Example output for
x86_64-linux-gnu: