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 Issue 23343 - ImportC: functions declared with asm label to set s… #14486

Closed
wants to merge 1 commit into from

Conversation

WalterBright
Copy link
Member

…ymbol name gets extra underscore prepended

Rebooted due to @ibuclaw 's suggestion in #14485

@WalterBright WalterBright added Review:Easy Review Feature:ImportC Pertaining to ImportC support labels Sep 25, 2022
@dlang-bot
Copy link
Contributor

Thanks for your pull request, @WalterBright!

Bugzilla references

Auto-close Bugzilla Severity Description
23343 normal ImportC: functions declared with asm label to set symbol name gets extra underscore prepended

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 + dmd#14486"

@@ -1914,7 +1914,7 @@ final class CParser(AST) : Parser!AST
if (auto p = s.isDeclaration())
{
auto str = asmName.peekString();
p.mangleOverride = str;
p.mangleOverride = '*' ~ str;
Copy link
Member

Choose a reason for hiding this comment

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

Don't we have a string concatenation helper that avoids GC calls?

Copy link
Member Author

Choose a reason for hiding this comment

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

I don't think it's necessary here.

@ibuclaw
Copy link
Member

ibuclaw commented Sep 25, 2022

@WalterBright I'll let you decide which method you prefer. I have no problem with adding special handling in the codegen pass - though the other PR needs to expose any new enum constants to C++ in order to be usable.

This method is not without its own side effects either - suddenly pragma(mangle, "*foo") has a special meaning - though gdc has always had this behaviour since pragma mangle was introduced.

@WalterBright
Copy link
Member Author

I figure if gcc users can abide by the '*' prefix, then we have an excuse in doing the same thing.

@WalterBright
Copy link
Member Author

This scheme isn't going to work. Too many places where the identifier is used.

@ibuclaw
Copy link
Member

ibuclaw commented Sep 25, 2022

This scheme isn't going to work. Too many places where the identifier is used.

That's a sign that you should have it all in reusable function.

@RazvanN7
Copy link
Contributor

This scheme isn't going to work. Too many places where the identifier is used.

Does this mean #14485 is going to be preferred over this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
No open projects
Status: Done
Development

Successfully merging this pull request may close these issues.

4 participants