dmd
dmd copied to clipboard
Detect undocumented command-line options
Works when dmd is compiled in debug mode. Only detects simple non-suffix options.
Hopefully any PRs forgetting to call gotOpt
will be detected in reviews as surrounding lines tend to call it. Failing that, at least we can grep for if (arg == "
to list all the hidden/unchecked options (e.g. -quiet
, --b
).
Add docs for -multiobj, -nofloat, -vcg-ast
.
Thanks for your pull request and interest in making D better, @ntrel! 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:
andReturns:
)
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
Auto-close | Bugzilla | Severity | Description |
---|---|---|---|
✓ | 23471 | enhancement | undocumented dmd CLI options |
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#14630"
What's the issue ? We already detect unused arguments L2550 / 2580:
else
{
Lerror:
error("unrecognized switch '%s'", arguments[i]);
continue;
Lnoarg:
error("argument expected for switch '%s'", arguments[i]);
continue;
}
@Geod24 This helps detect valid options that don't have --help
documentation.
You can see the check firing in the tests for the first commit (before I added missing docs) here: https://app.circleci.com/pipelines/github/dlang/dmd/23098/workflows/1da53291-0849-49a4-b6c1-6bc0f758fa21/jobs/50668
core.exception.AssertError@src/dmd/mars.d(1596): missing doc for -multiobj in cli.d
Add docs for
-multiobj, -nofloat, -vcg-ast
.
Note sure about the first two, but -vcg-ast
was intentionally not documented because it was meant for internal use.
I suggest adding a parameter to gotOpt
so you can specify that a switch is deliberately undocumented, and add documentation to switches in a separate PR.
Thanks for cleaning up the argument parsing code!
Undocumented flags are mostly pointless/even dangerous, I'd rather we documented them like llvm/ldc does with -help-hidden
@ntrel what are your plans with this PR?
Ping @ntrel