Skip to content

Conversation

@marler8997
Copy link
Contributor

No description provided.

@dlang-bot
Copy link
Contributor

dlang-bot commented Jan 25, 2018

Thanks for your pull request and interest in making D better, @marler8997! 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 annotated coverage diff directly on GitHub with CodeCov's browser extension
  • 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.

src/dmd/cli.d Outdated
Option("i=[-]<pattern>,[-]<pattern>,...",
"include/exclude imported modules whose name matches one of <pattern>"
"include/exclude imported modules whose name matches one of <pattern>",
`this option enables "include import" mode, where the compiler will
Copy link
Contributor

Choose a reason for hiding this comment

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

While the dlang.org script will capitalize the first word automatically, I think it's still good to do here too (to avoid confusion etc.).

src/dmd/cli.d Outdated
Determining which modules to include is based on a set of "module patterns".
These patterns are optionally included after the "-i=" option as a comma
separated list. A pattern matches any module whose fully qualified name
Copy link
Contributor

Choose a reason for hiding this comment

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

Double whitespace

src/dmd/cli.d Outdated
"foo.bar" would not match a module named "foo.barx".
The presence of the "-" prefix in a module pattern indicates that matching-modules
should be excluded from compilation. Patterns without this indicate that
Copy link
Contributor

Choose a reason for hiding this comment

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

double ws

src/dmd/cli.d Outdated
want to override this behavior, they can use the special "." pattern to "include by
default" or "-." to "exclude by default".
Note: multiple "-i=..." options is allowed, each one just adds more patterns.`
Copy link
Contributor

Choose a reason for hiding this comment

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

are

Copy link
Contributor

Choose a reason for hiding this comment

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

Avoid "just" as it colloquial.

src/dmd/cli.d Outdated
on the command line.
Determining which modules to include is based on a set of "module patterns".
These patterns are optionally included after the "-i=" option as a comma
Copy link
Contributor

Choose a reason for hiding this comment

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

How about using a delimited string and use back-ticks for command line things like -i=?

src/dmd/cli.d Outdated
Note that along with the module patterns given by the user, there is a standard
set of exclusionary module patterns that are always used, namely:
"-std,-core,-etc,-object"
Note that these can be overriden (i.e. -i=std,core,etc,object).
Copy link
Contributor

Choose a reason for hiding this comment

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

Double "Note", maybe "However" ?

src/dmd/cli.d Outdated
Note that these can be overriden (i.e. -i=std,core,etc,object).
Since module patterns can either be inclusionary or exclusionary, a priority
must be established to handle the case where a module matches multiple patterns.
Copy link
Contributor

Choose a reason for hiding this comment

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

I think typically the motivation for a feature isn't stated in its CLI docs.
@ others agree or disagree?

src/dmd/cli.d Outdated
should be excluded from compilation. Patterns without this indicate that
matching-modules should be included in compilation.
Note that along with the module patterns given by the user, there is a standard
Copy link
Contributor

Choose a reason for hiding this comment

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

The style of addressing the user as "the user" is completely new and doesn't appear anywhere at https://dlang.org/dmd.html

I think sth. like this would fit better with the existing style:

The standard set of exclusionary module patterns is "-std,-core,-etc,-object" and can be overridden with i.e. -i=std,core,etc,object).

src/dmd/cli.d Outdated
by default. However, if at least one "inclusionary" module pattern is given, then
modules that don't match any pattern will be excluded by default. Should the user
want to override this behavior, they can use the special "." pattern to "include by
default" or "-." to "exclude by default".
Copy link
Contributor

Choose a reason for hiding this comment

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

This paragraph is a bit too complicated for what it tries to tell. How about:

By default modules that don't match any pattern will be included.
However, if at least one inclusionary module pattern is given, then modules that don't match any pattern will be excluded.
This can be overridden by -i=-. (exclude by default) or -i=. (include by default).

@wilzbach
Copy link
Contributor

Oh and congrats to submitting 7777 🍀 🥇

src/dmd/cli.d Outdated
"include/exclude imported modules whose name matches one of <pattern>"
"include/exclude imported modules whose name matches one of <pattern>",
q"{$(P Enables "include imports" mode, where the compiler will include imported
modules in the compilation, as if they were given on the command line.)
Copy link
Contributor

Choose a reason for hiding this comment

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

as if they were given on the command line

there seems to be subtle differences: are these a feature or a bug? should they be documented here?

main.d:
import foo.fun;
foo/fun.d:

dmd -i -o- main.d
#ok
dmd -o- main.d foo/fun.d
Error: module fun from file foo/fun.d must be imported with 'import fun;'

