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

Open
wants to merge 1 commit into
base: master
from

Conversation

Projects
None yet
4 participants
@rainers
Member

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

This comment has been minimized.

Show comment
Hide comment
@dlang-bot

dlang-bot Apr 15, 2017

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?
Contributor

dlang-bot commented Apr 15, 2017

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

This comment has been minimized.

Show comment
Hide comment
@ibuclaw

ibuclaw Apr 15, 2017

Member

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. ☺️

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

This comment has been minimized.

Show comment
Hide comment
@ibuclaw

ibuclaw Apr 15, 2017

Member

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.

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

This comment has been minimized.

Show comment
Hide comment
@rainers

rainers Apr 15, 2017

Member

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

Member

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

This comment has been minimized.

Show comment
Hide comment
@rainers

rainers Jun 9, 2017

Member

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.

Member

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

This comment has been minimized.

Show comment
Hide comment
@rainers

rainers Jun 26, 2017

Member

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.

Member

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

This comment has been minimized.

Show comment
Hide comment
@Geod24

Geod24 Sep 6, 2018

Contributor

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 ?

Contributor

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

This comment has been minimized.

Show comment
Hide comment
@rainers

rainers Sep 7, 2018

Member

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.

Member

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment