rs6000, change altivec*-runnable.c test file names
[official-gcc.git] / gcc / doc / cppwarnopts.texi
blob343792102e9688e6bcfc76f991a79c608c95efef
1 @c Copyright (C) 1999-2024 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.
12 @opindex Wcomment
13 @opindex Wcomments
14 @item -Wcomment
15 @itemx -Wcomments
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}.
20 @opindex Wtrigraphs
21 @item -Wtrigraphs
22 @anchor{Wtrigraphs}
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}.
32 @opindex Wundef
33 @opindex Wno-undef
34 @item -Wundef
35 Warn if an undefined identifier is evaluated in an @code{#if} directive.
36 Such identifiers are replaced with zero.
38 @opindex Wexpansion-to-defined
39 @item -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}.
45 @opindex Wunused-macros
46 @item -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:
61 @smallexample
62 #if defined the_macro_causing_the_warning
63 #endif
64 @end smallexample
66 @opindex Wno-endif-labels
67 @opindex Wendif-labels
68 @item -Wno-endif-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
72 @smallexample
73 #if FOO
74 @dots{}
75 #else FOO
76 @dots{}
77 #endif FOO
78 @end smallexample
80 @noindent
81 The second and third @code{FOO} should be in comments.
82 This warning is on by default.