2 Copyright 1988-2022 Free Software Foundation, Inc.
3 This is part of the GCC manual.
4 For copying conditions, see the copyright.rst file.
6 .. index:: options to control warnings, warning messages, messages, warning, suppressing warnings
13 Warnings are diagnostic messages that report constructions that
14 are not inherently erroneous but that are risky or suggest there
15 is likely to be a bug in the program. Unless :option:`-Werror` is
16 specified, they do not prevent compilation of the program.
20 .. index:: -Wall, -Wno-all
22 Turns on all warnings messages. Warnings are not a defined part of
23 the D language, and all constructs for which this may generate a
24 warning message are valid code.
30 This option warns on all uses of "alloca" in the source.
32 .. option:: -Walloca-larger-than=n
34 .. index:: -Walloca-larger-than, -Wno-alloca-larger-than
36 Warn on unbounded uses of alloca, and on bounded uses of alloca
37 whose bound can be larger than :samp:`{n}` bytes.
38 :option:`-Wno-alloca-larger-than` disables
39 :option:`-Walloca-larger-than` warning and is equivalent to
40 :option:`-Walloca-larger-than=SIZE_MAX` or larger.
42 .. option:: -Wcast-result
44 .. index:: -Wcast-result, -Wno-cast-result
46 Warn about casts that will produce a null or zero result. Currently
47 this is only done for casting between an imaginary and non-imaginary
48 data type, or casting between a D and C++ class.
50 .. option:: -Wno-deprecated
52 .. index:: -Wdeprecated, -Wno-deprecated
54 Do not warn about usage of deprecated features and symbols with
55 ``deprecated`` attributes.
59 .. index:: -Werror, -Wno-error
61 Turns all warnings into errors.
63 .. option:: -Wspeculative
65 .. index:: -Wspeculative, -Wno-speculative
67 List all error messages from speculative compiles, such as
68 ``__traits(compiles, ...)``. This option does not report
69 messages as warnings, and these messages therefore never become
70 errors when the :option:`-Werror` option is also used.
72 .. option:: -Wtemplates
74 .. index:: -Wtemplates, -Wno-templates
76 Warn when a template instantiation is encountered. Some coding
77 rules disallow templates, and this may be used to enforce that rule.
79 .. option:: -Wunknown-pragmas
81 .. index:: -Wunknown-pragmas, -Wno-unknown-pragmas
83 Warn when a ``pragma()`` is encountered that is not understood by
84 :command:`gdc`. This differs from :option:`-fignore-unknown-pragmas`
85 where a pragma that is part of the D language, but not implemented by
86 the compiler, won't get reported.
88 .. option:: -Wno-varargs
90 .. index:: Wvarargs, Wno-varargs
92 Do not warn upon questionable usage of the macros used to handle variable
93 arguments like ``va_start``.
95 .. option:: -fignore-unknown-pragmas
97 .. index:: -fignore-unknown-pragmas, -fno-ignore-unknown-pragmas
99 Turns off errors for unsupported pragmas.
101 .. option:: -fmax-errors=n
103 .. index:: -fmax-errors
105 Limits the maximum number of error messages to :samp:`{n}`, at which point
106 :command:`gdc` bails out rather than attempting to continue processing the
107 source code. If :samp:`{n}` is 0 (the default), there is no limit on the
108 number of error messages produced.
110 .. option:: -fsyntax-only
112 .. index:: -fsyntax-only, -fno-syntax-only
114 Check the code for syntax errors, but do not actually compile it. This
115 can be used in conjunction with :option:`-fdoc` or :option:`-H` to generate
116 files for each module present on the command-line, but no other output
119 .. option:: -ftransition=id
121 .. index:: -ftransition
123 Report additional information about D language changes identified by
124 :samp:`{id}`. The following values are supported:
127 List information on all D language transitions.
130 List all usages of complex or imaginary types.
133 List all non-mutable fields which occupy an object instance.
136 List all usages of ``in`` on parameter.
139 List all hidden GC allocations.
142 List statistics on template instantiations.
145 List all variables going into thread local storage.
148 List instances of Markdown replacements in Ddoc.