1.5 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.


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.


This option warns on all uses of "alloca" in the source.


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.


Warn if a built-in function is declared with an incompatible signature.


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.


Do not warn about usage of deprecated features and symbols with deprecated attributes.


Turns all warnings into errors.


This enables some extra warning flags that are not enabled by -Wall.


Warn when an enum the compiler recognizes as special is declared with a different size to the built-in type it is representing.


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.


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.


Do not warn upon questionable usage of the macros used to handle variable arguments like va_start.


Turns off errors for unsupported pragmas.


Limits the maximum number of error messages to n, at which point gdc bails out rather than attempting to continue processing the source code. If n is 0 (the default), there is no limit on the number of error messages produced.


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.


Report additional information about D language changes identified by id. The following values are supported:


List information on all D language transitions.


List all usages of complex or imaginary types.


List all non-mutable fields which occupy an object instance.


List all usages of in on parameter.


List all hidden GC allocations.


List statistics on template instantiations.


List all variables going into thread local storage.