Skip to content
This repository has been archived by the owner on Oct 12, 2022. It is now read-only.

importc: add alignof macro #3840

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

importc: add alignof macro #3840

wants to merge 2 commits into from

Conversation

ryuukk
Copy link

@ryuukk ryuukk commented Jun 15, 2022

@dlang-bot
Copy link
Contributor

Thanks for your pull request and interest in making D better, @ryuukk! We are looking forward to reviewing it, and you should be hearing from a maintainer soon.
Please verify that your PR follows this checklist:

  • My PR is fully covered with tests (you can see the coverage diff by visiting the details link of the codecov check)
  • My PR is as minimal as possible (smaller, focused PRs are easier to review than big ones)
  • I have provided a detailed rationale explaining my changes
  • New or modified functions have Ddoc comments (with Params: and Returns:)

Please see CONTRIBUTING.md for more information.


If you have addressed all reviews or aren't sure how to proceed, don't hesitate to ping us with a simple comment.

Bugzilla references

Your PR doesn't reference any Bugzilla issue.

If your PR contains non-trivial changes, please reference a Bugzilla issue or create a manual changelog.

Testing this PR locally

If you don't have a local development environment setup, you can use Digger to test this PR:

dub run digger -- build "master + druntime#3840"

@ryuukk ryuukk changed the title Add alignof macro importc: add alignof macro Jun 15, 2022
Copy link
Contributor

@dkorpel dkorpel left a comment

Choose a reason for hiding this comment

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

Going off the link you gave, _Alignof is C11, and alignof is a convenience macro in stdalign.h. However, you add alignof directy to importc.h. I think that should be _Alignof, alignof should only work when stdalign.h is included.

@ryuukk
Copy link
Author

ryuukk commented Jun 26, 2022

Done, i also added __alignof, i got that one when using the clang preprocessor on windows

@thewilsonator
Copy link
Contributor

it seems dmd already handles this https://github.com/dlang/dmd/blob/master/src/dmd/cparse.d#L900 please determine if this is still needed (e.g. for __alignof)

@ryuukk
Copy link
Author

ryuukk commented Jun 27, 2022

it seems dmd already handles this https://github.com/dlang/dmd/blob/master/src/dmd/cparse.d#L900 please determine if this is still needed (e.g. for __alignof)

I might have an outdated version of dmd, i'll try with latest master changes

@dkorpel dkorpel dismissed their stale review June 28, 2022 10:39

Change was implemented

@RazvanN7
Copy link
Contributor

RazvanN7 commented Jul 4, 2022

@ryuukk any progress?

@dlang-bot dlang-bot added the Needs Rebase needs a `git rebase` performed label Jul 7, 2022
@RazvanN7
Copy link
Contributor

RazvanN7 commented Jul 8, 2022

Adding the 72h no response -> close label.

/****************************
* Define it to do what other C compilers do.
*/
#define _Alignof(type) __builtin_offsetof(struct { char c; type member; }, member)
Copy link
Member

Choose a reason for hiding this comment

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

Remove this

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
6 participants