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

Make struct dtors work in -betterC via hack on Linux #6923

Closed
wants to merge 1 commit into from

Conversation

adamdruppe
Copy link
Contributor

@adamdruppe adamdruppe commented Jun 21, 2017

They currently fail because they output a reference to druntime personality function. This hacks it out. Follow-up to my other PR: #6922

These together with Walter's at #6918 achieve the goal I set out in October to make -betterC actually usable.

Still a filthy hack, especially this one, but a usable filthy hack. We can go back and add stuff back in like EH later.

Note: I have not tested betterC on Windows yet. I think the struct dtor already works there though.

@adamdruppe
Copy link
Contributor Author

It might make sense to suppress the generation of the call to _Unwind_Resume for now too... then you can make code that works with the libc as well. But we don't want to break it too much and code can always stub that out now.

@WalterBright
Copy link
Member

I have not tested betterC on Windows yet. I think the struct dtor already works there though.

Sounds like a test case should be added to this PR!

@dlang-bot
Copy link
Contributor

dlang-bot commented Jul 5, 2017

Thanks for your pull request, @adamdruppe! We are looking forward to reviewing it, and you should be hearing from a maintainer soon.

Some tips to help speed things up:

  • smaller, focused PRs are easier to review than big ones

  • try not to mix up refactoring or style changes with bug fixes or feature enhancements

  • provide helpful commit messages explaining the rationale behind each change

Bear in mind that large or tricky changes may require multiple rounds of review and revision.

Please see CONTRIBUTING.md for more information.

Bugzilla references

Fix Bugzilla Description
17603 "undefined reference to `__dmd_personality_v0'" with -betterC and struct destructors

@CyberShadow
Copy link
Member

@WalterBright Done

@adamdruppe adamdruppe force-pushed the betterc_dtor branch 2 times, most recently from 7eea02c to ab03daa Compare July 5, 2017 15:43
…ork and exceptions are broken af anyway. Fixes Issue 17603
@adamdruppe
Copy link
Contributor Author

And the tests are all passing. It doesn't quite work on Windows. I figure we can change it to use C++ library EH there, but the betterC flag wasn't available in nteh.c and #including it led to other errors! So I labeled this as being just Linux as a small step forward, better than nothing.

BTW on using C/C++ eh libs, I'm for that in general, though part of betterC's appeal to me is being able to pull out the C library too, so I say we want to keep that doable. not necessarily easy, but not harder than it needs to be either. Of course, that's a separate issue to this PR as it sits now which just hacks out the ref so we can use it today and worry about this later when we have a bit more real world experience.

@WalterBright
Copy link
Member

Sorry, I haven't had a chance to look at this yet.

@MartinNowak
Copy link
Member

In general we shouldn't merge behavior that only works on some platforms.

@adamdruppe
Copy link
Contributor Author

betterC is itself a hack that only works on some platforms.

@WalterBright
Copy link
Member

Superceded by #7305 and #7304

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