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

dwarfeh: version (Posix) replaced by "not Windows" #16143

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

denizzzka
Copy link
Contributor

@denizzzka denizzzka commented Feb 4, 2024

Another little thing important to support non-Windows non-Posix targets: such targets also need EH support

@dlang-bot
Copy link
Contributor

Thanks for your pull request and interest in making D better, @denizzzka! We are looking forward to reviewing it, and you should be hearing from a maintainer soon.
Please verify that your PR follows this checklist:

  • My PR is fully covered with tests (you can see the coverage diff by visiting the details link of the codecov check)
  • My PR is as minimal as possible (smaller, focused PRs are easier to review than big ones)
  • I have provided a detailed rationale explaining my changes
  • New or modified functions have Ddoc comments (with Params: and Returns:)

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

Your PR doesn't reference any Bugzilla issue.

If your PR contains non-trivial changes, please reference a Bugzilla issue or create a manual changelog.

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#16143"

@denizzzka denizzzka changed the title dwarfeh: version (Posix) replaced by not Windows dwarfeh: version (Posix) replaced by "not Windows" Feb 4, 2024
@denizzzka denizzzka marked this pull request as ready for review February 4, 2024 01:04
@@ -13,7 +13,7 @@ module rt.dwarfeh;

// debug = EH_personality;

version (Posix):
Copy link
Member

Choose a reason for hiding this comment

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

Did you not consider Cygwin?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

What do you mean? Cygwin builds will be broken?

Copy link
Member

@ibuclaw ibuclaw Feb 4, 2024

Choose a reason for hiding this comment

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

Even Mingw is a dwarf eh platform/environment. OK, dmd has no intention of supporting either, but doesn't ldc also use this module?

Copy link
Member

Choose a reason for hiding this comment

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

The point I'm raising is that it is not without good reason that version(!Windows) is not supported by the language. It is very bad practice to work around it by using version(Windows){} else: instead.

That said, this module isn't used by gdc, so I'll defer it to an ldc developer to check this.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The point I'm raising is that it is not without good reason that version(!Windows) is not supported by the language. It is very bad practice to work around it by using version(Windows){} else: instead.

Can we define enum/version like enableDwarfEH and then set if for needed targets?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The point I'm raising is that it is not without good reason that version(!Windows) is not supported by the language. It is very bad practice to work around it by using version(Windows){} else: instead.

What do you think about ~same #16141 ?

@kinke
Copy link
Contributor

kinke commented Feb 5, 2024

I'm kind-of sympathetic to being more bold wrt. making some existing version (Posix) the default branch for unknown targets, based on my own experience wrt. trying to get even betterC code to cross-compile for exotic platforms (still importing druntime and then e.g. complaining about undefined wchar_t). [It doesn't really help that the compiler disallows setting predefined D versions explicitly in the cmdline, just to try to compile with -version=Posix and see how far one would get.]

Even Mingw is a dwarf eh platform/environment.

Good point; so here we could disable the module for CRuntime_{Microsoft,Mars}. Edit: Or do we? I'm not sure whether CRuntime_MinGW and CRuntime_Microsoft are mutually exclusive (as the MinGW one is based on the Microsoft one...).

Can we define enum/version like enableDwarfEH and then set if for needed targets?

Yep, that's what I think would make the most sense wrt. making druntime more modularized/strippable - defining a rather coarse feature set via enums exported from some druntime config module (we cannot export versions); EH support being such a feature.

@ibuclaw
Copy link
Member

ibuclaw commented Feb 5, 2024

Edit: Or do we? I'm not sure whether CRuntime_MinGW and CRuntime_Microsoft are mutually exclusive (as the MinGW one is based on the Microsoft one...).

The way gdc supports mingw is CRuntime_Microsoft that is extended with MinGW functions and features.

Debug symbols and EH table format is not wedded to any specific platform. It's an implementation detail of the compiler runtime support - a separate core to the language runtime support.

Copy link
Member

@WalterBright WalterBright left a comment

Choose a reason for hiding this comment

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

The proper way to do this is:

version (Posix) { version = DWARFEH; }
else version (AnotherOS) { version = DWARFEH; }
else version (YetAnotherOS) { version = DWARFEH; }
else static assert(0);
version (DWARFEH):

This way, there is no default OS. One still has to proactively decide what code goes with what operating system, but the above makes it reasonable.

@denizzzka denizzzka force-pushed the dwarf_eh_pr branch 2 times, most recently from 1666b58 to fcfd1cd Compare March 24, 2024 03:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
5 participants