NOTE: if we add module foo.fun; to foo/fun.d the problem goes away
NOTE: if we add module asdf.fun; to foo/fun.d, dmd -i accepts the code but should not. This one is a clear bug.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

bug

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fix here: #7778

src/dmd/cli.d Outdated
"include/exclude imported modules whose name matches one of <pattern>",
q"{$(P Enables "include imports" mode, where the compiler will include imported
modules in the compilation, as if they were given on the command line.)
Copy link
Contributor

@timotheecour timotheecour Jan 25, 2018

Choose a reason for hiding this comment

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

another subtle difference, again not clear if feature or bug but should be documented: behavior is different with -op with and without -i

dmd -od=generated -op -c -Ifoo foo/fun1.d foo/bar/fun4.d foo/main.d
dmd -od=generated_i -op -c -i -Ifoo foo/main.d
foo/main.d: void main(){import bar.fun4; import fun1;}
foo/fun1.d:
foo/bar/fun4.d:module bar.fun4;
├── generated
│   └── foo
│       ├── bar
│       │   └── fun4.o
│       ├── fun1.o
│       └── main.o
├── generated_i
│   ├── bar
│   │   └── fun4.o
│   ├── foo
│   │   └── main.o
│   └── fun1.o

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yeah looks like a bug, I"ll see if I can fix this one

Copy link
Contributor

@timotheecour timotheecour left a comment

Choose a reason for hiding this comment

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

bugs or features? need doc

Copy link
Contributor

@wilzbach wilzbach left a comment

Choose a reason for hiding this comment

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

There is still a bit of an inconsistency between backticks and quotes which I assume to look a bit weird on the rendered docs, apart from that it looks really good. Thanks!

src/dmd/cli.d Outdated
These patterns are optionally included after `-i=` as a comma separated list.
A pattern matches any module whose fully qualified name starts with the pattern.
The pattern "foo.bar" matches all modules in the `foo.bar` package, such as
"foo.bar" itself, "foo.bar.baz" or even "foo.bar.package". Note that each component
Copy link
Contributor

Choose a reason for hiding this comment

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

As you escape package names below, I would do it here too for the sake of consistency.

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 was attempting to escape package names, but not module patterns...there are other places in the help where module patterns are quoted, but I thought that package names themselves should definitely be escaped. looking at the final generated docs will likely indicate which method looks the best.

src/dmd/cli.d Outdated
$(P The presence of the "-" prefix in a module pattern indicates that matching-modules
should be excluded from compilation. Patterns without this indicate that
matching-modules should be included in compilation.)
Copy link
Contributor

Choose a reason for hiding this comment

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

Why so you use a hyphen here?

src/dmd/cli.d Outdated
$(P Along with the module patterns supplied, there is a standard set of exclusionary
patterns that are always included:
"-std,-core,-etc,-object"
Note that these can be overriden (i.e. -i=std,core,etc,object).)
Copy link
Contributor

Choose a reason for hiding this comment

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

For consistency: use backticks

src/dmd/cli.d Outdated
$(P Along with the module patterns supplied, there is a standard set of exclusionary
patterns that are always included:
"-std,-core,-etc,-object"
Copy link
Contributor

Choose a reason for hiding this comment

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

You use backticks for CLI arguments above.

@JinShil
Copy link
Contributor

JinShil commented Feb 1, 2018

@wilzbach Why isn't this showing up in DAutoTest's rendered docs?

@marler8997
Copy link
Contributor Author

I think we're waiting on this: dlang/dlang.org#2068

@wilzbach
Copy link
Contributor

wilzbach commented Feb 7, 2018

As dlang/dlang.org#2068 is in, I rebased this PR to restart DAutoTest.

@marler8997
Copy link
Contributor Author

Hmmm, the -i=[-]<pattern>,[-]<pattern,.. doesn't seem to show up correctly. Maybe commas are messing it up?

@marler8997
Copy link
Contributor Author

Yeah I think it's the comma. I think the dlang.org generator needs to be modified to handle commas in the flag field.

@marler8997
Copy link
Contributor Author

Looks like dlang/dlang.org#2188 did the trick. This PR should be ready for merge.

@wilzbach wilzbach added Merge:72h no objection -> merge The PR will be merged if there are no objections raised. and removed Merge:72h no objection -> merge The PR will be merged if there are no objections raised. labels Feb 8, 2018
src/dmd/cli.d Outdated
$(P Along with the module patterns supplied, there is a standard set of exclusionary
patterns that are always included:
`-std,-core,-etc,-object`
Note that these can be overriden (i.e. `-i=std,core,etc,object`).)
Copy link
Contributor

Choose a reason for hiding this comment

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

I think this needs a new line or at least a dot:
image
Also you use "Note:" later (with colon) - consistency and all ;-)

