Don't generate ModuleInfo if it's not declared in druntime#7395
Merged
dlang-bot merged 1 commit intodlang:masterfrom Dec 5, 2017
JinShil:nomoduleinfo2
Merged
Don't generate ModuleInfo if it's not declared in druntime#7395dlang-bot merged 1 commit intodlang:masterfrom JinShil:nomoduleinfo2
dlang-bot merged 1 commit intodlang:masterfrom
JinShil:nomoduleinfo2
Conversation
Contributor
|
Thanks for your pull request, @JinShil! Bugzilla referencesYour PR doesn't reference any Bugzilla issue. If your PR contains non-trivial changes, please reference a Bugzilla issue or create a manual changelog. |
WalterBright
requested changes
Dec 5, 2017
Member
WalterBright
left a comment
There was a problem hiding this comment.
Something of this significance needs a changelog entry.
Member
|
In fact, much of what you wrote in the explanation above is ideal for the changelog entry. |
Contributor
Author
Changelog entry added. |
Member
|
It's a good idea. Wish I'd thought of it. |
WalterBright
approved these changes
Dec 5, 2017
This was referenced Jan 24, 2018
This was referenced Feb 1, 2018
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
In response to http://forum.dlang.org/post/onn8vi$tgs$1@digitalmars.com and http://forum.dlang.org/post/p0280p$29t$1@digitalmars.com
Rationale
The compiler shouldn't require
ModuleInfoto exist if the platform doesn't support it or the program author wishes to provide an alternate druntime implementation that doesn't support it.Platform support is provided by druntime.
ModuleInfois declared in object.d. Therefore, the compiler can see, at compile-time, whether or not the platform engineer has provided support forModuleInfoand generate object code accordingly. (i.e. Design by Introspection)There are also use cases where, although the platform could support
ModuleInfo, the program author may choose to provide an alternate implementation of druntime features just for their program. That alternate implementation may not supportModuleInfo.The current compiler implementation will emit errors if
ModuleInfois not declared. It is an unnecessary restriction to require the author to workaround this constraint when they don't wish to supportModuleInfo.Current workarounds are to define a stub
ModuleInfoand have it discarded through LTO,--gc-sections, or a custom linker script.Benefits