Code Generation#
In addition to the many gcc options controlling code generation, gdc has several options specific to itself.
- -H#
Generates D interface files for all modules being compiled. The compiler determines the output file based on the name of the input file, removes any directory components and suffix, and applies the
.di
suffix.
- -Hd dir#
Same as
-H
, but writes interface files to directorydir
. This option can be used with-Hf file
to independently set the output file and directory path.
- -Hf file#
Same as
-H
but writes interface files tofile
. This option can be used with-Hd dir
to independently set the output file and directory path.
- -M#
Output the module dependencies of all source files being compiled in a format suitable for make. The compiler outputs one make rule containing the object file name for that source file, a colon, and the names of all imported files.
- -MF file#
When used with
-M
or-MM
, specifies afile
to write the dependencies to. When used with the driver options-MD
or-MMD
,-MF
overrides the default dependency output file.
- -MG#
This option is for compatibility with gcc, and is ignored by the compiler.
- -MP#
Outputs a phony target for each dependency other than the modules being compiled, causing each to depend on nothing.
- -MT target#
Change the
target
of the rule emitted by dependency generation to be exactly the string you specify. If you want multiple targets, you can specify them as a single argument to-MT
, or use multiple-MT
options.
- -MD#
This option is equivalent to
-M -MF file
. The driver determinesfile
by removing any directory components and suffix from the input file, and then adding a.deps
suffix.
- -MMD#
Like
-MD
but does not mention imported modules from the D standard library package directories.
- -X#
Output information describing the contents of all source files being compiled in JSON format to a file. The driver determines
file
by removing any directory components and suffix from the input file, and then adding a.json
suffix.
- -fdoc#
Generates
Ddoc
documentation and writes it to a file. The compiler determinesfile
by removing any directory components and suffix from the input file, and then adding a.html
suffix.
- -fdoc-dir=dir#
Same as
-fdoc
, but writes documentation to directorydir
. This option can be used with-fdoc-file=file
to independently set the output file and directory path.
- -fdoc-file=file#
Same as
-fdoc
, but writes documentation tofile
. This option can be used with-fdoc-dir=dir
to independently set the output file and directory path.
- -fdoc-inc=file#
Specify
file
as aDdoc
macro file to be read. Multiple-fdoc-inc
options can be used, and files are read and processed in the same order.
- -fdump-c++-spec=file#
For D source files, generate corresponding C++ declarations in
file
.
- -fdump-c++-spec-verbose#
In conjunction with
-fdump-c++-spec=
above, add comments for ignored declarations in the generated C++ header.
- -fsave-mixins=file#
Generates code expanded from D
mixin
statements and writes the processed sources tofile
. This is useful to debug errors in compilation and provides source for debuggers to show when requested.