1 @c Copyright (C) 1999-2020 Free Software Foundation, Inc.
2 @c This is part of the CPP and GCC manuals.
3 @c For copying conditions, see the file gcc.texi.
5 @c ---------------------------------------------------------------------
6 @c Options affecting preprocessor warnings
7 @c ---------------------------------------------------------------------
9 @c If this file is included with the flag ``cppmanual'' set, it is
10 @c formatted for inclusion in the CPP manual; otherwise the main GCC manual.
16 Warn whenever a comment-start sequence @samp{/*} appears in a @samp{/*}
17 comment, or whenever a backslash-newline appears in a @samp{//} comment.
18 This warning is enabled by @option{-Wall}.
23 Warn if any trigraphs are encountered that might change the meaning of
24 the program. Trigraphs within comments are not warned about,
25 except those that would form escaped newlines.
27 This option is implied by @option{-Wall}. If @option{-Wall} is not
28 given, this option is still enabled unless trigraphs are enabled. To
29 get trigraph conversion without warnings, but get the other
30 @option{-Wall} warnings, use @samp{-trigraphs -Wall -Wno-trigraphs}.
35 Warn if an undefined identifier is evaluated in an @code{#if} directive.
36 Such identifiers are replaced with zero.
38 @item -Wexpansion-to-defined
39 @opindex Wexpansion-to-defined
40 Warn whenever @samp{defined} is encountered in the expansion of a macro
41 (including the case where the macro is expanded by an @samp{#if} directive).
42 Such usage is not portable.
43 This warning is also enabled by @option{-Wpedantic} and @option{-Wextra}.
46 @opindex Wunused-macros
47 Warn about macros defined in the main file that are unused. A macro
48 is @dfn{used} if it is expanded or tested for existence at least once.
49 The preprocessor also warns if the macro has not been used at the
50 time it is redefined or undefined.
52 Built-in macros, macros defined on the command line, and macros
53 defined in include files are not warned about.
55 @emph{Note:} If a macro is actually used, but only used in skipped
56 conditional blocks, then the preprocessor reports it as unused. To avoid the
57 warning in such a case, you might improve the scope of the macro's
58 definition by, for example, moving it into the first skipped block.
59 Alternatively, you could provide a dummy use with something like:
62 #if defined the_macro_causing_the_warning
66 @item -Wno-endif-labels
67 @opindex Wno-endif-labels
68 @opindex Wendif-labels
69 Do not warn whenever an @code{#else} or an @code{#endif} are followed by text.
70 This sometimes happens in older programs with code of the form
81 The second and third @code{FOO} should be in comments.
82 This warning is on by default.