Warnings#
Warnings are diagnostic messages that report constructions that
are not inherently erroneous but that are risky or suggest there
is likely to be a bug in the program. Unless -Werror
is
specified, they do not prevent compilation of the program.
- -Wall#
Turns on all warnings messages. Warnings are not a defined part of the D language, and all constructs for which this may generate a warning message are valid code.
- -Walloca#
This option warns on all uses of “alloca” in the source.
- -Walloca-larger-than=n#
Warn on unbounded uses of alloca, and on bounded uses of alloca whose bound can be larger than
n
bytes.-Wno-alloca-larger-than
disables-Walloca-larger-than
warning and is equivalent to-Walloca-larger-than=SIZE_MAX
or larger.
- -Wcast-result#
Warn about casts that will produce a null or zero result. Currently this is only done for casting between an imaginary and non-imaginary data type, or casting between a D and C++ class.
- -Wno-deprecated#
Do not warn about usage of deprecated features and symbols with
deprecated
attributes.
- -Werror#
Turns all warnings into errors.
- -Wspeculative#
List all error messages from speculative compiles, such as
__traits(compiles, ...)
. This option does not report messages as warnings, and these messages therefore never become errors when the-Werror
option is also used.
- -Wtemplates#
Warn when a template instantiation is encountered. Some coding rules disallow templates, and this may be used to enforce that rule.
- -Wunknown-pragmas#
Warn when a
pragma()
is encountered that is not understood by gdc. This differs from-fignore-unknown-pragmas
where a pragma that is part of the D language, but not implemented by the compiler, won’t get reported.
- -Wno-varargs#
Do not warn upon questionable usage of the macros used to handle variable arguments like
va_start
.
- -fignore-unknown-pragmas#
Turns off errors for unsupported pragmas.
- -fmax-errors=n#
Limits the maximum number of error messages to
n
, at which point gdc bails out rather than attempting to continue processing the source code. Ifn
is 0 (the default), there is no limit on the number of error messages produced.
- -fsyntax-only#
Check the code for syntax errors, but do not actually compile it. This can be used in conjunction with
-fdoc
or-H
to generate files for each module present on the command-line, but no other output file.
- -ftransition=id#
Report additional information about D language changes identified by
id
. The following values are supported:all
List information on all D language transitions.
complex
List all usages of complex or imaginary types.
field
List all non-mutable fields which occupy an object instance.
in
List all usages of
in
on parameter.nogc
List all hidden GC allocations.
templates
List statistics on template instantiations.
tls
List all variables going into thread local storage.
vmarkdown
List instances of Markdown replacements in Ddoc.