-
-
Notifications
You must be signed in to change notification settings - Fork 606
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
Fix bugzilla 24509: importC cannot handle _stdcall Function Calling … #16392
Conversation
Thanks for your pull request and interest in making D better, @aferust! We are looking forward to reviewing it, and you should be hearing from a maintainer soon.
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
Testing this PR locallyIf you don't have a local development environment setup, you can use Digger to test this PR: dub run digger -- build "stable + dmd#16392" |
compiler/test/compilable/test22727.c
Outdated
int fooc(int a) { return a; } | ||
|
||
#ifdef _WIN32 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How come this worked before adding these guards?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am surprised that the guard didn't exist in the first place, too.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think I get it now. It seems that __stdcall is recognized by the compiler irrespective of the platform where you are compiling on, whereas you are adding the alias only for version windows. For more info, check: #13614
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cc @WalterBright - is there any reason to hava stdcall being recognized on non-windows platforms?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@RazvanN7 if you request I remove the guard. Without it CI test fail for non-windows systems.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@aferust It seems that @WalterBright has implemented stdcall so that it is recognized by the parser irrespective of the target platform. Now I wonder if this was simply an overlook or if it was intended behavior. Depending on the answer to that question we will know if this PR needs to be implemented in a way that _stdcall is recognized irrespective of the platform or if it should be windows only.
I guess if we want to be consistent, the _stdcall alias should defined for all platforms, but I want confirmation from @WalterBright before doing that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
stdcall is just one of the few ABIs possible with on x86-32.
https://godbolt.org/z/osxa3qhcs
It's not rejected, but rather a warning on x86-64 and other targets. ImportC follows the convention that if it's only warned about, then just accept and ignore.
@aferust the commit message has bugzilla spelled with 3 |
the commit message not the PR title (well that too, but the commit message is what the bot uses to auto-close the issue) |
Ahh. too bad. I cannot change it without a revert and ... ahh |
@thewilsonator what if I change the title of the last commit "test requires a new line at the end of the file" From a StackOverflow post: git commit --amend Pushing git push --force-with-lease |
just
|
…onvention with single heading underscore
FWIW, from https://learn.microsoft.com/en-us/cpp/cpp/stdcall?view=msvc-170:
So LGTM, keeping the macro MS-specific, unless DigitalMars C also supports |
"unless DigitalMars C also supports I tried to compile test22727.c with yielding:
As I said, if it is an issue, it existed before my PR. So I will just finalize my PR with:
please note that I don't know if we have any reason to do:
|
…Convention with single heading underscore