Warnings (The GNU D Compiler)

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

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

`-Wno-builtin-declaration-mismatch` ¶

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

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

`-Wextra` ¶

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

      -Waddress
      -Wcast-result
      -Wmismatched-special-enum
      -Wunknown-pragmas

`-Wmismatched-special-enum` ¶

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

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

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

`-fno-ignore-unknown-pragmas` ¶

  Do not recognize unsupported pragmas. Any `pragma()` encountered that is not part of the D language will result in an error. This option is now deprecated and will be removed in a future release.

`-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. If n 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.