Skip to content

Commit b3e02d4

Browse files
authored
[dmd/cli.d] More CLI option ddoc fixes (#22758)
1 parent 93c07cd commit b3e02d4

1 file changed

Lines changed: 52 additions & 47 deletions

File tree

compiler/src/dmd/cli.d

Lines changed: 52 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -259,23 +259,25 @@ struct Usage
259259
"use config file at <filename>"
260260
),
261261
Option("cov",
262-
"do code coverage analysis"
263-
),
264-
Option("cov=ctfe", "Include code executed during CTFE in coverage report"),
265-
Option("cov=<nnn>",
266-
"require at least <nnn>% code coverage",
262+
"perform code coverage and generate `.lst` file",
267263
`Perform $(LINK2 $(ROOT_DIR)code_coverage.html, code coverage analysis) and generate
268264
$(TT .lst) file with report.)
269265
---
270266
dmd -cov -unittest myprog.d
271267
---
272268
`,
273269
),
270+
Option("cov=ctfe", "Include code executed during CTFE in coverage report"),
271+
Option("cov=<nnn>",
272+
"require at least <nnn>% code coverage",
273+
"Perform code coverage analysis, requiring at least <nnn>% code coverage.
274+
Options can be combined, e.g. `-cov=100 -cov=ctfe`."
275+
),
274276
Option("cpp=<filename>",
275277
"use <filename> as the name of the C preprocessor to use for ImportC files",
276-
`Normally the C preprocessor used by the associated C compiler is used to
277-
preprocess ImportC files,
278-
this is overridden by the $(TT -cpp) switch.`
278+
`Sets the C preprocessor to <filename>.
279+
Normally the C preprocessor used by the associated C compiler is used to
280+
preprocess ImportC files.`
279281
),
280282
Option("D",
281283
"generate documentation",
@@ -309,7 +311,7 @@ dmd -cov -unittest myprog.d
309311
),
310312
Option("debug=<ident>",
311313
"compile in debug code identified by <ident>",
312-
`Compile in $(LINK2 spec/version.html#debug, debug identifier) $(I ident)`,
314+
`Compile in debug code with $(LINK2 spec/version.html#debug_specification, debug identifier) $(I ident)`,
313315
),
314316
Option("debuglib=<libname>",
315317
"set symbolic debug library to <libname>",
@@ -328,9 +330,7 @@ dmd -cov -unittest myprog.d
328330
),
329331
Option("deps=<filename>",
330332
"write module dependencies to <filename> (only imports)",
331-
`Without $(I filename), print module dependencies
332-
(imports/file/version/debug/lib).
333-
With $(I filename), write module dependencies as text to $(I filename)
333+
`Write module dependencies as text to $(I filename)
334334
(only imports).`,
335335
),
336336
Option("dllimport=[none|defaultLibsOnly|externalOnly|all]",
@@ -382,23 +382,26 @@ dmd -cov -unittest myprog.d
382382
),
383383
Option("ftime-trace",
384384
"turn on compile time profiler, generate JSON file with results",
385-
"Per function, the time to analyze it, call it from CTFE, generate code for it etc. will be measured,
386-
and events with a time longer than 500 microseconds (adjustable with `-ftime-trace-granularity`)
385+
"Measure the time to analyze, call from CTFE, and generate code for a function.
386+
Events with a time longer than 500 microseconds (adjustable with `-ftime-trace-granularity`)
387387
will be recorded.
388388
The profiling result is output in the Chrome Trace Event Format,
389389
$(LINK2 https://docs.google.com/document/d/1CvAClvFfyA5R-PhYUmn5OOQtYMH4h6I0nSsKchNAySU/preview, described here).
390390
This can be turned into a more readable text file with the included tool `timetrace2txt`, or inspected
391391
with an interactive viewer such as $(LINK2 https://ui.perfetto.dev/, Perfetto)."
392392
),
393-
Option("ftime-trace-granularity=",
393+
Option("ftime-trace-granularity=<μsecs>",
394394
"Minimum time granularity (in microseconds) traced by time profiler (default: 500)",
395-
"Measured events shorter than the specified time will be discarded from the output.
395+
"Minimum time granularity (in microseconds) traced by time profiler.
396+
The default is `500`.
397+
Measured events shorter than the specified time will be discarded from the output.
396398
Set it too high, and interesting events may not show up in the output.
397399
Set too low, and the profiler overhead will be larger, and the output will be cluttered with tiny events."
398400
),
399401
Option("ftime-trace-file=<filename>",
400402
"specify output file for `-ftime-trace`",
401-
"By default, the output name is the same as the first object file name, but with the `.time-trace` extension appended.
403+
"Specify output file for `-ftime-trace`.
404+
By default, the output name is the same as the first object file name, but with the `.time-trace` extension appended.
402405
A different filename can be chosen with this option, including a path relative to the current directory or an absolute path."
403406
),
404407
Option("g",
@@ -409,18 +412,19 @@ dmd -cov -unittest myprog.d
409412
)
410413
$(UNIX
411414
Add symbolic debug info in DWARF format
412-
for debuggers such as
413-
$(D gdb)
415+
for debuggers such as $(D gdb).
414416
)`,
415417
),
416418
Option("gdwarf=<version>",
417-
"add DWARF symbolic debug info",
418-
"The value of <version> may be 3, 4 or 5, defaulting to 3.",
419+
"add DWARF symbolic debug info (default: 3)",
420+
"Add DWARF symbolic debug info.
421+
The value of <version> may be 3, 4 or 5, defaulting to 3.",
419422
cast(TargetOS) (TargetOS.all & ~cast(uint)TargetOS.Windows)
420423
),
421424
Option("gf",
422425
"emit debug info for all referenced types",
423-
`Symbolic debug info is emitted for all types referenced by the compiled code,
426+
`Emit debug info for all referenced types.
427+
Symbolic debug info is emitted for all types referenced by the compiled code,
424428
even if the definition is in an imported file not currently being compiled.`,
425429
),
426430
Option("gs",
@@ -588,12 +592,12 @@ dmd -cov -unittest myprog.d
588592
),
589593
Option("J=<directory>",
590594
"look for string imports also in <directory>",
591-
`Where to look for files for
595+
"Where to look for files for
592596
$(LINK2 $(ROOT_DIR)spec/expression.html#ImportExpression, $(I ImportExpression))s.
593597
This switch is required in order to use $(I ImportExpression)s.
594-
$(I path) is a ; separated
598+
$(I directory) is a `;` separated
595599
list of paths. Multiple $(TT -J)'s can be used, and the paths
596-
are searched in the same order.`,
600+
are searched in the same order.",
597601
),
598602
Option("L=<linkerflag>",
599603
"pass <linkerflag> to link",
@@ -760,15 +764,17 @@ dmd -cov -unittest myprog.d
760764
),
761765
Option("op",
762766
"preserve source path for output files",
763-
`Normally the path for $(B .d) source files is stripped
767+
`Preserve source path for output files.
768+
Normally the path for $(B .d) source files is stripped
764769
off when generating an object, interface, or Ddoc file
765-
name. $(SWLINK -op) will leave it on.`,
770+
name.`,
766771
),
767772
Option("oq",
768773
"Write object files with fully qualified file names",
769-
`When compiling pkg/app.d, the resulting object file name will be pkg_app.obj
770-
instead of app.o. This helps to prevent name conflicts when compiling multiple
771-
packages in the same directory with the $(SWLINK -od) flag.`,
774+
"Write object files with fully qualified file names.
775+
When compiling `pkg/app.d`, the resulting object file name will be `pkg_app.o`
776+
instead of `app.o`. This helps to prevent name conflicts when compiling multiple
777+
packages in the same directory with the $(SWLINK -od) flag.",
772778
),
773779
Option("os=<os>",
774780
"sets target operating system to <os>",
@@ -786,9 +792,9 @@ dmd -cov -unittest myprog.d
786792
),
787793
Option("P=<preprocessorflag>",
788794
"pass <preprocessorflag> to C preprocessor",
789-
`Pass $(I preprocessorflag) to
790-
$(WINDOWS cl.exe)
791-
$(UNIX cpp)`,
795+
"Pass $(I preprocessorflag) to
796+
$(WINDOWS `cl.exe`)
797+
$(UNIX `cpp`). See also $(SWLINK -cpp)",
792798
),
793799
Option("preview=<name>",
794800
"enable an upcoming language change identified by <name>",
@@ -802,7 +808,7 @@ dmd -cov -unittest myprog.d
802808
`Instrument the generated code so that runtime performance data is collected
803809
when the generated program is run.
804810
Upon completion of the generated program, the files $(TT trace.log) and $(TT trace.def)
805-
are generated. $(TT trace.log) has two sections,
811+
are generated. $(TT trace.log) has two sections:
806812
$(OL
807813
$(LI Fan in and fan out for each profiled function. The name of the function is left-justified,
808814
the functions immediately preceding it are the other functions that call it (fan in) and how many times
@@ -816,13 +822,12 @@ dmd -cov -unittest myprog.d
816822
)
817823
The $(TT trace.def) file contains linker commands to associate functions which are strongly coupled
818824
so they appear adjacent in the resulting executable file.
819-
For more information see $(LINK2 https://www.digitalmars.com/ctg/trace.html, profile)
825+
For more information see $(LINK2 https://www.digitalmars.com/ctg/trace.html, profile).
820826
`,
821827
),
822828
Option("profile=gc",
823829
"profile runtime allocations",
824-
`$(UL
825-
$(LI $(B gc): Instrument calls to GC memory allocation and
830+
`Instrument calls to GC memory allocation and
826831
write a report to the file $(TT profilegc.log) upon program
827832
termination. $(B Note:) Only instrumented calls will be
828833
logged. These include:
@@ -832,8 +837,8 @@ dmd -cov -unittest myprog.d
832837
$(LI GC allocations via core.memory.GC)
833838
)
834839
Allocations made by other means will not be logged,
835-
including direct calls to the GC's C API.)
836-
)`,
840+
including direct calls to the GC's C API.
841+
`,
837842
),
838843
Option("release",
839844
"contracts and asserts are not emitted, and bounds checking is performed only in @safe functions",
@@ -849,7 +854,7 @@ dmd -cov -unittest myprog.d
849854
Option("revert=[h|help|?]",
850855
"list all revertable language changes"
851856
),
852-
Option("run <srcfile>",
857+
Option("run <srcfile> <args>",
853858
"compile, link, and run the program <srcfile>",
854859
`Compile, link, and run the program $(I srcfile) with the
855860
rest of the
@@ -924,7 +929,7 @@ dmd -cov -unittest myprog.d
924929
)`,
925930
),
926931
Option("verrors=spec",
927-
"show errors from speculative compiles such as __traits(compiles,...)"
932+
"show errors from speculative compiles such as `__traits(compiles, ...)`"
928933
),
929934
Option("-version",
930935
"print compiler version and exit"
@@ -934,7 +939,7 @@ dmd -cov -unittest myprog.d
934939
`Compile in $(LINK2 $(ROOT_DIR)spec/version.html#version, version identifier) $(I ident)`
935940
),
936941
Option("vgc",
937-
"list all gc allocations including hidden ones"
942+
"list all GC allocations including hidden ones"
938943
),
939944
Option("visibility=[default|hidden|public]",
940945
"default visibility of symbols",
@@ -947,10 +952,10 @@ dmd -cov -unittest myprog.d
947952
Option("vtls",
948953
"list all variables going into thread local storage"
949954
),
950-
Option("vtemplates=[list-instances]",
955+
Option("vtemplates[=list-instances]",
951956
"list statistics on template instantiations",
952-
`An optional argument determines extra diagnostics,
953-
where:
957+
`List statistics on template instantiations.
958+
An optional argument determines extra diagnostics:
954959
$(DL
955960
$(DT list-instances)$(DD Also shows all instantiation contexts for each template.)
956961
)`,
@@ -961,8 +966,8 @@ dmd -cov -unittest myprog.d
961966
),
962967
Option("wi",
963968
"warnings as messages (compilation will continue)",
964-
`Enable $(LINK2 $(ROOT_DIR)articles/warnings.html, informational warnings (i.e. compilation
965-
still proceeds normally))`,
969+
`Enable $(LINK2 $(ROOT_DIR)articles/warnings.html, informational warnings) (i.e. compilation
970+
still proceeds normally)`,
966971
),
967972
Option("wo",
968973
"warnings about use of obsolete features (compilation will continue)",

0 commit comments

Comments
 (0)