Skip to content
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 issues 14591, 17310: ambiguous mangling for calling conventions Pascal and Objective-C #6702

Closed
wants to merge 1 commit into from

Conversation

rainers
Copy link
Member

@rainers rainers commented Apr 15, 2017

This changes mangling of extern(Pascal) to "Np" and extern(Objective-C) to "No".

There is no support for Objective-C in druntime or phobos, but Pascal needs a few changes: dlang/druntime#1812 and dlang/phobos#5333

@dlang-bot
Copy link
Contributor

Fix Bugzilla Description
14591 [SPEC] Ambiguity between extern(Pascal) and template value parameters
17310 [SPEC] Ambiguous mangling for 'Y', Objective-C function or variadic arguments?

@ibuclaw
Copy link
Member

ibuclaw commented Apr 15, 2017

Bang on time just as I'm about to send patches for gcc to remove the pascal specific special case for a more generic approach. ☺️

@ibuclaw
Copy link
Member

ibuclaw commented Apr 15, 2017

My initial thoughts are not so sure about using N for a third meaning. There's already special handling between the two existing uses of N.

@rainers
Copy link
Member Author

rainers commented Apr 15, 2017

My initial thoughts are not so sure about using N for a third meaning. There's already special handling between the two existing uses of N.

Yeah, but the other extendible encoding is 'z' which seems to be no better.

An alternative would be to extend this change to the extern(Windows) mangling and then use 'Ww', 'Wp' and 'Wo'.
Edit: extern(C++) and maybe even extern(C) could be added aswell

@rainers
Copy link
Member Author

rainers commented Jun 9, 2017

My initial thoughts are not so sure about using N for a third meaning.

An alternative would be to extend this change to the extern(Windows) mangling and then use 'Ww', 'Wp' and 'Wo'.

Another option could be to always use 'F' for function types of any linkage, and then use Np, etc. as a modifier for linkage other than extern(D).
Please note that this doesn't affect functions themself (they provide their own C/C++/Pascal mangling), but only declarations using their function type.

AFAICT all remaining demangle failures in dlang/druntime#1830 (comment) are caused by this ambiguity.

@rainers
Copy link
Member Author

rainers commented Jun 26, 2017

Another option could be to always use 'F' for function types of any linkage, and then use Np, etc. as a modifier for linkage other than extern(D).

We could also just prefix all the non-D calling convention letters 'U','W','V','R','Y' with 'F' as a function cannot directly follow as an argument. This wouldn't "release" those characters for other encodings, though.

@Geod24
Copy link
Member

Geod24 commented Sep 6, 2018

What's the status of this ? I saw some effort from @ibuclaw to deprecate Pascal calling convention (#4658). Can we close this and move forward with deprecation instead ?

@rainers
Copy link
Member Author

rainers commented Sep 7, 2018

Can we close this and move forward with deprecation instead ?

extern(Pascal) is still used in a couple of Windows header files, e.g. core.sys.windows.mapi and core.sys.windows.httpext.

@thewilsonator
Copy link
Contributor

extern(Pascal) has been deprecated. Close this?

@rainers
Copy link
Member Author

rainers commented Nov 20, 2018

Fine with me.

@rainers rainers closed this Nov 20, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants