Skip to content

codegen: Support repr(align) #1271

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Mar 13, 2018
Merged

codegen: Support repr(align) #1271

merged 5 commits into from
Mar 13, 2018

Conversation

emilio
Copy link
Contributor

@emilio emilio commented Mar 10, 2018

Fixes #917.

@highfive
Copy link

warning Warning warning

  • These commits modify unsafe code. Please review it carefully!

@emilio
Copy link
Contributor Author

emilio commented Mar 10, 2018

r? @fitzgen or @upsuper

pub struct a {
pub b: ::std::os::raw::c_int,
pub c: ::std::os::raw::c_int,
pub __bindgen_align: [u64; 0usize],
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we still need to generate this, then?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not really, but it doesn't hurt and avoids having the extra codepath and conditionals.

@@ -0,0 +1,6 @@
// bindgen-flags: --rust-target 1.24 -- -std=c++11

struct alignas(8) a {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you add another testcase with alignas(double)? And probably do so with 32bit Linux as target, given that's where the original issue is.

Also maybe add testcase for things when alignas is on field rather than type?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, will add. We don't run tests on linux32 though, so I won't do that, since it wouldn't test anything extra.

Copy link
Contributor

@upsuper upsuper Mar 10, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think adding -m32 should be enough?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added

@upsuper
Copy link
Contributor

upsuper commented Mar 10, 2018

@bors-servo r+

Although it would still be good if you have a test for alignas on member field. Also if we can remove the extra __bindgen_align field, but this can probably be done in a separate one.

@bors-servo
Copy link

📌 Commit 1923985 has been approved by upsuper

@bors-servo
Copy link

⌛ Testing commit 1923985 with merge 39c7ae0...

bors-servo pushed a commit that referenced this pull request Mar 10, 2018
codegen: Support repr(align)

Fixes #917.
@bors-servo
Copy link

💔 Test failed - status-travis

@emilio
Copy link
Contributor Author

emilio commented Mar 10, 2018

So turns out this feature is really 1.25 in my testing :(

@bors-servo
Copy link

☔ The latest upstream changes (presumably #1273) made this pull request unmergeable. Please resolve the merge conflicts.

@emilio
Copy link
Contributor Author

emilio commented Mar 13, 2018

@bors-servo r=xidorn

@bors-servo
Copy link

📌 Commit 853ae4d has been approved by xidorn

@bors-servo
Copy link

⌛ Testing commit 853ae4d with merge 9a0edb8...

bors-servo pushed a commit that referenced this pull request Mar 13, 2018
codegen: Support repr(align)

Fixes #917.
@bors-servo
Copy link

☀️ Test successful - status-travis
Approved by: xidorn
Pushing 9a0edb8 to master...

@bors-servo bors-servo merged commit 853ae4d into rust-lang:master Mar 13, 2018
@emilio emilio deleted the repr-align branch March 31, 2018 07:00
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.

5 participants