Skip to content

Add ddoc fullText to the CLI switches#7703

Merged
dlang-bot merged 3 commits intodlang:masterfrom
wilzbach:ddoc-cli
Jan 25, 2018
Merged

Add ddoc fullText to the CLI switches#7703
dlang-bot merged 3 commits intodlang:masterfrom
wilzbach:ddoc-cli

Conversation

@wilzbach
Copy link
Contributor

Required for automatically generating the CLI options at dlang.org, see dlang/dlang.org#2068
There were the following differences:

  • -gc (only on dlang.org - the flag has been removed)
  • profile (not mentioned on dlang.org)
  • -run (not mentioned at the DMD output)
  • --version (not mentioned on dlang.org)

The DMD CLI wasn't alphabetical ordered for a few cases (https://dlang.org/dmd.html is).
(in the transition from the manual CLI output to the dynamically generated one, I kept the ordering to allow easy diffing of the output).

Generating the language transitions automatically depends on #7648
Anyways, the available language transitions aren't shown on dlang.org at the moment.

@dlang-bot
Copy link
Contributor

Thanks for your pull request, @wilzbach!

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.

will not get called.)
$(LI `ModuleInfo` is not generated.)
$(LI $(LINK2 $(ROOT_DIR)phobos/object.html#.TypeInfo, `TypeInfo`)
instances will not be generated for structs.)
Copy link
Contributor Author

@wilzbach wilzbach Jan 14, 2018

Choose a reason for hiding this comment

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

I'm not so sure that the CLI pages are the best place to document this. Imho we should just link to https://dlang.org/spec/betterc.html and improve this page if needed.

Copy link
Contributor

Choose a reason for hiding this comment

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

I agree, but let's leave that to another PR.

),
Option("c",
"do not link"
"compile only, do not link"
Copy link
Contributor Author

Choose a reason for hiding this comment

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

That's the text from dlang.org - imho a bit more descriptive.

"generate documentation"
"generate documentation",
`$(P Generate $(LINK2 $(ROOT_DIR)spec/ddoc.html, documentation) from source.)
$(P Note: mind the $(LINK2 $(ROOT_DIR)spec/ddoc.html#security, security considerations).)
Copy link
Contributor 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 that the paragraphs are needed here, but it's a 1:1 from dlang.org

src/dmd/cli.d Outdated
Option("inline",
"do function inlining"
"do function inlining",
`inline expand functions at the discretion of the compiler.
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 "inline expand" looks out of place. I would just say "Inline functions"

Copy link
Contributor

Choose a reason for hiding this comment

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

I agree. Sorry, I didn't comment about that earlier. Care to make the change to "Inline functions..." before we merge?

src/dmd/cli.d Outdated
string ddocText; /// Detailed description of the flag (in Ddoc)

///
this(string flag, string helpText, TargetOS os = TargetOS.all)
Copy link
Contributor

Choose a reason for hiding this comment

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

Ideally all these parameters should be documented.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

@JinShil
Copy link
Contributor

JinShil commented Jan 14, 2018

I'm a little skeptical about this documentation being in the binary unless it actually serves some purpose for users of the compiler. At the moment I think this is only used as a datastore to keep all related information about the compiler flags in one place. That's perfectly fine, but I think we should version it out (may actually need string mixins) so it is only used for generating the documentation, but doesn't end up in the published binary.

@wilzbach
Copy link
Contributor Author

I'm a little skeptical about this documentation being in the binary unless it actually serves some for users of the compiler.

It's needed for dlang/dlang.org#2068

but doesn't end up in the published binary.

That's why the CLI text is generated at CTFE, so these strings shouldn't end up in the binary.
I made this more explicit with version(DdocOptions) as I checked the binary and DMD didn't seem to be smart enough. It would be cool to avoid the need for version though, but apparently DMD judges a template instantiation at CTFE reson enough to send a templated function to object code.

@WalterBright
Copy link
Member

That's why the CLI text is generated at CTFE, so these strings shouldn't end up in the binary.
I made this more explicit with version(DdocOptions) as I checked the binary and DMD didn't seem to be smart enough. It would be cool to avoid the need for version though, but apparently DMD judges a template instantiation at CTFE reson enough to send a templated function to object code.

Please file a bugzilla for this. But it still needs to be versioned out so it doesn't appear in the dmd binary, because updating the dmd that builds dmd may be a looong wait.

@wilzbach
Copy link
Contributor Author

Please file a bugzilla for this.

https://issues.dlang.org/show_bug.cgi?id=18238

@wilzbach
Copy link
Contributor Author

So as this is now using version(DdocOptions) and won't add up to the executable size. Is everyone OK with moving forward?
As mentioned the main benefit here is that there will be only one source of truth for the compiler arguments and dlang.org/dmd.html will automatically be in sync.

@JinShil
Copy link
Contributor

JinShil commented Jan 17, 2018

Is everyone OK with moving forward?

LGTM

I don't see the output in DAutoTest. Please advise.

@wilzbach
Copy link
Contributor Author

I don't see the output in DAutoTest. Please advise.

Yes, this PR is a dependency of dlang/dlang.org#2068
I could probably change dlang/dlang.org#2068 to use static if to softly fail if no ddoxText attribute is available, but unfortunately one of the two PRs has to be merged without the preview and I thought this PR here is easier to review, because it just adds text.

src/dmd/cli.d Outdated
{
string ddocText; /// Detailed description of the flag (in Ddoc)

this(string flag, string helpText, TargetOS os = TargetOS.all)
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe pull this method out of the version blocks since it appears to be the same in both cases?

src/dmd/cli.d Outdated
this.os = os;
}

this(string flag, string helpText, string ddocText, TargetOS os = TargetOS.all)
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe

version(DdocOptions) this.ddocText = ddocText;

Then remove the other instance of this constructor?

@JinShil
Copy link
Contributor

JinShil commented Jan 20, 2018

@wilzbach This has been open for a week, which I think is ample time for others to weigh in. I'll probably merge this if you address @marler8997's comments above and no other objections arise.

@wilzbach
Copy link
Contributor Author

Cool! I will do so once I am back and have access to my laptop.

@wilzbach wilzbach force-pushed the ddoc-cli branch 3 times, most recently from 67976f9 to 004438c Compare January 24, 2018 07:17
@wilzbach
Copy link
Contributor Author

(Rebased, addressed the review and resolved the merge conflict.)

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.

6 participants