Copy link
Contributor

@wilzbach wilzbach left a comment

Choose a reason for hiding this comment

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

LGTM module nits.

@marler8997 marler8997 force-pushed the documentDashI branch 2 times, most recently from e960b7a to baf1586 Compare February 8, 2018 20:24
@marler8997
Copy link
Contributor Author

marler8997 commented Feb 9, 2018

Wait for #7857 before merging this one. If that one gets accepted then it will change this one a bit.

@marler8997
Copy link
Contributor Author

Walter has merged #7857 so I've reworded this one a bit...

src/dmd/cli.d Outdated
be excluded. This behavior can be overriden by usig `-i=.` to include by default or `-i=-.` to
exclude by default.)
$(P Note that multiple `-i=...` options are allowed, each one adds more patterns.)}"
Copy link
Contributor

Choose a reason for hiding this comment

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

How about: each one adds a pattern?

Though, I think now you can even remove this last paragraph completely as you have a few examples of multiple arguments in the paragraphs before.

src/dmd/cli.d Outdated
$(P The default behavior of excluding druntime/phobos is accomplished by internally adding a
set of standard exclusions, namely, `-i=-std -i=-core -i=-etc -i=-object`. Note that these
can be overriden with `-i=std -i=core -i=etc -i=object`.)
Copy link
Contributor

Choose a reason for hiding this comment

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

file 'dmd/cli.d' contains trailing whitespace at line 329

@marler8997 marler8997 force-pushed the documentDashI branch 3 times, most recently from faf1e78 to 3bf4958 Compare February 13, 2018 05:32
@JinShil
Copy link
Contributor

JinShil commented Feb 14, 2018

It looks like this is causing the semaphore failure:

../dmd/generated/linux/release/32/dmd -conf= -I../druntime/import -w -de -dip25 -m32 -fPIC -transition=complex -O -release -unittest -version=StdUnittest -c -ofgenerated/linux/release/32/unittest/std/base64.o std/base64.d
src/rt/tracegc.d(43): Deprecation: The delete keyword has been deprecated. Use object.destroy() instead.

I don't understand why this wasn't caught by the test suite in #7342.

Furthermore, that block of code is in a version(none) block: https://github.com/dlang/druntime/blob/dd5fe6ff8398e7586bc005c3f4986834f211784e/src/rt/tracegc.d#L22-L84

I don't understand.

@marler8997
Copy link
Contributor Author

Are you sure that's the cause of the failure? It looks like it was a unit test failure in std.datetime.

****** FAIL release64 std.datetime.stopwatch
core.exception.AssertError@std/datetime/stopwatch.d(452): unittest failure
----------------
??:? _d_unittestp [0x20b672a1]
??:? nothrow @safe void std.datetime.stopwatch.__unittest_L442_C15() [0x205bfe83]
??:? void std.datetime.stopwatch.__modtest() [0x205c0314]
??:? [0x4014ab]
??:? [0x4013e3]
??:? [0x4012bb]
??:? runModuleUnitTests [0x20b67ddd]
??:? void rt.dmain2._d_run_main(int, char**, extern (C) int function(char[][])*).runAll() [0x20b85558]
??:? void rt.dmain2._d_run_main(int, char**, extern (C) int function(char[][])*).tryExec(scope void delegate()) [0x20b854e3]
??:? _d_run_main [0x20b8544e]
??:? [0x4017cb]
??:? __libc_start_main [0x217bef44]
make[1]: *** [unittest/std/datetime/stopwatch.run] Error 1
make[1]: *** Waiting for unfinished jobs....
0.203s PASS release64 std.datetime
stderr test, please ignore
6.569s PASS release64 std.process
3.202s PASS release64 std.datetime.systime
make[1]: Leaving directory `/home/runner/phobos'
make: *** [unittest-release] Error 2
make: Leaving directory `/home/runner/phobos'

@JinShil
Copy link
Contributor

JinShil commented Feb 14, 2018

Are you sure that's the cause of the failure?

Sorry, maybe my mistake. I was looking at the GDC DMD x86 log. But I see the std.datetime error in the DMD x86_64 log. Probably best to fix the std.datetime problem first and see what happens.

The option -i by itself is equivalent to:

$(CONSOLE dmd -i=-std,-core,-etc,-object)
$(CONSOLE dmd -i=-std -i=-core -i=-etc -i=-object)
Copy link
Contributor

Choose a reason for hiding this comment

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

We probably need to cherry-pick this to stable.

@marler8997 marler8997 changed the base branch from master to stable February 19, 2018 16:37
@dlang-bot dlang-bot merged commit b97d2db into dlang:stable Feb 20, 2018
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