<html lang="en"> <head> <title>Warning Options - Using the GNU Compiler Collection (GCC)</title> <meta http-equiv="Content-Type" content="text/html"> <meta name="description" content="Using the GNU Compiler Collection (GCC)"> <meta name="generator" content="makeinfo 4.13"> <link title="Top" rel="start" href="index.html#Top"> <link rel="up" href="Invoking-GCC.html#Invoking-GCC" title="Invoking GCC"> <link rel="prev" href="Language-Independent-Options.html#Language-Independent-Options" title="Language Independent Options"> <link rel="next" href="Debugging-Options.html#Debugging-Options" title="Debugging Options"> <link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage"> <!-- Copyright (C) 1988-2015 Free Software Foundation, Inc. Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.3 or any later version published by the Free Software Foundation; with the Invariant Sections being ``Funding Free Software'', the Front-Cover Texts being (a) (see below), and with the Back-Cover Texts being (b) (see below). A copy of the license is included in the section entitled ``GNU Free Documentation License''. (a) The FSF's Front-Cover Text is: A GNU Manual (b) The FSF's Back-Cover Text is: You have freedom to copy and modify this GNU Manual, like GNU software. Copies published by the Free Software Foundation raise funds for GNU development.--> <meta http-equiv="Content-Style-Type" content="text/css"> <style type="text/css"><!-- pre.display { font-family:inherit } pre.format { font-family:inherit } pre.smalldisplay { font-family:inherit; font-size:smaller } pre.smallformat { font-family:inherit; font-size:smaller } pre.smallexample { font-size:smaller } pre.smalllisp { font-size:smaller } span.sc { font-variant:small-caps } span.roman { font-family:serif; font-weight:normal; } span.sansserif { font-family:sans-serif; font-weight:normal; } --></style> </head> <body> <div class="node"> <a name="Warning-Options"></a> <p> Next: <a rel="next" accesskey="n" href="Debugging-Options.html#Debugging-Options">Debugging Options</a>, Previous: <a rel="previous" accesskey="p" href="Language-Independent-Options.html#Language-Independent-Options">Language Independent Options</a>, Up: <a rel="up" accesskey="u" href="Invoking-GCC.html#Invoking-GCC">Invoking GCC</a> <hr> </div> <h3 class="section">3.8 Options to Request or Suppress Warnings</h3> <p><a name="index-options-to-control-warnings-275"></a><a name="index-warning-messages-276"></a><a name="index-messages_002c-warning-277"></a><a name="index-suppressing-warnings-278"></a> Warnings are diagnostic messages that report constructions that are not inherently erroneous but that are risky or suggest there may have been an error. <p>The following language-independent options do not enable specific warnings but control the kinds of diagnostics produced by GCC. <a name="index-syntax-checking-279"></a> <dl><dt><code>-fsyntax-only</code><dd><a name="index-fsyntax_002donly-280"></a>Check the code for syntax errors, but don't do anything beyond that. <br><dt><code>-fmax-errors=</code><var>n</var><dd><a name="index-fmax_002derrors-281"></a>Limits the maximum number of error messages to <var>n</var>, at which point GCC bails out rather than attempting to continue processing the source code. If <var>n</var> is 0 (the default), there is no limit on the number of error messages produced. If <samp><span class="option">-Wfatal-errors</span></samp> is also specified, then <samp><span class="option">-Wfatal-errors</span></samp> takes precedence over this option. <br><dt><code>-w</code><dd><a name="index-w-282"></a>Inhibit all warning messages. <br><dt><code>-Werror</code><dd><a name="index-Werror-283"></a><a name="index-Wno_002derror-284"></a>Make all warnings into errors. <br><dt><code>-Werror=</code><dd><a name="index-Werror_003d-285"></a><a name="index-Wno_002derror_003d-286"></a>Make the specified warning into an error. The specifier for a warning is appended; for example <samp><span class="option">-Werror=switch</span></samp> turns the warnings controlled by <samp><span class="option">-Wswitch</span></samp> into errors. This switch takes a negative form, to be used to negate <samp><span class="option">-Werror</span></samp> for specific warnings; for example <samp><span class="option">-Wno-error=switch</span></samp> makes <samp><span class="option">-Wswitch</span></samp> warnings not be errors, even when <samp><span class="option">-Werror</span></samp> is in effect. <p>The warning message for each controllable warning includes the option that controls the warning. That option can then be used with <samp><span class="option">-Werror=</span></samp> and <samp><span class="option">-Wno-error=</span></samp> as described above. (Printing of the option in the warning message can be disabled using the <samp><span class="option">-fno-diagnostics-show-option</span></samp> flag.) <p>Note that specifying <samp><span class="option">-Werror=</span></samp><var>foo</var> automatically implies <samp><span class="option">-W</span></samp><var>foo</var>. However, <samp><span class="option">-Wno-error=</span></samp><var>foo</var> does not imply anything. <br><dt><code>-Wfatal-errors</code><dd><a name="index-Wfatal_002derrors-287"></a><a name="index-Wno_002dfatal_002derrors-288"></a>This option causes the compiler to abort compilation on the first error occurred rather than trying to keep going and printing further error messages. </dl> <p>You can request many specific warnings with options beginning with ‘<samp><span class="samp">-W</span></samp>’, for example <samp><span class="option">-Wimplicit</span></samp> to request warnings on implicit declarations. Each of these specific warning options also has a negative form beginning ‘<samp><span class="samp">-Wno-</span></samp>’ to turn off warnings; for example, <samp><span class="option">-Wno-implicit</span></samp>. This manual lists only one of the two forms, whichever is not the default. For further language-specific options also refer to <a href="C_002b_002b-Dialect-Options.html#C_002b_002b-Dialect-Options">C++ Dialect Options</a> and <a href="Objective_002dC-and-Objective_002dC_002b_002b-Dialect-Options.html#Objective_002dC-and-Objective_002dC_002b_002b-Dialect-Options">Objective-C and Objective-C++ Dialect Options</a>. <p>Some options, such as <samp><span class="option">-Wall</span></samp> and <samp><span class="option">-Wextra</span></samp>, turn on other options, such as <samp><span class="option">-Wunused</span></samp>, which may turn on further options, such as <samp><span class="option">-Wunused-value</span></samp>. The combined effect of positive and negative forms is that more specific options have priority over less specific ones, independently of their position in the command-line. For options of the same specificity, the last one takes effect. Options enabled or disabled via pragmas (see <a href="Diagnostic-Pragmas.html#Diagnostic-Pragmas">Diagnostic Pragmas</a>) take effect as if they appeared at the end of the command-line. <p>When an unrecognized warning option is requested (e.g., <samp><span class="option">-Wunknown-warning</span></samp>), GCC emits a diagnostic stating that the option is not recognized. However, if the <samp><span class="option">-Wno-</span></samp> form is used, the behavior is slightly different: no diagnostic is produced for <samp><span class="option">-Wno-unknown-warning</span></samp> unless other diagnostics are being produced. This allows the use of new <samp><span class="option">-Wno-</span></samp> options with old compilers, but if something goes wrong, the compiler warns that an unrecognized option is present. <dl> <dt><code>-Wpedantic</code><dt><code>-pedantic</code><dd><a name="index-pedantic-289"></a><a name="index-Wpedantic-290"></a>Issue all the warnings demanded by strict ISO C and ISO C++; reject all programs that use forbidden extensions, and some other programs that do not follow ISO C and ISO C++. For ISO C, follows the version of the ISO C standard specified by any <samp><span class="option">-std</span></samp> option used. <p>Valid ISO C and ISO C++ programs should compile properly with or without this option (though a rare few require <samp><span class="option">-ansi</span></samp> or a <samp><span class="option">-std</span></samp> option specifying the required version of ISO C). However, without this option, certain GNU extensions and traditional C and C++ features are supported as well. With this option, they are rejected. <p><samp><span class="option">-Wpedantic</span></samp> does not cause warning messages for use of the alternate keywords whose names begin and end with ‘<samp><span class="samp">__</span></samp>’. Pedantic warnings are also disabled in the expression that follows <code>__extension__</code>. However, only system header files should use these escape routes; application programs should avoid them. See <a href="Alternate-Keywords.html#Alternate-Keywords">Alternate Keywords</a>. <p>Some users try to use <samp><span class="option">-Wpedantic</span></samp> to check programs for strict ISO C conformance. They soon find that it does not do quite what they want: it finds some non-ISO practices, but not all—only those for which ISO C <em>requires</em> a diagnostic, and some others for which diagnostics have been added. <p>A feature to report any failure to conform to ISO C might be useful in some instances, but would require considerable additional work and would be quite different from <samp><span class="option">-Wpedantic</span></samp>. We don't have plans to support such a feature in the near future. <p>Where the standard specified with <samp><span class="option">-std</span></samp> represents a GNU extended dialect of C, such as ‘<samp><span class="samp">gnu90</span></samp>’ or ‘<samp><span class="samp">gnu99</span></samp>’, there is a corresponding <dfn>base standard</dfn>, the version of ISO C on which the GNU extended dialect is based. Warnings from <samp><span class="option">-Wpedantic</span></samp> are given where they are required by the base standard. (It does not make sense for such warnings to be given only for features not in the specified GNU C dialect, since by definition the GNU dialects of C include all features the compiler supports with the given option, and there would be nothing to warn about.) <br><dt><code>-pedantic-errors</code><dd><a name="index-pedantic_002derrors-291"></a>Give an error whenever the <dfn>base standard</dfn> (see <samp><span class="option">-Wpedantic</span></samp>) requires a diagnostic, in some cases where there is undefined behavior at compile-time and in some other cases that do not prevent compilation of programs that are valid according to the standard. This is not equivalent to <samp><span class="option">-Werror=pedantic</span></samp>, since there are errors enabled by this option and not enabled by the latter and vice versa. <br><dt><code>-Wall</code><dd><a name="index-Wall-292"></a><a name="index-Wno_002dall-293"></a>This enables all the warnings about constructions that some users consider questionable, and that are easy to avoid (or modify to prevent the warning), even in conjunction with macros. This also enables some language-specific warnings described in <a href="C_002b_002b-Dialect-Options.html#C_002b_002b-Dialect-Options">C++ Dialect Options</a> and <a href="Objective_002dC-and-Objective_002dC_002b_002b-Dialect-Options.html#Objective_002dC-and-Objective_002dC_002b_002b-Dialect-Options">Objective-C and Objective-C++ Dialect Options</a>. <p><samp><span class="option">-Wall</span></samp> turns on the following warning flags: <pre class="smallexample"> -Waddress -Warray-bounds=1 <span class="roman">(only with</span> <samp><span class="option">-O2</span></samp><span class="roman">)</span> -Wc++11-compat -Wc++14-compat -Wchar-subscripts -Wenum-compare <span class="roman">(in C/ObjC; this is on by default in C++)</span> -Wimplicit-int <span class="roman">(C and Objective-C only)</span> -Wimplicit-function-declaration <span class="roman">(C and Objective-C only)</span> -Wcomment -Wformat -Wmain <span class="roman">(only for C/ObjC and unless</span> <samp><span class="option">-ffreestanding</span></samp><span class="roman">)</span> -Wmaybe-uninitialized -Wmissing-braces <span class="roman">(only for C/ObjC)</span> -Wnonnull -Wopenmp-simd -Wparentheses -Wpointer-sign -Wreorder -Wreturn-type -Wsequence-point -Wsign-compare <span class="roman">(only in C++)</span> -Wstrict-aliasing -Wstrict-overflow=1 -Wswitch -Wtrigraphs -Wuninitialized -Wunknown-pragmas -Wunused-function -Wunused-label -Wunused-value -Wunused-variable -Wvolatile-register-var </pre> <p>Note that some warning flags are not implied by <samp><span class="option">-Wall</span></samp>. Some of them warn about constructions that users generally do not consider questionable, but which occasionally you might wish to check for; others warn about constructions that are necessary or hard to avoid in some cases, and there is no simple way to modify the code to suppress the warning. Some of them are enabled by <samp><span class="option">-Wextra</span></samp> but many of them must be enabled individually. <br><dt><code>-Wextra</code><dd><a name="index-W-294"></a><a name="index-Wextra-295"></a><a name="index-Wno_002dextra-296"></a>This enables some extra warning flags that are not enabled by <samp><span class="option">-Wall</span></samp>. (This option used to be called <samp><span class="option">-W</span></samp>. The older name is still supported, but the newer name is more descriptive.) <pre class="smallexample"> -Wclobbered -Wempty-body -Wignored-qualifiers -Wmissing-field-initializers -Wmissing-parameter-type <span class="roman">(C only)</span> -Wold-style-declaration <span class="roman">(C only)</span> -Woverride-init -Wsign-compare -Wtype-limits -Wuninitialized -Wunused-parameter <span class="roman">(only with</span> <samp><span class="option">-Wunused</span></samp> <span class="roman">or</span> <samp><span class="option">-Wall</span></samp><span class="roman">)</span> -Wunused-but-set-parameter <span class="roman">(only with</span> <samp><span class="option">-Wunused</span></samp> <span class="roman">or</span> <samp><span class="option">-Wall</span></samp><span class="roman">)</span> </pre> <p>The option <samp><span class="option">-Wextra</span></samp> also prints warning messages for the following cases: <ul> <li>A pointer is compared against integer zero with <code><</code>, <code><=</code>, <code>></code>, or <code>>=</code>. <li>(C++ only) An enumerator and a non-enumerator both appear in a conditional expression. <li>(C++ only) Ambiguous virtual bases. <li>(C++ only) Subscripting an array that has been declared <code>register</code>. <li>(C++ only) Taking the address of a variable that has been declared <code>register</code>. <li>(C++ only) A base class is not initialized in a derived class's copy constructor. </ul> <br><dt><code>-Wchar-subscripts</code><dd><a name="index-Wchar_002dsubscripts-297"></a><a name="index-Wno_002dchar_002dsubscripts-298"></a>Warn if an array subscript has type <code>char</code>. This is a common cause of error, as programmers often forget that this type is signed on some machines. This warning is enabled by <samp><span class="option">-Wall</span></samp>. <br><dt><code>-Wcomment</code><dd><a name="index-Wcomment-299"></a><a name="index-Wno_002dcomment-300"></a>Warn whenever a comment-start sequence ‘<samp><span class="samp">/*</span></samp>’ appears in a ‘<samp><span class="samp">/*</span></samp>’ comment, or whenever a Backslash-Newline appears in a ‘<samp><span class="samp">//</span></samp>’ comment. This warning is enabled by <samp><span class="option">-Wall</span></samp>. <br><dt><code>-Wno-coverage-mismatch</code><dd><a name="index-Wno_002dcoverage_002dmismatch-301"></a>Warn if feedback profiles do not match when using the <samp><span class="option">-fprofile-use</span></samp> option. If a source file is changed between compiling with <samp><span class="option">-fprofile-gen</span></samp> and with <samp><span class="option">-fprofile-use</span></samp>, the files with the profile feedback can fail to match the source file and GCC cannot use the profile feedback information. By default, this warning is enabled and is treated as an error. <samp><span class="option">-Wno-coverage-mismatch</span></samp> can be used to disable the warning or <samp><span class="option">-Wno-error=coverage-mismatch</span></samp> can be used to disable the error. Disabling the error for this warning can result in poorly optimized code and is useful only in the case of very minor changes such as bug fixes to an existing code-base. Completely disabling the warning is not recommended. <br><dt><code>-Wno-cpp</code><dd><span class="roman">(C, Objective-C, C++, Objective-C++ and Fortran only)</span> <p>Suppress warning messages emitted by <code>#warning</code> directives. <br><dt><code>-Wdouble-promotion </code><span class="roman">(C, C++, Objective-C and Objective-C++ only)</span><dd><a name="index-Wdouble_002dpromotion-302"></a><a name="index-Wno_002ddouble_002dpromotion-303"></a>Give a warning when a value of type <code>float</code> is implicitly promoted to <code>double</code>. CPUs with a 32-bit “single-precision” floating-point unit implement <code>float</code> in hardware, but emulate <code>double</code> in software. On such a machine, doing computations using <code>double</code> values is much more expensive because of the overhead required for software emulation. <p>It is easy to accidentally do computations with <code>double</code> because floating-point literals are implicitly of type <code>double</code>. For example, in: <pre class="smallexample"> float area(float radius) { return 3.14159 * radius * radius; } </pre> <p>the compiler performs the entire computation with <code>double</code> because the floating-point literal is a <code>double</code>. <br><dt><code>-Wformat</code><dt><code>-Wformat=</code><var>n</var><dd><a name="index-Wformat-304"></a><a name="index-Wno_002dformat-305"></a><a name="index-ffreestanding-306"></a><a name="index-fno_002dbuiltin-307"></a><a name="index-Wformat_003d-308"></a>Check calls to <code>printf</code> and <code>scanf</code>, etc., to make sure that the arguments supplied have types appropriate to the format string specified, and that the conversions specified in the format string make sense. This includes standard functions, and others specified by format attributes (see <a href="Function-Attributes.html#Function-Attributes">Function Attributes</a>), in the <code>printf</code>, <code>scanf</code>, <code>strftime</code> and <code>strfmon</code> (an X/Open extension, not in the C standard) families (or other target-specific families). Which functions are checked without format attributes having been specified depends on the standard version selected, and such checks of functions without the attribute specified are disabled by <samp><span class="option">-ffreestanding</span></samp> or <samp><span class="option">-fno-builtin</span></samp>. <p>The formats are checked against the format features supported by GNU libc version 2.2. These include all ISO C90 and C99 features, as well as features from the Single Unix Specification and some BSD and GNU extensions. Other library implementations may not support all these features; GCC does not support warning about features that go beyond a particular library's limitations. However, if <samp><span class="option">-Wpedantic</span></samp> is used with <samp><span class="option">-Wformat</span></samp>, warnings are given about format features not in the selected standard version (but not for <code>strfmon</code> formats, since those are not in any version of the C standard). See <a href="C-Dialect-Options.html#C-Dialect-Options">Options Controlling C Dialect</a>. <dl> <dt><code>-Wformat=1</code><dt><code>-Wformat</code><dd><a name="index-Wformat-309"></a><a name="index-Wformat_003d1-310"></a>Option <samp><span class="option">-Wformat</span></samp> is equivalent to <samp><span class="option">-Wformat=1</span></samp>, and <samp><span class="option">-Wno-format</span></samp> is equivalent to <samp><span class="option">-Wformat=0</span></samp>. Since <samp><span class="option">-Wformat</span></samp> also checks for null format arguments for several functions, <samp><span class="option">-Wformat</span></samp> also implies <samp><span class="option">-Wnonnull</span></samp>. Some aspects of this level of format checking can be disabled by the options: <samp><span class="option">-Wno-format-contains-nul</span></samp>, <samp><span class="option">-Wno-format-extra-args</span></samp>, and <samp><span class="option">-Wno-format-zero-length</span></samp>. <samp><span class="option">-Wformat</span></samp> is enabled by <samp><span class="option">-Wall</span></samp>. <br><dt><code>-Wno-format-contains-nul</code><dd><a name="index-Wno_002dformat_002dcontains_002dnul-311"></a><a name="index-Wformat_002dcontains_002dnul-312"></a>If <samp><span class="option">-Wformat</span></samp> is specified, do not warn about format strings that contain NUL bytes. <br><dt><code>-Wno-format-extra-args</code><dd><a name="index-Wno_002dformat_002dextra_002dargs-313"></a><a name="index-Wformat_002dextra_002dargs-314"></a>If <samp><span class="option">-Wformat</span></samp> is specified, do not warn about excess arguments to a <code>printf</code> or <code>scanf</code> format function. The C standard specifies that such arguments are ignored. <p>Where the unused arguments lie between used arguments that are specified with ‘<samp><span class="samp">$</span></samp>’ operand number specifications, normally warnings are still given, since the implementation could not know what type to pass to <code>va_arg</code> to skip the unused arguments. However, in the case of <code>scanf</code> formats, this option suppresses the warning if the unused arguments are all pointers, since the Single Unix Specification says that such unused arguments are allowed. <br><dt><code>-Wno-format-zero-length</code><dd><a name="index-Wno_002dformat_002dzero_002dlength-315"></a><a name="index-Wformat_002dzero_002dlength-316"></a>If <samp><span class="option">-Wformat</span></samp> is specified, do not warn about zero-length formats. The C standard specifies that zero-length formats are allowed. <br><dt><code>-Wformat=2</code><dd><a name="index-Wformat_003d2-317"></a>Enable <samp><span class="option">-Wformat</span></samp> plus additional format checks. Currently equivalent to <samp><span class="option">-Wformat -Wformat-nonliteral -Wformat-security -Wformat-y2k</span></samp>. <br><dt><code>-Wformat-nonliteral</code><dd><a name="index-Wformat_002dnonliteral-318"></a><a name="index-Wno_002dformat_002dnonliteral-319"></a>If <samp><span class="option">-Wformat</span></samp> is specified, also warn if the format string is not a string literal and so cannot be checked, unless the format function takes its format arguments as a <code>va_list</code>. <br><dt><code>-Wformat-security</code><dd><a name="index-Wformat_002dsecurity-320"></a><a name="index-Wno_002dformat_002dsecurity-321"></a>If <samp><span class="option">-Wformat</span></samp> is specified, also warn about uses of format functions that represent possible security problems. At present, this warns about calls to <code>printf</code> and <code>scanf</code> functions where the format string is not a string literal and there are no format arguments, as in <code>printf (foo);</code>. This may be a security hole if the format string came from untrusted input and contains ‘<samp><span class="samp">%n</span></samp>’. (This is currently a subset of what <samp><span class="option">-Wformat-nonliteral</span></samp> warns about, but in future warnings may be added to <samp><span class="option">-Wformat-security</span></samp> that are not included in <samp><span class="option">-Wformat-nonliteral</span></samp>.) <br><dt><code>-Wformat-signedness</code><dd><a name="index-Wformat_002dsignedness-322"></a><a name="index-Wno_002dformat_002dsignedness-323"></a>If <samp><span class="option">-Wformat</span></samp> is specified, also warn if the format string requires an unsigned argument and the argument is signed and vice versa. <br><dt><code>-Wformat-y2k</code><dd><a name="index-Wformat_002dy2k-324"></a><a name="index-Wno_002dformat_002dy2k-325"></a>If <samp><span class="option">-Wformat</span></samp> is specified, also warn about <code>strftime</code> formats that may yield only a two-digit year. </dl> <br><dt><code>-Wnonnull</code><dd><a name="index-Wnonnull-326"></a><a name="index-Wno_002dnonnull-327"></a>Warn about passing a null pointer for arguments marked as requiring a non-null value by the <code>nonnull</code> function attribute. <p><samp><span class="option">-Wnonnull</span></samp> is included in <samp><span class="option">-Wall</span></samp> and <samp><span class="option">-Wformat</span></samp>. It can be disabled with the <samp><span class="option">-Wno-nonnull</span></samp> option. <br><dt><code>-Winit-self </code><span class="roman">(C, C++, Objective-C and Objective-C++ only)</span><dd><a name="index-Winit_002dself-328"></a><a name="index-Wno_002dinit_002dself-329"></a>Warn about uninitialized variables that are initialized with themselves. Note this option can only be used with the <samp><span class="option">-Wuninitialized</span></samp> option. <p>For example, GCC warns about <code>i</code> being uninitialized in the following snippet only when <samp><span class="option">-Winit-self</span></samp> has been specified: <pre class="smallexample"> int f() { int i = i; return i; } </pre> <p>This warning is enabled by <samp><span class="option">-Wall</span></samp> in C++. <br><dt><code>-Wimplicit-int </code><span class="roman">(C and Objective-C only)</span><dd><a name="index-Wimplicit_002dint-330"></a><a name="index-Wno_002dimplicit_002dint-331"></a>Warn when a declaration does not specify a type. This warning is enabled by <samp><span class="option">-Wall</span></samp>. <br><dt><code>-Wimplicit-function-declaration </code><span class="roman">(C and Objective-C only)</span><dd><a name="index-Wimplicit_002dfunction_002ddeclaration-332"></a><a name="index-Wno_002dimplicit_002dfunction_002ddeclaration-333"></a>Give a warning whenever a function is used before being declared. In C99 mode (<samp><span class="option">-std=c99</span></samp> or <samp><span class="option">-std=gnu99</span></samp>), this warning is enabled by default and it is made into an error by <samp><span class="option">-pedantic-errors</span></samp>. This warning is also enabled by <samp><span class="option">-Wall</span></samp>. <br><dt><code>-Wimplicit </code><span class="roman">(C and Objective-C only)</span><dd><a name="index-Wimplicit-334"></a><a name="index-Wno_002dimplicit-335"></a>Same as <samp><span class="option">-Wimplicit-int</span></samp> and <samp><span class="option">-Wimplicit-function-declaration</span></samp>. This warning is enabled by <samp><span class="option">-Wall</span></samp>. <br><dt><code>-Wignored-qualifiers </code><span class="roman">(C and C++ only)</span><dd><a name="index-Wignored_002dqualifiers-336"></a><a name="index-Wno_002dignored_002dqualifiers-337"></a>Warn if the return type of a function has a type qualifier such as <code>const</code>. For ISO C such a type qualifier has no effect, since the value returned by a function is not an lvalue. For C++, the warning is only emitted for scalar types or <code>void</code>. ISO C prohibits qualified <code>void</code> return types on function definitions, so such return types always receive a warning even without this option. <p>This warning is also enabled by <samp><span class="option">-Wextra</span></samp>. <br><dt><code>-Wmain</code><dd><a name="index-Wmain-338"></a><a name="index-Wno_002dmain-339"></a>Warn if the type of <code>main</code> is suspicious. <code>main</code> should be a function with external linkage, returning int, taking either zero arguments, two, or three arguments of appropriate types. This warning is enabled by default in C++ and is enabled by either <samp><span class="option">-Wall</span></samp> or <samp><span class="option">-Wpedantic</span></samp>. <br><dt><code>-Wmissing-braces</code><dd><a name="index-Wmissing_002dbraces-340"></a><a name="index-Wno_002dmissing_002dbraces-341"></a>Warn if an aggregate or union initializer is not fully bracketed. In the following example, the initializer for <code>a</code> is not fully bracketed, but that for <code>b</code> is fully bracketed. This warning is enabled by <samp><span class="option">-Wall</span></samp> in C. <pre class="smallexample"> int a[2][2] = { 0, 1, 2, 3 }; int b[2][2] = { { 0, 1 }, { 2, 3 } }; </pre> <p>This warning is enabled by <samp><span class="option">-Wall</span></samp>. <br><dt><code>-Wmissing-include-dirs </code><span class="roman">(C, C++, Objective-C and Objective-C++ only)</span><dd><a name="index-Wmissing_002dinclude_002ddirs-342"></a><a name="index-Wno_002dmissing_002dinclude_002ddirs-343"></a>Warn if a user-supplied include directory does not exist. <br><dt><code>-Wparentheses</code><dd><a name="index-Wparentheses-344"></a><a name="index-Wno_002dparentheses-345"></a>Warn if parentheses are omitted in certain contexts, such as when there is an assignment in a context where a truth value is expected, or when operators are nested whose precedence people often get confused about. <p>Also warn if a comparison like <code>x<=y<=z</code> appears; this is equivalent to <code>(x<=y ? 1 : 0) <= z</code>, which is a different interpretation from that of ordinary mathematical notation. <p>Also warn about constructions where there may be confusion to which <code>if</code> statement an <code>else</code> branch belongs. Here is an example of such a case: <pre class="smallexample"> { if (a) if (b) foo (); else bar (); } </pre> <p>In C/C++, every <code>else</code> branch belongs to the innermost possible <code>if</code> statement, which in this example is <code>if (b)</code>. This is often not what the programmer expected, as illustrated in the above example by indentation the programmer chose. When there is the potential for this confusion, GCC issues a warning when this flag is specified. To eliminate the warning, add explicit braces around the innermost <code>if</code> statement so there is no way the <code>else</code> can belong to the enclosing <code>if</code>. The resulting code looks like this: <pre class="smallexample"> { if (a) { if (b) foo (); else bar (); } } </pre> <p>Also warn for dangerous uses of the GNU extension to <code>?:</code> with omitted middle operand. When the condition in the <code>?</code>: operator is a boolean expression, the omitted value is always 1. Often programmers expect it to be a value computed inside the conditional expression instead. <p>This warning is enabled by <samp><span class="option">-Wall</span></samp>. <br><dt><code>-Wsequence-point</code><dd><a name="index-Wsequence_002dpoint-346"></a><a name="index-Wno_002dsequence_002dpoint-347"></a>Warn about code that may have undefined semantics because of violations of sequence point rules in the C and C++ standards. <p>The C and C++ standards define the order in which expressions in a C/C++ program are evaluated in terms of <dfn>sequence points</dfn>, which represent a partial ordering between the execution of parts of the program: those executed before the sequence point, and those executed after it. These occur after the evaluation of a full expression (one which is not part of a larger expression), after the evaluation of the first operand of a <code>&&</code>, <code>||</code>, <code>? :</code> or <code>,</code> (comma) operator, before a function is called (but after the evaluation of its arguments and the expression denoting the called function), and in certain other places. Other than as expressed by the sequence point rules, the order of evaluation of subexpressions of an expression is not specified. All these rules describe only a partial order rather than a total order, since, for example, if two functions are called within one expression with no sequence point between them, the order in which the functions are called is not specified. However, the standards committee have ruled that function calls do not overlap. <p>It is not specified when between sequence points modifications to the values of objects take effect. Programs whose behavior depends on this have undefined behavior; the C and C++ standards specify that “Between the previous and next sequence point an object shall have its stored value modified at most once by the evaluation of an expression. Furthermore, the prior value shall be read only to determine the value to be stored.”. If a program breaks these rules, the results on any particular implementation are entirely unpredictable. <p>Examples of code with undefined behavior are <code>a = a++;</code>, <code>a[n] = b[n++]</code> and <code>a[i++] = i;</code>. Some more complicated cases are not diagnosed by this option, and it may give an occasional false positive result, but in general it has been found fairly effective at detecting this sort of problem in programs. <p>The standard is worded confusingly, therefore there is some debate over the precise meaning of the sequence point rules in subtle cases. Links to discussions of the problem, including proposed formal definitions, may be found on the GCC readings page, at <a href="http://gcc.gnu.org/readings.html">http://gcc.gnu.org/readings.html</a>. <p>This warning is enabled by <samp><span class="option">-Wall</span></samp> for C and C++. <br><dt><code>-Wno-return-local-addr</code><dd><a name="index-Wno_002dreturn_002dlocal_002daddr-348"></a><a name="index-Wreturn_002dlocal_002daddr-349"></a>Do not warn about returning a pointer (or in C++, a reference) to a variable that goes out of scope after the function returns. <br><dt><code>-Wreturn-type</code><dd><a name="index-Wreturn_002dtype-350"></a><a name="index-Wno_002dreturn_002dtype-351"></a>Warn whenever a function is defined with a return type that defaults to <code>int</code>. Also warn about any <code>return</code> statement with no return value in a function whose return type is not <code>void</code> (falling off the end of the function body is considered returning without a value), and about a <code>return</code> statement with an expression in a function whose return type is <code>void</code>. <p>For C++, a function without return type always produces a diagnostic message, even when <samp><span class="option">-Wno-return-type</span></samp> is specified. The only exceptions are <code>main</code> and functions defined in system headers. <p>This warning is enabled by <samp><span class="option">-Wall</span></samp>. <br><dt><code>-Wshift-count-negative</code><dd><a name="index-Wshift_002dcount_002dnegative-352"></a><a name="index-Wno_002dshift_002dcount_002dnegative-353"></a>Warn if shift count is negative. This warning is enabled by default. <br><dt><code>-Wshift-count-overflow</code><dd><a name="index-Wshift_002dcount_002doverflow-354"></a><a name="index-Wno_002dshift_002dcount_002doverflow-355"></a>Warn if shift count >= width of type. This warning is enabled by default. <br><dt><code>-Wswitch</code><dd><a name="index-Wswitch-356"></a><a name="index-Wno_002dswitch-357"></a>Warn whenever a <code>switch</code> statement has an index of enumerated type and lacks a <code>case</code> for one or more of the named codes of that enumeration. (The presence of a <code>default</code> label prevents this warning.) <code>case</code> labels outside the enumeration range also provoke warnings when this option is used (even if there is a <code>default</code> label). This warning is enabled by <samp><span class="option">-Wall</span></samp>. <br><dt><code>-Wswitch-default</code><dd><a name="index-Wswitch_002ddefault-358"></a><a name="index-Wno_002dswitch_002ddefault-359"></a>Warn whenever a <code>switch</code> statement does not have a <code>default</code> case. <br><dt><code>-Wswitch-enum</code><dd><a name="index-Wswitch_002denum-360"></a><a name="index-Wno_002dswitch_002denum-361"></a>Warn whenever a <code>switch</code> statement has an index of enumerated type and lacks a <code>case</code> for one or more of the named codes of that enumeration. <code>case</code> labels outside the enumeration range also provoke warnings when this option is used. The only difference between <samp><span class="option">-Wswitch</span></samp> and this option is that this option gives a warning about an omitted enumeration code even if there is a <code>default</code> label. <br><dt><code>-Wswitch-bool</code><dd><a name="index-Wswitch_002dbool-362"></a><a name="index-Wno_002dswitch_002dbool-363"></a>Warn whenever a <code>switch</code> statement has an index of boolean type. It is possible to suppress this warning by casting the controlling expression to a type other than <code>bool</code>. For example: <pre class="smallexample"> switch ((int) (a == 4)) { ... } </pre> <p>This warning is enabled by default for C and C++ programs. <br><dt><code>-Wsync-nand </code><span class="roman">(C and C++ only)</span><dd><a name="index-Wsync_002dnand-364"></a><a name="index-Wno_002dsync_002dnand-365"></a>Warn when <code>__sync_fetch_and_nand</code> and <code>__sync_nand_and_fetch</code> built-in functions are used. These functions changed semantics in GCC 4.4. <br><dt><code>-Wtrigraphs</code><dd><a name="index-Wtrigraphs-366"></a><a name="index-Wno_002dtrigraphs-367"></a>Warn if any trigraphs are encountered that might change the meaning of the program (trigraphs within comments are not warned about). This warning is enabled by <samp><span class="option">-Wall</span></samp>. <br><dt><code>-Wunused-but-set-parameter</code><dd><a name="index-Wunused_002dbut_002dset_002dparameter-368"></a><a name="index-Wno_002dunused_002dbut_002dset_002dparameter-369"></a>Warn whenever a function parameter is assigned to, but otherwise unused (aside from its declaration). <p>To suppress this warning use the <code>unused</code> attribute (see <a href="Variable-Attributes.html#Variable-Attributes">Variable Attributes</a>). <p>This warning is also enabled by <samp><span class="option">-Wunused</span></samp> together with <samp><span class="option">-Wextra</span></samp>. <br><dt><code>-Wunused-but-set-variable</code><dd><a name="index-Wunused_002dbut_002dset_002dvariable-370"></a><a name="index-Wno_002dunused_002dbut_002dset_002dvariable-371"></a>Warn whenever a local variable is assigned to, but otherwise unused (aside from its declaration). This warning is enabled by <samp><span class="option">-Wall</span></samp>. <p>To suppress this warning use the <code>unused</code> attribute (see <a href="Variable-Attributes.html#Variable-Attributes">Variable Attributes</a>). <p>This warning is also enabled by <samp><span class="option">-Wunused</span></samp>, which is enabled by <samp><span class="option">-Wall</span></samp>. <br><dt><code>-Wunused-function</code><dd><a name="index-Wunused_002dfunction-372"></a><a name="index-Wno_002dunused_002dfunction-373"></a>Warn whenever a static function is declared but not defined or a non-inline static function is unused. This warning is enabled by <samp><span class="option">-Wall</span></samp>. <br><dt><code>-Wunused-label</code><dd><a name="index-Wunused_002dlabel-374"></a><a name="index-Wno_002dunused_002dlabel-375"></a>Warn whenever a label is declared but not used. This warning is enabled by <samp><span class="option">-Wall</span></samp>. <p>To suppress this warning use the <code>unused</code> attribute (see <a href="Variable-Attributes.html#Variable-Attributes">Variable Attributes</a>). <br><dt><code>-Wunused-local-typedefs </code><span class="roman">(C, Objective-C, C++ and Objective-C++ only)</span><dd><a name="index-Wunused_002dlocal_002dtypedefs-376"></a>Warn when a typedef locally defined in a function is not used. This warning is enabled by <samp><span class="option">-Wall</span></samp>. <br><dt><code>-Wunused-parameter</code><dd><a name="index-Wunused_002dparameter-377"></a><a name="index-Wno_002dunused_002dparameter-378"></a>Warn whenever a function parameter is unused aside from its declaration. <p>To suppress this warning use the <code>unused</code> attribute (see <a href="Variable-Attributes.html#Variable-Attributes">Variable Attributes</a>). <br><dt><code>-Wno-unused-result</code><dd><a name="index-Wunused_002dresult-379"></a><a name="index-Wno_002dunused_002dresult-380"></a>Do not warn if a caller of a function marked with attribute <code>warn_unused_result</code> (see <a href="Function-Attributes.html#Function-Attributes">Function Attributes</a>) does not use its return value. The default is <samp><span class="option">-Wunused-result</span></samp>. <br><dt><code>-Wunused-variable</code><dd><a name="index-Wunused_002dvariable-381"></a><a name="index-Wno_002dunused_002dvariable-382"></a>Warn whenever a local variable or non-constant static variable is unused aside from its declaration. This warning is enabled by <samp><span class="option">-Wall</span></samp>. <p>To suppress this warning use the <code>unused</code> attribute (see <a href="Variable-Attributes.html#Variable-Attributes">Variable Attributes</a>). <br><dt><code>-Wunused-value</code><dd><a name="index-Wunused_002dvalue-383"></a><a name="index-Wno_002dunused_002dvalue-384"></a>Warn whenever a statement computes a result that is explicitly not used. To suppress this warning cast the unused expression to <code>void</code>. This includes an expression-statement or the left-hand side of a comma expression that contains no side effects. For example, an expression such as <code>x[i,j]</code> causes a warning, while <code>x[(void)i,j]</code> does not. <p>This warning is enabled by <samp><span class="option">-Wall</span></samp>. <br><dt><code>-Wunused</code><dd><a name="index-Wunused-385"></a><a name="index-Wno_002dunused-386"></a>All the above <samp><span class="option">-Wunused</span></samp> options combined. <p>In order to get a warning about an unused function parameter, you must either specify <samp><span class="option">-Wextra -Wunused</span></samp> (note that <samp><span class="option">-Wall</span></samp> implies <samp><span class="option">-Wunused</span></samp>), or separately specify <samp><span class="option">-Wunused-parameter</span></samp>. <br><dt><code>-Wuninitialized</code><dd><a name="index-Wuninitialized-387"></a><a name="index-Wno_002duninitialized-388"></a>Warn if an automatic variable is used without first being initialized or if a variable may be clobbered by a <code>setjmp</code> call. In C++, warn if a non-static reference or non-static <code>const</code> member appears in a class without constructors. <p>If you want to warn about code that uses the uninitialized value of the variable in its own initializer, use the <samp><span class="option">-Winit-self</span></samp> option. <p>These warnings occur for individual uninitialized or clobbered elements of structure, union or array variables as well as for variables that are uninitialized or clobbered as a whole. They do not occur for variables or elements declared <code>volatile</code>. Because these warnings depend on optimization, the exact variables or elements for which there are warnings depends on the precise optimization options and version of GCC used. <p>Note that there may be no warning about a variable that is used only to compute a value that itself is never used, because such computations may be deleted by data flow analysis before the warnings are printed. <br><dt><code>-Wmaybe-uninitialized</code><dd><a name="index-Wmaybe_002duninitialized-389"></a><a name="index-Wno_002dmaybe_002duninitialized-390"></a>For an automatic variable, if there exists a path from the function entry to a use of the variable that is initialized, but there exist some other paths for which the variable is not initialized, the compiler emits a warning if it cannot prove the uninitialized paths are not executed at run time. These warnings are made optional because GCC is not smart enough to see all the reasons why the code might be correct in spite of appearing to have an error. Here is one example of how this can happen: <pre class="smallexample"> { int x; switch (y) { case 1: x = 1; break; case 2: x = 4; break; case 3: x = 5; } foo (x); } </pre> <p class="noindent">If the value of <code>y</code> is always 1, 2 or 3, then <code>x</code> is always initialized, but GCC doesn't know this. To suppress the warning, you need to provide a default case with assert(0) or similar code. <p><a name="index-g_t_0040code_007blongjmp_007d-warnings-391"></a>This option also warns when a non-volatile automatic variable might be changed by a call to <code>longjmp</code>. These warnings as well are possible only in optimizing compilation. <p>The compiler sees only the calls to <code>setjmp</code>. It cannot know where <code>longjmp</code> will be called; in fact, a signal handler could call it at any point in the code. As a result, you may get a warning even when there is in fact no problem because <code>longjmp</code> cannot in fact be called at the place that would cause a problem. <p>Some spurious warnings can be avoided if you declare all the functions you use that never return as <code>noreturn</code>. See <a href="Function-Attributes.html#Function-Attributes">Function Attributes</a>. <p>This warning is enabled by <samp><span class="option">-Wall</span></samp> or <samp><span class="option">-Wextra</span></samp>. <br><dt><code>-Wunknown-pragmas</code><dd><a name="index-Wunknown_002dpragmas-392"></a><a name="index-Wno_002dunknown_002dpragmas-393"></a><a name="index-warning-for-unknown-pragmas-394"></a><a name="index-unknown-pragmas_002c-warning-395"></a><a name="index-pragmas_002c-warning-of-unknown-396"></a>Warn when a <code>#pragma</code> directive is encountered that is not understood by GCC. If this command-line option is used, warnings are even issued for unknown pragmas in system header files. This is not the case if the warnings are only enabled by the <samp><span class="option">-Wall</span></samp> command-line option. <br><dt><code>-Wno-pragmas</code><dd><a name="index-Wno_002dpragmas-397"></a><a name="index-Wpragmas-398"></a>Do not warn about misuses of pragmas, such as incorrect parameters, invalid syntax, or conflicts between pragmas. See also <samp><span class="option">-Wunknown-pragmas</span></samp>. <br><dt><code>-Wstrict-aliasing</code><dd><a name="index-Wstrict_002daliasing-399"></a><a name="index-Wno_002dstrict_002daliasing-400"></a>This option is only active when <samp><span class="option">-fstrict-aliasing</span></samp> is active. It warns about code that might break the strict aliasing rules that the compiler is using for optimization. The warning does not catch all cases, but does attempt to catch the more common pitfalls. It is included in <samp><span class="option">-Wall</span></samp>. It is equivalent to <samp><span class="option">-Wstrict-aliasing=3</span></samp> <br><dt><code>-Wstrict-aliasing=n</code><dd><a name="index-Wstrict_002daliasing_003dn-401"></a>This option is only active when <samp><span class="option">-fstrict-aliasing</span></samp> is active. It warns about code that might break the strict aliasing rules that the compiler is using for optimization. Higher levels correspond to higher accuracy (fewer false positives). Higher levels also correspond to more effort, similar to the way <samp><span class="option">-O</span></samp> works. <samp><span class="option">-Wstrict-aliasing</span></samp> is equivalent to <samp><span class="option">-Wstrict-aliasing=3</span></samp>. <p>Level 1: Most aggressive, quick, least accurate. Possibly useful when higher levels do not warn but <samp><span class="option">-fstrict-aliasing</span></samp> still breaks the code, as it has very few false negatives. However, it has many false positives. Warns for all pointer conversions between possibly incompatible types, even if never dereferenced. Runs in the front end only. <p>Level 2: Aggressive, quick, not too precise. May still have many false positives (not as many as level 1 though), and few false negatives (but possibly more than level 1). Unlike level 1, it only warns when an address is taken. Warns about incomplete types. Runs in the front end only. <p>Level 3 (default for <samp><span class="option">-Wstrict-aliasing</span></samp>): Should have very few false positives and few false negatives. Slightly slower than levels 1 or 2 when optimization is enabled. Takes care of the common pun+dereference pattern in the front end: <code>*(int*)&some_float</code>. If optimization is enabled, it also runs in the back end, where it deals with multiple statement cases using flow-sensitive points-to information. Only warns when the converted pointer is dereferenced. Does not warn about incomplete types. <br><dt><code>-Wstrict-overflow</code><dt><code>-Wstrict-overflow=</code><var>n</var><dd><a name="index-Wstrict_002doverflow-402"></a><a name="index-Wno_002dstrict_002doverflow-403"></a>This option is only active when <samp><span class="option">-fstrict-overflow</span></samp> is active. It warns about cases where the compiler optimizes based on the assumption that signed overflow does not occur. Note that it does not warn about all cases where the code might overflow: it only warns about cases where the compiler implements some optimization. Thus this warning depends on the optimization level. <p>An optimization that assumes that signed overflow does not occur is perfectly safe if the values of the variables involved are such that overflow never does, in fact, occur. Therefore this warning can easily give a false positive: a warning about code that is not actually a problem. To help focus on important issues, several warning levels are defined. No warnings are issued for the use of undefined signed overflow when estimating how many iterations a loop requires, in particular when determining whether a loop will be executed at all. <dl> <dt><code>-Wstrict-overflow=1</code><dd>Warn about cases that are both questionable and easy to avoid. For example, with <samp><span class="option">-fstrict-overflow</span></samp>, the compiler simplifies <code>x + 1 > x</code> to <code>1</code>. This level of <samp><span class="option">-Wstrict-overflow</span></samp> is enabled by <samp><span class="option">-Wall</span></samp>; higher levels are not, and must be explicitly requested. <br><dt><code>-Wstrict-overflow=2</code><dd>Also warn about other cases where a comparison is simplified to a constant. For example: <code>abs (x) >= 0</code>. This can only be simplified when <samp><span class="option">-fstrict-overflow</span></samp> is in effect, because <code>abs (INT_MIN)</code> overflows to <code>INT_MIN</code>, which is less than zero. <samp><span class="option">-Wstrict-overflow</span></samp> (with no level) is the same as <samp><span class="option">-Wstrict-overflow=2</span></samp>. <br><dt><code>-Wstrict-overflow=3</code><dd>Also warn about other cases where a comparison is simplified. For example: <code>x + 1 > 1</code> is simplified to <code>x > 0</code>. <br><dt><code>-Wstrict-overflow=4</code><dd>Also warn about other simplifications not covered by the above cases. For example: <code>(x * 10) / 5</code> is simplified to <code>x * 2</code>. <br><dt><code>-Wstrict-overflow=5</code><dd>Also warn about cases where the compiler reduces the magnitude of a constant involved in a comparison. For example: <code>x + 2 > y</code> is simplified to <code>x + 1 >= y</code>. This is reported only at the highest warning level because this simplification applies to many comparisons, so this warning level gives a very large number of false positives. </dl> <br><dt><code>-Wsuggest-attribute=</code><span class="roman">[</span><code>pure</code><span class="roman">|</span><code>const</code><span class="roman">|</span><code>noreturn</code><span class="roman">|</span><code>format</code><span class="roman">]</span><dd><a name="index-Wsuggest_002dattribute_003d-404"></a><a name="index-Wno_002dsuggest_002dattribute_003d-405"></a>Warn for cases where adding an attribute may be beneficial. The attributes currently supported are listed below. <dl> <dt><code>-Wsuggest-attribute=pure</code><dt><code>-Wsuggest-attribute=const</code><dt><code>-Wsuggest-attribute=noreturn</code><dd><a name="index-Wsuggest_002dattribute_003dpure-406"></a><a name="index-Wno_002dsuggest_002dattribute_003dpure-407"></a><a name="index-Wsuggest_002dattribute_003dconst-408"></a><a name="index-Wno_002dsuggest_002dattribute_003dconst-409"></a><a name="index-Wsuggest_002dattribute_003dnoreturn-410"></a><a name="index-Wno_002dsuggest_002dattribute_003dnoreturn-411"></a> Warn about functions that might be candidates for attributes <code>pure</code>, <code>const</code> or <code>noreturn</code>. The compiler only warns for functions visible in other compilation units or (in the case of <code>pure</code> and <code>const</code>) if it cannot prove that the function returns normally. A function returns normally if it doesn't contain an infinite loop or return abnormally by throwing, calling <code>abort</code> or trapping. This analysis requires option <samp><span class="option">-fipa-pure-const</span></samp>, which is enabled by default at <samp><span class="option">-O</span></samp> and higher. Higher optimization levels improve the accuracy of the analysis. <br><dt><code>-Wsuggest-attribute=format</code><dt><code>-Wmissing-format-attribute</code><dd><a name="index-Wsuggest_002dattribute_003dformat-412"></a><a name="index-Wmissing_002dformat_002dattribute-413"></a><a name="index-Wno_002dsuggest_002dattribute_003dformat-414"></a><a name="index-Wno_002dmissing_002dformat_002dattribute-415"></a><a name="index-Wformat-416"></a><a name="index-Wno_002dformat-417"></a> Warn about function pointers that might be candidates for <code>format</code> attributes. Note these are only possible candidates, not absolute ones. GCC guesses that function pointers with <code>format</code> attributes that are used in assignment, initialization, parameter passing or return statements should have a corresponding <code>format</code> attribute in the resulting type. I.e. the left-hand side of the assignment or initialization, the type of the parameter variable, or the return type of the containing function respectively should also have a <code>format</code> attribute to avoid the warning. <p>GCC also warns about function definitions that might be candidates for <code>format</code> attributes. Again, these are only possible candidates. GCC guesses that <code>format</code> attributes might be appropriate for any function that calls a function like <code>vprintf</code> or <code>vscanf</code>, but this might not always be the case, and some functions for which <code>format</code> attributes are appropriate may not be detected. </dl> <br><dt><code>-Wsuggest-final-types</code><dd><a name="index-Wno_002dsuggest_002dfinal_002dtypes-418"></a><a name="index-Wsuggest_002dfinal_002dtypes-419"></a>Warn about types with virtual methods where code quality would be improved if the type were declared with the C++11 <code>final</code> specifier, or, if possible, declared in an anonymous namespace. This allows GCC to more aggressively devirtualize the polymorphic calls. This warning is more effective with link time optimization, where the information about the class hierarchy graph is more complete. <br><dt><code>-Wsuggest-final-methods</code><dd><a name="index-Wno_002dsuggest_002dfinal_002dmethods-420"></a><a name="index-Wsuggest_002dfinal_002dmethods-421"></a>Warn about virtual methods where code quality would be improved if the method were declared with the C++11 <code>final</code> specifier, or, if possible, its type were declared in an anonymous namespace or with the <code>final</code> specifier. This warning is more effective with link time optimization, where the information about the class hierarchy graph is more complete. It is recommended to first consider suggestions of <samp><span class="option">-Wsuggest-final-types</span></samp> and then rebuild with new annotations. <br><dt><code>-Wsuggest-override</code><dd>Warn about overriding virtual functions that are not marked with the override keyword. <br><dt><code>-Warray-bounds</code><dt><code>-Warray-bounds=</code><var>n</var><dd><a name="index-Wno_002darray_002dbounds-422"></a><a name="index-Warray_002dbounds-423"></a>This option is only active when <samp><span class="option">-ftree-vrp</span></samp> is active (default for <samp><span class="option">-O2</span></samp> and above). It warns about subscripts to arrays that are always out of bounds. This warning is enabled by <samp><span class="option">-Wall</span></samp>. <dl> <dt><code>-Warray-bounds=1</code><dd>This is the warning level of <samp><span class="option">-Warray-bounds</span></samp> and is enabled by <samp><span class="option">-Wall</span></samp>; higher levels are not, and must be explicitly requested. <br><dt><code>-Warray-bounds=2</code><dd>This warning level also warns about out of bounds access for arrays at the end of a struct and for arrays accessed through pointers. This warning level may give a larger number of false positives and is deactivated by default. </dl> <br><dt><code>-Wbool-compare</code><dd><a name="index-Wno_002dbool_002dcompare-424"></a><a name="index-Wbool_002dcompare-425"></a>Warn about boolean expression compared with an integer value different from <code>true</code>/<code>false</code>. For instance, the following comparison is always false: <pre class="smallexample"> int n = 5; ... if ((n > 1) == 2) { ... } </pre> <p>This warning is enabled by <samp><span class="option">-Wall</span></samp>. <br><dt><code>-Wno-discarded-qualifiers </code><span class="roman">(C and Objective-C only)</span><dd><a name="index-Wno_002ddiscarded_002dqualifiers-426"></a><a name="index-Wdiscarded_002dqualifiers-427"></a>Do not warn if type qualifiers on pointers are being discarded. Typically, the compiler warns if a <code>const char *</code> variable is passed to a function that takes a <code>char *</code> parameter. This option can be used to suppress such a warning. <br><dt><code>-Wno-discarded-array-qualifiers </code><span class="roman">(C and Objective-C only)</span><dd><a name="index-Wno_002ddiscarded_002darray_002dqualifiers-428"></a><a name="index-Wdiscarded_002darray_002dqualifiers-429"></a>Do not warn if type qualifiers on arrays which are pointer targets are being discarded. Typically, the compiler warns if a <code>const int (*)[]</code> variable is passed to a function that takes a <code>int (*)[]</code> parameter. This option can be used to suppress such a warning. <br><dt><code>-Wno-incompatible-pointer-types </code><span class="roman">(C and Objective-C only)</span><dd><a name="index-Wno_002dincompatible_002dpointer_002dtypes-430"></a><a name="index-Wincompatible_002dpointer_002dtypes-431"></a>Do not warn when there is a conversion between pointers that have incompatible types. This warning is for cases not covered by <samp><span class="option">-Wno-pointer-sign</span></samp>, which warns for pointer argument passing or assignment with different signedness. <br><dt><code>-Wno-int-conversion </code><span class="roman">(C and Objective-C only)</span><dd><a name="index-Wno_002dint_002dconversion-432"></a><a name="index-Wint_002dconversion-433"></a>Do not warn about incompatible integer to pointer and pointer to integer conversions. This warning is about implicit conversions; for explicit conversions the warnings <samp><span class="option">-Wno-int-to-pointer-cast</span></samp> and <samp><span class="option">-Wno-pointer-to-int-cast</span></samp> may be used. <br><dt><code>-Wno-div-by-zero</code><dd><a name="index-Wno_002ddiv_002dby_002dzero-434"></a><a name="index-Wdiv_002dby_002dzero-435"></a>Do not warn about compile-time integer division by zero. Floating-point division by zero is not warned about, as it can be a legitimate way of obtaining infinities and NaNs. <br><dt><code>-Wsystem-headers</code><dd><a name="index-Wsystem_002dheaders-436"></a><a name="index-Wno_002dsystem_002dheaders-437"></a><a name="index-warnings-from-system-headers-438"></a><a name="index-system-headers_002c-warnings-from-439"></a>Print warning messages for constructs found in system header files. Warnings from system headers are normally suppressed, on the assumption that they usually do not indicate real problems and would only make the compiler output harder to read. Using this command-line option tells GCC to emit warnings from system headers as if they occurred in user code. However, note that using <samp><span class="option">-Wall</span></samp> in conjunction with this option does <em>not</em> warn about unknown pragmas in system headers—for that, <samp><span class="option">-Wunknown-pragmas</span></samp> must also be used. <br><dt><code>-Wtrampolines</code><dd><a name="index-Wtrampolines-440"></a><a name="index-Wno_002dtrampolines-441"></a>Warn about trampolines generated for pointers to nested functions. A trampoline is a small piece of data or code that is created at run time on the stack when the address of a nested function is taken, and is used to call the nested function indirectly. For some targets, it is made up of data only and thus requires no special treatment. But, for most targets, it is made up of code and thus requires the stack to be made executable in order for the program to work properly. <br><dt><code>-Wfloat-equal</code><dd><a name="index-Wfloat_002dequal-442"></a><a name="index-Wno_002dfloat_002dequal-443"></a>Warn if floating-point values are used in equality comparisons. <p>The idea behind this is that sometimes it is convenient (for the programmer) to consider floating-point values as approximations to infinitely precise real numbers. If you are doing this, then you need to compute (by analyzing the code, or in some other way) the maximum or likely maximum error that the computation introduces, and allow for it when performing comparisons (and when producing output, but that's a different problem). In particular, instead of testing for equality, you should check to see whether the two values have ranges that overlap; and this is done with the relational operators, so equality comparisons are probably mistaken. <br><dt><code>-Wtraditional </code><span class="roman">(C and Objective-C only)</span><dd><a name="index-Wtraditional-444"></a><a name="index-Wno_002dtraditional-445"></a>Warn about certain constructs that behave differently in traditional and ISO C. Also warn about ISO C constructs that have no traditional C equivalent, and/or problematic constructs that should be avoided. <ul> <li>Macro parameters that appear within string literals in the macro body. In traditional C macro replacement takes place within string literals, but in ISO C it does not. <li>In traditional C, some preprocessor directives did not exist. Traditional preprocessors only considered a line to be a directive if the ‘<samp><span class="samp">#</span></samp>’ appeared in column 1 on the line. Therefore <samp><span class="option">-Wtraditional</span></samp> warns about directives that traditional C understands but ignores because the ‘<samp><span class="samp">#</span></samp>’ does not appear as the first character on the line. It also suggests you hide directives like <code>#pragma</code> not understood by traditional C by indenting them. Some traditional implementations do not recognize <code>#elif</code>, so this option suggests avoiding it altogether. <li>A function-like macro that appears without arguments. <li>The unary plus operator. <li>The ‘<samp><span class="samp">U</span></samp>’ integer constant suffix, or the ‘<samp><span class="samp">F</span></samp>’ or ‘<samp><span class="samp">L</span></samp>’ floating-point constant suffixes. (Traditional C does support the ‘<samp><span class="samp">L</span></samp>’ suffix on integer constants.) Note, these suffixes appear in macros defined in the system headers of most modern systems, e.g. the ‘<samp><span class="samp">_MIN</span></samp>’/‘<samp><span class="samp">_MAX</span></samp>’ macros in <code><limits.h></code>. Use of these macros in user code might normally lead to spurious warnings, however GCC's integrated preprocessor has enough context to avoid warning in these cases. <li>A function declared external in one block and then used after the end of the block. <li>A <code>switch</code> statement has an operand of type <code>long</code>. <li>A non-<code>static</code> function declaration follows a <code>static</code> one. This construct is not accepted by some traditional C compilers. <li>The ISO type of an integer constant has a different width or signedness from its traditional type. This warning is only issued if the base of the constant is ten. I.e. hexadecimal or octal values, which typically represent bit patterns, are not warned about. <li>Usage of ISO string concatenation is detected. <li>Initialization of automatic aggregates. <li>Identifier conflicts with labels. Traditional C lacks a separate namespace for labels. <li>Initialization of unions. If the initializer is zero, the warning is omitted. This is done under the assumption that the zero initializer in user code appears conditioned on e.g. <code>__STDC__</code> to avoid missing initializer warnings and relies on default initialization to zero in the traditional C case. <li>Conversions by prototypes between fixed/floating-point values and vice versa. The absence of these prototypes when compiling with traditional C causes serious problems. This is a subset of the possible conversion warnings; for the full set use <samp><span class="option">-Wtraditional-conversion</span></samp>. <li>Use of ISO C style function definitions. This warning intentionally is <em>not</em> issued for prototype declarations or variadic functions because these ISO C features appear in your code when using libiberty's traditional C compatibility macros, <code>PARAMS</code> and <code>VPARAMS</code>. This warning is also bypassed for nested functions because that feature is already a GCC extension and thus not relevant to traditional C compatibility. </ul> <br><dt><code>-Wtraditional-conversion </code><span class="roman">(C and Objective-C only)</span><dd><a name="index-Wtraditional_002dconversion-446"></a><a name="index-Wno_002dtraditional_002dconversion-447"></a>Warn if a prototype causes a type conversion that is different from what would happen to the same argument in the absence of a prototype. This includes conversions of fixed point to floating and vice versa, and conversions changing the width or signedness of a fixed-point argument except when the same as the default promotion. <br><dt><code>-Wdeclaration-after-statement </code><span class="roman">(C and Objective-C only)</span><dd><a name="index-Wdeclaration_002dafter_002dstatement-448"></a><a name="index-Wno_002ddeclaration_002dafter_002dstatement-449"></a>Warn when a declaration is found after a statement in a block. This construct, known from C++, was introduced with ISO C99 and is by default allowed in GCC. It is not supported by ISO C90. See <a href="Mixed-Declarations.html#Mixed-Declarations">Mixed Declarations</a>. <br><dt><code>-Wundef</code><dd><a name="index-Wundef-450"></a><a name="index-Wno_002dundef-451"></a>Warn if an undefined identifier is evaluated in an <code>#if</code> directive. <br><dt><code>-Wno-endif-labels</code><dd><a name="index-Wno_002dendif_002dlabels-452"></a><a name="index-Wendif_002dlabels-453"></a>Do not warn whenever an <code>#else</code> or an <code>#endif</code> are followed by text. <br><dt><code>-Wshadow</code><dd><a name="index-Wshadow-454"></a><a name="index-Wno_002dshadow-455"></a>Warn whenever a local variable or type declaration shadows another variable, parameter, type, class member (in C++), or instance variable (in Objective-C) or whenever a built-in function is shadowed. Note that in C++, the compiler warns if a local variable shadows an explicit typedef, but not if it shadows a struct/class/enum. <br><dt><code>-Wno-shadow-ivar </code><span class="roman">(Objective-C only)</span><dd><a name="index-Wno_002dshadow_002divar-456"></a><a name="index-Wshadow_002divar-457"></a>Do not warn whenever a local variable shadows an instance variable in an Objective-C method. <br><dt><code>-Wlarger-than=</code><var>len</var><dd><a name="index-Wlarger_002dthan_003d_0040var_007blen_007d-458"></a><a name="index-Wlarger_002dthan_002d_0040var_007blen_007d-459"></a>Warn whenever an object of larger than <var>len</var> bytes is defined. <br><dt><code>-Wframe-larger-than=</code><var>len</var><dd><a name="index-Wframe_002dlarger_002dthan-460"></a>Warn if the size of a function frame is larger than <var>len</var> bytes. The computation done to determine the stack frame size is approximate and not conservative. The actual requirements may be somewhat greater than <var>len</var> even if you do not get a warning. In addition, any space allocated via <code>alloca</code>, variable-length arrays, or related constructs is not included by the compiler when determining whether or not to issue a warning. <br><dt><code>-Wno-free-nonheap-object</code><dd><a name="index-Wno_002dfree_002dnonheap_002dobject-461"></a><a name="index-Wfree_002dnonheap_002dobject-462"></a>Do not warn when attempting to free an object that was not allocated on the heap. <br><dt><code>-Wstack-usage=</code><var>len</var><dd><a name="index-Wstack_002dusage-463"></a>Warn if the stack usage of a function might be larger than <var>len</var> bytes. The computation done to determine the stack usage is conservative. Any space allocated via <code>alloca</code>, variable-length arrays, or related constructs is included by the compiler when determining whether or not to issue a warning. <p>The message is in keeping with the output of <samp><span class="option">-fstack-usage</span></samp>. <ul> <li>If the stack usage is fully static but exceeds the specified amount, it's: <pre class="smallexample"> warning: stack usage is 1120 bytes </pre> <li>If the stack usage is (partly) dynamic but bounded, it's: <pre class="smallexample"> warning: stack usage might be 1648 bytes </pre> <li>If the stack usage is (partly) dynamic and not bounded, it's: <pre class="smallexample"> warning: stack usage might be unbounded </pre> </ul> <br><dt><code>-Wunsafe-loop-optimizations</code><dd><a name="index-Wunsafe_002dloop_002doptimizations-464"></a><a name="index-Wno_002dunsafe_002dloop_002doptimizations-465"></a>Warn if the loop cannot be optimized because the compiler cannot assume anything on the bounds of the loop indices. With <samp><span class="option">-funsafe-loop-optimizations</span></samp> warn if the compiler makes such assumptions. <br><dt><code>-Wno-pedantic-ms-format </code><span class="roman">(MinGW targets only)</span><dd><a name="index-Wno_002dpedantic_002dms_002dformat-466"></a><a name="index-Wpedantic_002dms_002dformat-467"></a>When used in combination with <samp><span class="option">-Wformat</span></samp> and <samp><span class="option">-pedantic</span></samp> without GNU extensions, this option disables the warnings about non-ISO <code>printf</code> / <code>scanf</code> format width specifiers <code>I32</code>, <code>I64</code>, and <code>I</code> used on Windows targets, which depend on the MS runtime. <br><dt><code>-Wpointer-arith</code><dd><a name="index-Wpointer_002darith-468"></a><a name="index-Wno_002dpointer_002darith-469"></a>Warn about anything that depends on the “size of” a function type or of <code>void</code>. GNU C assigns these types a size of 1, for convenience in calculations with <code>void *</code> pointers and pointers to functions. In C++, warn also when an arithmetic operation involves <code>NULL</code>. This warning is also enabled by <samp><span class="option">-Wpedantic</span></samp>. <br><dt><code>-Wtype-limits</code><dd><a name="index-Wtype_002dlimits-470"></a><a name="index-Wno_002dtype_002dlimits-471"></a>Warn if a comparison is always true or always false due to the limited range of the data type, but do not warn for constant expressions. For example, warn if an unsigned variable is compared against zero with <code><</code> or <code>>=</code>. This warning is also enabled by <samp><span class="option">-Wextra</span></samp>. <br><dt><code>-Wbad-function-cast </code><span class="roman">(C and Objective-C only)</span><dd><a name="index-Wbad_002dfunction_002dcast-472"></a><a name="index-Wno_002dbad_002dfunction_002dcast-473"></a>Warn when a function call is cast to a non-matching type. For example, warn if a call to a function returning an integer type is cast to a pointer type. <br><dt><code>-Wc90-c99-compat </code><span class="roman">(C and Objective-C only)</span><dd><a name="index-Wc90_002dc99_002dcompat-474"></a><a name="index-Wno_002dc90_002dc99_002dcompat-475"></a>Warn about features not present in ISO C90, but present in ISO C99. For instance, warn about use of variable length arrays, <code>long long</code> type, <code>bool</code> type, compound literals, designated initializers, and so on. This option is independent of the standards mode. Warnings are disabled in the expression that follows <code>__extension__</code>. <br><dt><code>-Wc99-c11-compat </code><span class="roman">(C and Objective-C only)</span><dd><a name="index-Wc99_002dc11_002dcompat-476"></a><a name="index-Wno_002dc99_002dc11_002dcompat-477"></a>Warn about features not present in ISO C99, but present in ISO C11. For instance, warn about use of anonymous structures and unions, <code>_Atomic</code> type qualifier, <code>_Thread_local</code> storage-class specifier, <code>_Alignas</code> specifier, <code>Alignof</code> operator, <code>_Generic</code> keyword, and so on. This option is independent of the standards mode. Warnings are disabled in the expression that follows <code>__extension__</code>. <br><dt><code>-Wc++-compat </code><span class="roman">(C and Objective-C only)</span><dd><a name="index-Wc_002b_002b_002dcompat-478"></a>Warn about ISO C constructs that are outside of the common subset of ISO C and ISO C++, e.g. request for implicit conversion from <code>void *</code> to a pointer to non-<code>void</code> type. <br><dt><code>-Wc++11-compat </code><span class="roman">(C++ and Objective-C++ only)</span><dd><a name="index-Wc_002b_002b11_002dcompat-479"></a>Warn about C++ constructs whose meaning differs between ISO C++ 1998 and ISO C++ 2011, e.g., identifiers in ISO C++ 1998 that are keywords in ISO C++ 2011. This warning turns on <samp><span class="option">-Wnarrowing</span></samp> and is enabled by <samp><span class="option">-Wall</span></samp>. <br><dt><code>-Wc++14-compat </code><span class="roman">(C++ and Objective-C++ only)</span><dd><a name="index-Wc_002b_002b14_002dcompat-480"></a>Warn about C++ constructs whose meaning differs between ISO C++ 2011 and ISO C++ 2014. This warning is enabled by <samp><span class="option">-Wall</span></samp>. <br><dt><code>-Wcast-qual</code><dd><a name="index-Wcast_002dqual-481"></a><a name="index-Wno_002dcast_002dqual-482"></a>Warn whenever a pointer is cast so as to remove a type qualifier from the target type. For example, warn if a <code>const char *</code> is cast to an ordinary <code>char *</code>. <p>Also warn when making a cast that introduces a type qualifier in an unsafe way. For example, casting <code>char **</code> to <code>const char **</code> is unsafe, as in this example: <pre class="smallexample"> /* p is char ** value. */ const char **q = (const char **) p; /* Assignment of readonly string to const char * is OK. */ *q = "string"; /* Now char** pointer points to read-only memory. */ **p = 'b'; </pre> <br><dt><code>-Wcast-align</code><dd><a name="index-Wcast_002dalign-483"></a><a name="index-Wno_002dcast_002dalign-484"></a>Warn whenever a pointer is cast such that the required alignment of the target is increased. For example, warn if a <code>char *</code> is cast to an <code>int *</code> on machines where integers can only be accessed at two- or four-byte boundaries. <br><dt><code>-Wwrite-strings</code><dd><a name="index-Wwrite_002dstrings-485"></a><a name="index-Wno_002dwrite_002dstrings-486"></a>When compiling C, give string constants the type <code>const char[</code><var>length</var><code>]</code> so that copying the address of one into a non-<code>const</code> <code>char *</code> pointer produces a warning. These warnings help you find at compile time code that can try to write into a string constant, but only if you have been very careful about using <code>const</code> in declarations and prototypes. Otherwise, it is just a nuisance. This is why we did not make <samp><span class="option">-Wall</span></samp> request these warnings. <p>When compiling C++, warn about the deprecated conversion from string literals to <code>char *</code>. This warning is enabled by default for C++ programs. <br><dt><code>-Wclobbered</code><dd><a name="index-Wclobbered-487"></a><a name="index-Wno_002dclobbered-488"></a>Warn for variables that might be changed by <code>longjmp</code> or <code>vfork</code>. This warning is also enabled by <samp><span class="option">-Wextra</span></samp>. <br><dt><code>-Wconditionally-supported </code><span class="roman">(C++ and Objective-C++ only)</span><dd><a name="index-Wconditionally_002dsupported-489"></a><a name="index-Wno_002dconditionally_002dsupported-490"></a>Warn for conditionally-supported (C++11 [intro.defs]) constructs. <br><dt><code>-Wconversion</code><dd><a name="index-Wconversion-491"></a><a name="index-Wno_002dconversion-492"></a>Warn for implicit conversions that may alter a value. This includes conversions between real and integer, like <code>abs (x)</code> when <code>x</code> is <code>double</code>; conversions between signed and unsigned, like <code>unsigned ui = -1</code>; and conversions to smaller types, like <code>sqrtf (M_PI)</code>. Do not warn for explicit casts like <code>abs ((int) x)</code> and <code>ui = (unsigned) -1</code>, or if the value is not changed by the conversion like in <code>abs (2.0)</code>. Warnings about conversions between signed and unsigned integers can be disabled by using <samp><span class="option">-Wno-sign-conversion</span></samp>. <p>For C++, also warn for confusing overload resolution for user-defined conversions; and conversions that never use a type conversion operator: conversions to <code>void</code>, the same type, a base class or a reference to them. Warnings about conversions between signed and unsigned integers are disabled by default in C++ unless <samp><span class="option">-Wsign-conversion</span></samp> is explicitly enabled. <br><dt><code>-Wno-conversion-null </code><span class="roman">(C++ and Objective-C++ only)</span><dd><a name="index-Wconversion_002dnull-493"></a><a name="index-Wno_002dconversion_002dnull-494"></a>Do not warn for conversions between <code>NULL</code> and non-pointer types. <samp><span class="option">-Wconversion-null</span></samp> is enabled by default. <br><dt><code>-Wzero-as-null-pointer-constant </code><span class="roman">(C++ and Objective-C++ only)</span><dd><a name="index-Wzero_002das_002dnull_002dpointer_002dconstant-495"></a><a name="index-Wno_002dzero_002das_002dnull_002dpointer_002dconstant-496"></a>Warn when a literal '0' is used as null pointer constant. This can be useful to facilitate the conversion to <code>nullptr</code> in C++11. <br><dt><code>-Wdate-time</code><dd><a name="index-Wdate_002dtime-497"></a><a name="index-Wno_002ddate_002dtime-498"></a>Warn when macros <code>__TIME__</code>, <code>__DATE__</code> or <code>__TIMESTAMP__</code> are encountered as they might prevent bit-wise-identical reproducible compilations. <br><dt><code>-Wdelete-incomplete </code><span class="roman">(C++ and Objective-C++ only)</span><dd><a name="index-Wdelete_002dincomplete-499"></a><a name="index-Wno_002ddelete_002dincomplete-500"></a>Warn when deleting a pointer to incomplete type, which may cause undefined behavior at runtime. This warning is enabled by default. <br><dt><code>-Wuseless-cast </code><span class="roman">(C++ and Objective-C++ only)</span><dd><a name="index-Wuseless_002dcast-501"></a><a name="index-Wno_002duseless_002dcast-502"></a>Warn when an expression is casted to its own type. <br><dt><code>-Wempty-body</code><dd><a name="index-Wempty_002dbody-503"></a><a name="index-Wno_002dempty_002dbody-504"></a>Warn if an empty body occurs in an <code>if</code>, <code>else</code> or <code>do while</code> statement. This warning is also enabled by <samp><span class="option">-Wextra</span></samp>. <br><dt><code>-Wenum-compare</code><dd><a name="index-Wenum_002dcompare-505"></a><a name="index-Wno_002denum_002dcompare-506"></a>Warn about a comparison between values of different enumerated types. In C++ enumeral mismatches in conditional expressions are also diagnosed and the warning is enabled by default. In C this warning is enabled by <samp><span class="option">-Wall</span></samp>. <br><dt><code>-Wjump-misses-init </code><span class="roman">(C, Objective-C only)</span><dd><a name="index-Wjump_002dmisses_002dinit-507"></a><a name="index-Wno_002djump_002dmisses_002dinit-508"></a>Warn if a <code>goto</code> statement or a <code>switch</code> statement jumps forward across the initialization of a variable, or jumps backward to a label after the variable has been initialized. This only warns about variables that are initialized when they are declared. This warning is only supported for C and Objective-C; in C++ this sort of branch is an error in any case. <p><samp><span class="option">-Wjump-misses-init</span></samp> is included in <samp><span class="option">-Wc++-compat</span></samp>. It can be disabled with the <samp><span class="option">-Wno-jump-misses-init</span></samp> option. <br><dt><code>-Wsign-compare</code><dd><a name="index-Wsign_002dcompare-509"></a><a name="index-Wno_002dsign_002dcompare-510"></a><a name="index-warning-for-comparison-of-signed-and-unsigned-values-511"></a><a name="index-comparison-of-signed-and-unsigned-values_002c-warning-512"></a><a name="index-signed-and-unsigned-values_002c-comparison-warning-513"></a>Warn when a comparison between signed and unsigned values could produce an incorrect result when the signed value is converted to unsigned. This warning is also enabled by <samp><span class="option">-Wextra</span></samp>; to get the other warnings of <samp><span class="option">-Wextra</span></samp> without this warning, use <samp><span class="option">-Wextra -Wno-sign-compare</span></samp>. <br><dt><code>-Wsign-conversion</code><dd><a name="index-Wsign_002dconversion-514"></a><a name="index-Wno_002dsign_002dconversion-515"></a>Warn for implicit conversions that may change the sign of an integer value, like assigning a signed integer expression to an unsigned integer variable. An explicit cast silences the warning. In C, this option is enabled also by <samp><span class="option">-Wconversion</span></samp>. <br><dt><code>-Wfloat-conversion</code><dd><a name="index-Wfloat_002dconversion-516"></a><a name="index-Wno_002dfloat_002dconversion-517"></a>Warn for implicit conversions that reduce the precision of a real value. This includes conversions from real to integer, and from higher precision real to lower precision real values. This option is also enabled by <samp><span class="option">-Wconversion</span></samp>. <br><dt><code>-Wsized-deallocation </code><span class="roman">(C++ and Objective-C++ only)</span><dd><a name="index-Wsized_002ddeallocation-518"></a><a name="index-Wno_002dsized_002ddeallocation-519"></a>Warn about a definition of an unsized deallocation function <pre class="smallexample"> void operator delete (void *) noexcept; void operator delete[] (void *) noexcept; </pre> <p>without a definition of the corresponding sized deallocation function <pre class="smallexample"> void operator delete (void *, std::size_t) noexcept; void operator delete[] (void *, std::size_t) noexcept; </pre> <p>or vice versa. Enabled by <samp><span class="option">-Wextra</span></samp> along with <samp><span class="option">-fsized-deallocation</span></samp>. <br><dt><code>-Wsizeof-pointer-memaccess</code><dd><a name="index-Wsizeof_002dpointer_002dmemaccess-520"></a><a name="index-Wno_002dsizeof_002dpointer_002dmemaccess-521"></a>Warn for suspicious length parameters to certain string and memory built-in functions if the argument uses <code>sizeof</code>. This warning warns e.g. about <code>memset (ptr, 0, sizeof (ptr));</code> if <code>ptr</code> is not an array, but a pointer, and suggests a possible fix, or about <code>memcpy (&foo, ptr, sizeof (&foo));</code>. This warning is enabled by <samp><span class="option">-Wall</span></samp>. <br><dt><code>-Wsizeof-array-argument</code><dd><a name="index-Wsizeof_002darray_002dargument-522"></a><a name="index-Wno_002dsizeof_002darray_002dargument-523"></a>Warn when the <code>sizeof</code> operator is applied to a parameter that is declared as an array in a function definition. This warning is enabled by default for C and C++ programs. <br><dt><code>-Wmemset-transposed-args</code><dd><a name="index-Wmemset_002dtransposed_002dargs-524"></a><a name="index-Wno_002dmemset_002dtransposed_002dargs-525"></a>Warn for suspicious calls to the <code>memset</code> built-in function, if the second argument is not zero and the third argument is zero. This warns e.g. about <code>memset (buf, sizeof buf, 0)</code> where most probably <code>memset (buf, 0, sizeof buf)</code> was meant instead. The diagnostics is only emitted if the third argument is literal zero. If it is some expression that is folded to zero, a cast of zero to some type, etc., it is far less likely that the user has mistakenly exchanged the arguments and no warning is emitted. This warning is enabled by <samp><span class="option">-Wall</span></samp>. <br><dt><code>-Waddress</code><dd><a name="index-Waddress-526"></a><a name="index-Wno_002daddress-527"></a>Warn about suspicious uses of memory addresses. These include using the address of a function in a conditional expression, such as <code>void func(void); if (func)</code>, and comparisons against the memory address of a string literal, such as <code>if (x == "abc")</code>. Such uses typically indicate a programmer error: the address of a function always evaluates to true, so their use in a conditional usually indicate that the programmer forgot the parentheses in a function call; and comparisons against string literals result in unspecified behavior and are not portable in C, so they usually indicate that the programmer intended to use <code>strcmp</code>. This warning is enabled by <samp><span class="option">-Wall</span></samp>. <br><dt><code>-Wlogical-op</code><dd><a name="index-Wlogical_002dop-528"></a><a name="index-Wno_002dlogical_002dop-529"></a>Warn about suspicious uses of logical operators in expressions. This includes using logical operators in contexts where a bit-wise operator is likely to be expected. <br><dt><code>-Wlogical-not-parentheses</code><dd><a name="index-Wlogical_002dnot_002dparentheses-530"></a><a name="index-Wno_002dlogical_002dnot_002dparentheses-531"></a>Warn about logical not used on the left hand side operand of a comparison. This option does not warn if the RHS operand is of a boolean type. Its purpose is to detect suspicious code like the following: <pre class="smallexample"> int a; ... if (!a > 1) { ... } </pre> <p>It is possible to suppress the warning by wrapping the LHS into parentheses: <pre class="smallexample"> if ((!a) > 1) { ... } </pre> <p>This warning is enabled by <samp><span class="option">-Wall</span></samp>. <br><dt><code>-Waggregate-return</code><dd><a name="index-Waggregate_002dreturn-532"></a><a name="index-Wno_002daggregate_002dreturn-533"></a>Warn if any functions that return structures or unions are defined or called. (In languages where you can return an array, this also elicits a warning.) <br><dt><code>-Wno-aggressive-loop-optimizations</code><dd><a name="index-Wno_002daggressive_002dloop_002doptimizations-534"></a><a name="index-Waggressive_002dloop_002doptimizations-535"></a>Warn if in a loop with constant number of iterations the compiler detects undefined behavior in some statement during one or more of the iterations. <br><dt><code>-Wno-attributes</code><dd><a name="index-Wno_002dattributes-536"></a><a name="index-Wattributes-537"></a>Do not warn if an unexpected <code>__attribute__</code> is used, such as unrecognized attributes, function attributes applied to variables, etc. This does not stop errors for incorrect use of supported attributes. <br><dt><code>-Wno-builtin-macro-redefined</code><dd><a name="index-Wno_002dbuiltin_002dmacro_002dredefined-538"></a><a name="index-Wbuiltin_002dmacro_002dredefined-539"></a>Do not warn if certain built-in macros are redefined. This suppresses warnings for redefinition of <code>__TIMESTAMP__</code>, <code>__TIME__</code>, <code>__DATE__</code>, <code>__FILE__</code>, and <code>__BASE_FILE__</code>. <br><dt><code>-Wstrict-prototypes </code><span class="roman">(C and Objective-C only)</span><dd><a name="index-Wstrict_002dprototypes-540"></a><a name="index-Wno_002dstrict_002dprototypes-541"></a>Warn if a function is declared or defined without specifying the argument types. (An old-style function definition is permitted without a warning if preceded by a declaration that specifies the argument types.) <br><dt><code>-Wold-style-declaration </code><span class="roman">(C and Objective-C only)</span><dd><a name="index-Wold_002dstyle_002ddeclaration-542"></a><a name="index-Wno_002dold_002dstyle_002ddeclaration-543"></a>Warn for obsolescent usages, according to the C Standard, in a declaration. For example, warn if storage-class specifiers like <code>static</code> are not the first things in a declaration. This warning is also enabled by <samp><span class="option">-Wextra</span></samp>. <br><dt><code>-Wold-style-definition </code><span class="roman">(C and Objective-C only)</span><dd><a name="index-Wold_002dstyle_002ddefinition-544"></a><a name="index-Wno_002dold_002dstyle_002ddefinition-545"></a>Warn if an old-style function definition is used. A warning is given even if there is a previous prototype. <br><dt><code>-Wmissing-parameter-type </code><span class="roman">(C and Objective-C only)</span><dd><a name="index-Wmissing_002dparameter_002dtype-546"></a><a name="index-Wno_002dmissing_002dparameter_002dtype-547"></a>A function parameter is declared without a type specifier in K&R-style functions: <pre class="smallexample"> void foo(bar) { } </pre> <p>This warning is also enabled by <samp><span class="option">-Wextra</span></samp>. <br><dt><code>-Wmissing-prototypes </code><span class="roman">(C and Objective-C only)</span><dd><a name="index-Wmissing_002dprototypes-548"></a><a name="index-Wno_002dmissing_002dprototypes-549"></a>Warn if a global function is defined without a previous prototype declaration. This warning is issued even if the definition itself provides a prototype. Use this option to detect global functions that do not have a matching prototype declaration in a header file. This option is not valid for C++ because all function declarations provide prototypes and a non-matching declaration declares an overload rather than conflict with an earlier declaration. Use <samp><span class="option">-Wmissing-declarations</span></samp> to detect missing declarations in C++. <br><dt><code>-Wmissing-declarations</code><dd><a name="index-Wmissing_002ddeclarations-550"></a><a name="index-Wno_002dmissing_002ddeclarations-551"></a>Warn if a global function is defined without a previous declaration. Do so even if the definition itself provides a prototype. Use this option to detect global functions that are not declared in header files. In C, no warnings are issued for functions with previous non-prototype declarations; use <samp><span class="option">-Wmissing-prototypes</span></samp> to detect missing prototypes. In C++, no warnings are issued for function templates, or for inline functions, or for functions in anonymous namespaces. <br><dt><code>-Wmissing-field-initializers</code><dd><a name="index-Wmissing_002dfield_002dinitializers-552"></a><a name="index-Wno_002dmissing_002dfield_002dinitializers-553"></a><a name="index-W-554"></a><a name="index-Wextra-555"></a><a name="index-Wno_002dextra-556"></a>Warn if a structure's initializer has some fields missing. For example, the following code causes such a warning, because <code>x.h</code> is implicitly zero: <pre class="smallexample"> struct s { int f, g, h; }; struct s x = { 3, 4 }; </pre> <p>This option does not warn about designated initializers, so the following modification does not trigger a warning: <pre class="smallexample"> struct s { int f, g, h; }; struct s x = { .f = 3, .g = 4 }; </pre> <p>In C++ this option does not warn either about the empty { } initializer, for example: <pre class="smallexample"> struct s { int f, g, h; }; s x = { }; </pre> <p>This warning is included in <samp><span class="option">-Wextra</span></samp>. To get other <samp><span class="option">-Wextra</span></samp> warnings without this one, use <samp><span class="option">-Wextra -Wno-missing-field-initializers</span></samp>. <br><dt><code>-Wno-multichar</code><dd><a name="index-Wno_002dmultichar-557"></a><a name="index-Wmultichar-558"></a>Do not warn if a multicharacter constant (‘<samp><span class="samp">'FOOF'</span></samp>’) is used. Usually they indicate a typo in the user's code, as they have implementation-defined values, and should not be used in portable code. <br><dt><code>-Wnormalized</code><span class="roman">[</span><code>=</code><span class="roman"><</span><code>none</code><span class="roman">|</span><code>id</code><span class="roman">|</span><code>nfc</code><span class="roman">|</span><code>nfkc</code><span class="roman">>]</span><dd><a name="index-Wnormalized_003d-559"></a><a name="index-Wnormalized-560"></a><a name="index-Wno_002dnormalized-561"></a><a name="index-NFC-562"></a><a name="index-NFKC-563"></a><a name="index-character-set_002c-input-normalization-564"></a>In ISO C and ISO C++, two identifiers are different if they are different sequences of characters. However, sometimes when characters outside the basic ASCII character set are used, you can have two different character sequences that look the same. To avoid confusion, the ISO 10646 standard sets out some <dfn>normalization rules</dfn> which when applied ensure that two sequences that look the same are turned into the same sequence. GCC can warn you if you are using identifiers that have not been normalized; this option controls that warning. <p>There are four levels of warning supported by GCC. The default is <samp><span class="option">-Wnormalized=nfc</span></samp>, which warns about any identifier that is not in the ISO 10646 “C” normalized form, <dfn>NFC</dfn>. NFC is the recommended form for most uses. It is equivalent to <samp><span class="option">-Wnormalized</span></samp>. <p>Unfortunately, there are some characters allowed in identifiers by ISO C and ISO C++ that, when turned into NFC, are not allowed in identifiers. That is, there's no way to use these symbols in portable ISO C or C++ and have all your identifiers in NFC. <samp><span class="option">-Wnormalized=id</span></samp> suppresses the warning for these characters. It is hoped that future versions of the standards involved will correct this, which is why this option is not the default. <p>You can switch the warning off for all characters by writing <samp><span class="option">-Wnormalized=none</span></samp> or <samp><span class="option">-Wno-normalized</span></samp>. You should only do this if you are using some other normalization scheme (like “D”), because otherwise you can easily create bugs that are literally impossible to see. <p>Some characters in ISO 10646 have distinct meanings but look identical in some fonts or display methodologies, especially once formatting has been applied. For instance <code>\u207F</code>, “SUPERSCRIPT LATIN SMALL LETTER N”, displays just like a regular <code>n</code> that has been placed in a superscript. ISO 10646 defines the <dfn>NFKC</dfn> normalization scheme to convert all these into a standard form as well, and GCC warns if your code is not in NFKC if you use <samp><span class="option">-Wnormalized=nfkc</span></samp>. This warning is comparable to warning about every identifier that contains the letter O because it might be confused with the digit 0, and so is not the default, but may be useful as a local coding convention if the programming environment cannot be fixed to display these characters distinctly. <br><dt><code>-Wno-deprecated</code><dd><a name="index-Wno_002ddeprecated-565"></a><a name="index-Wdeprecated-566"></a>Do not warn about usage of deprecated features. See <a href="Deprecated-Features.html#Deprecated-Features">Deprecated Features</a>. <br><dt><code>-Wno-deprecated-declarations</code><dd><a name="index-Wno_002ddeprecated_002ddeclarations-567"></a><a name="index-Wdeprecated_002ddeclarations-568"></a>Do not warn about uses of functions (see <a href="Function-Attributes.html#Function-Attributes">Function Attributes</a>), variables (see <a href="Variable-Attributes.html#Variable-Attributes">Variable Attributes</a>), and types (see <a href="Type-Attributes.html#Type-Attributes">Type Attributes</a>) marked as deprecated by using the <code>deprecated</code> attribute. <br><dt><code>-Wno-overflow</code><dd><a name="index-Wno_002doverflow-569"></a><a name="index-Woverflow-570"></a>Do not warn about compile-time overflow in constant expressions. <br><dt><code>-Wno-odr</code><dd><a name="index-Wno_002dodr-571"></a><a name="index-Wodr-572"></a>Warn about One Definition Rule violations during link-time optimization. Requires <samp><span class="option">-flto-odr-type-merging</span></samp> to be enabled. Enabled by default. <br><dt><code>-Wopenmp-simd</code><dd><a name="index-Wopenm_002dsimd-573"></a>Warn if the vectorizer cost model overrides the OpenMP or the Cilk Plus simd directive set by user. The <samp><span class="option">-fsimd-cost-model=unlimited</span></samp> option can be used to relax the cost model. <br><dt><code>-Woverride-init </code><span class="roman">(C and Objective-C only)</span><dd><a name="index-Woverride_002dinit-574"></a><a name="index-Wno_002doverride_002dinit-575"></a><a name="index-W-576"></a><a name="index-Wextra-577"></a><a name="index-Wno_002dextra-578"></a>Warn if an initialized field without side effects is overridden when using designated initializers (see <a href="Designated-Inits.html#Designated-Inits">Designated Initializers</a>). <p>This warning is included in <samp><span class="option">-Wextra</span></samp>. To get other <samp><span class="option">-Wextra</span></samp> warnings without this one, use <samp><span class="option">-Wextra -Wno-override-init</span></samp>. <br><dt><code>-Wpacked</code><dd><a name="index-Wpacked-579"></a><a name="index-Wno_002dpacked-580"></a>Warn if a structure is given the packed attribute, but the packed attribute has no effect on the layout or size of the structure. Such structures may be mis-aligned for little benefit. For instance, in this code, the variable <code>f.x</code> in <code>struct bar</code> is misaligned even though <code>struct bar</code> does not itself have the packed attribute: <pre class="smallexample"> struct foo { int x; char a, b, c, d; } __attribute__((packed)); struct bar { char z; struct foo f; }; </pre> <br><dt><code>-Wpacked-bitfield-compat</code><dd><a name="index-Wpacked_002dbitfield_002dcompat-581"></a><a name="index-Wno_002dpacked_002dbitfield_002dcompat-582"></a>The 4.1, 4.2 and 4.3 series of GCC ignore the <code>packed</code> attribute on bit-fields of type <code>char</code>. This has been fixed in GCC 4.4 but the change can lead to differences in the structure layout. GCC informs you when the offset of such a field has changed in GCC 4.4. For example there is no longer a 4-bit padding between field <code>a</code> and <code>b</code> in this structure: <pre class="smallexample"> struct foo { char a:4; char b:8; } __attribute__ ((packed)); </pre> <p>This warning is enabled by default. Use <samp><span class="option">-Wno-packed-bitfield-compat</span></samp> to disable this warning. <br><dt><code>-Wpadded</code><dd><a name="index-Wpadded-583"></a><a name="index-Wno_002dpadded-584"></a>Warn if padding is included in a structure, either to align an element of the structure or to align the whole structure. Sometimes when this happens it is possible to rearrange the fields of the structure to reduce the padding and so make the structure smaller. <br><dt><code>-Wredundant-decls</code><dd><a name="index-Wredundant_002ddecls-585"></a><a name="index-Wno_002dredundant_002ddecls-586"></a>Warn if anything is declared more than once in the same scope, even in cases where multiple declaration is valid and changes nothing. <br><dt><code>-Wnested-externs </code><span class="roman">(C and Objective-C only)</span><dd><a name="index-Wnested_002dexterns-587"></a><a name="index-Wno_002dnested_002dexterns-588"></a>Warn if an <code>extern</code> declaration is encountered within a function. <br><dt><code>-Wno-inherited-variadic-ctor</code><dd><a name="index-Winherited_002dvariadic_002dctor-589"></a><a name="index-Wno_002dinherited_002dvariadic_002dctor-590"></a>Suppress warnings about use of C++11 inheriting constructors when the base class inherited from has a C variadic constructor; the warning is on by default because the ellipsis is not inherited. <br><dt><code>-Winline</code><dd><a name="index-Winline-591"></a><a name="index-Wno_002dinline-592"></a>Warn if a function that is declared as inline cannot be inlined. Even with this option, the compiler does not warn about failures to inline functions declared in system headers. <p>The compiler uses a variety of heuristics to determine whether or not to inline a function. For example, the compiler takes into account the size of the function being inlined and the amount of inlining that has already been done in the current function. Therefore, seemingly insignificant changes in the source program can cause the warnings produced by <samp><span class="option">-Winline</span></samp> to appear or disappear. <br><dt><code>-Wno-invalid-offsetof </code><span class="roman">(C++ and Objective-C++ only)</span><dd><a name="index-Wno_002dinvalid_002doffsetof-593"></a><a name="index-Winvalid_002doffsetof-594"></a>Suppress warnings from applying the <code>offsetof</code> macro to a non-POD type. According to the 2014 ISO C++ standard, applying <code>offsetof</code> to a non-standard-layout type is undefined. In existing C++ implementations, however, <code>offsetof</code> typically gives meaningful results. This flag is for users who are aware that they are writing nonportable code and who have deliberately chosen to ignore the warning about it. <p>The restrictions on <code>offsetof</code> may be relaxed in a future version of the C++ standard. <br><dt><code>-Wno-int-to-pointer-cast</code><dd><a name="index-Wno_002dint_002dto_002dpointer_002dcast-595"></a><a name="index-Wint_002dto_002dpointer_002dcast-596"></a>Suppress warnings from casts to pointer type of an integer of a different size. In C++, casting to a pointer type of smaller size is an error. <samp><span class="option">Wint-to-pointer-cast</span></samp> is enabled by default. <br><dt><code>-Wno-pointer-to-int-cast </code><span class="roman">(C and Objective-C only)</span><dd><a name="index-Wno_002dpointer_002dto_002dint_002dcast-597"></a><a name="index-Wpointer_002dto_002dint_002dcast-598"></a>Suppress warnings from casts from a pointer to an integer type of a different size. <br><dt><code>-Winvalid-pch</code><dd><a name="index-Winvalid_002dpch-599"></a><a name="index-Wno_002dinvalid_002dpch-600"></a>Warn if a precompiled header (see <a href="Precompiled-Headers.html#Precompiled-Headers">Precompiled Headers</a>) is found in the search path but can't be used. <br><dt><code>-Wlong-long</code><dd><a name="index-Wlong_002dlong-601"></a><a name="index-Wno_002dlong_002dlong-602"></a>Warn if <code>long long</code> type is used. This is enabled by either <samp><span class="option">-Wpedantic</span></samp> or <samp><span class="option">-Wtraditional</span></samp> in ISO C90 and C++98 modes. To inhibit the warning messages, use <samp><span class="option">-Wno-long-long</span></samp>. <br><dt><code>-Wvariadic-macros</code><dd><a name="index-Wvariadic_002dmacros-603"></a><a name="index-Wno_002dvariadic_002dmacros-604"></a>Warn if variadic macros are used in ISO C90 mode, or if the GNU alternate syntax is used in ISO C99 mode. This is enabled by either <samp><span class="option">-Wpedantic</span></samp> or <samp><span class="option">-Wtraditional</span></samp>. To inhibit the warning messages, use <samp><span class="option">-Wno-variadic-macros</span></samp>. <br><dt><code>-Wvarargs</code><dd><a name="index-Wvarargs-605"></a><a name="index-Wno_002dvarargs-606"></a>Warn upon questionable usage of the macros used to handle variable arguments like <code>va_start</code>. This is default. To inhibit the warning messages, use <samp><span class="option">-Wno-varargs</span></samp>. <br><dt><code>-Wvector-operation-performance</code><dd><a name="index-Wvector_002doperation_002dperformance-607"></a><a name="index-Wno_002dvector_002doperation_002dperformance-608"></a>Warn if vector operation is not implemented via SIMD capabilities of the architecture. Mainly useful for the performance tuning. Vector operation can be implemented <code>piecewise</code>, which means that the scalar operation is performed on every vector element; <code>in parallel</code>, which means that the vector operation is implemented using scalars of wider type, which normally is more performance efficient; and <code>as a single scalar</code>, which means that vector fits into a scalar type. <br><dt><code>-Wno-virtual-move-assign</code><dd><a name="index-Wvirtual_002dmove_002dassign-609"></a><a name="index-Wno_002dvirtual_002dmove_002dassign-610"></a>Suppress warnings about inheriting from a virtual base with a non-trivial C++11 move assignment operator. This is dangerous because if the virtual base is reachable along more than one path, it is moved multiple times, which can mean both objects end up in the moved-from state. If the move assignment operator is written to avoid moving from a moved-from object, this warning can be disabled. <br><dt><code>-Wvla</code><dd><a name="index-Wvla-611"></a><a name="index-Wno_002dvla-612"></a>Warn if variable length array is used in the code. <samp><span class="option">-Wno-vla</span></samp> prevents the <samp><span class="option">-Wpedantic</span></samp> warning of the variable length array. <br><dt><code>-Wvolatile-register-var</code><dd><a name="index-Wvolatile_002dregister_002dvar-613"></a><a name="index-Wno_002dvolatile_002dregister_002dvar-614"></a>Warn if a register variable is declared volatile. The volatile modifier does not inhibit all optimizations that may eliminate reads and/or writes to register variables. This warning is enabled by <samp><span class="option">-Wall</span></samp>. <br><dt><code>-Wdisabled-optimization</code><dd><a name="index-Wdisabled_002doptimization-615"></a><a name="index-Wno_002ddisabled_002doptimization-616"></a>Warn if a requested optimization pass is disabled. This warning does not generally indicate that there is anything wrong with your code; it merely indicates that GCC's optimizers are unable to handle the code effectively. Often, the problem is that your code is too big or too complex; GCC refuses to optimize programs when the optimization itself is likely to take inordinate amounts of time. <br><dt><code>-Wpointer-sign </code><span class="roman">(C and Objective-C only)</span><dd><a name="index-Wpointer_002dsign-617"></a><a name="index-Wno_002dpointer_002dsign-618"></a>Warn for pointer argument passing or assignment with different signedness. This option is only supported for C and Objective-C. It is implied by <samp><span class="option">-Wall</span></samp> and by <samp><span class="option">-Wpedantic</span></samp>, which can be disabled with <samp><span class="option">-Wno-pointer-sign</span></samp>. <br><dt><code>-Wstack-protector</code><dd><a name="index-Wstack_002dprotector-619"></a><a name="index-Wno_002dstack_002dprotector-620"></a>This option is only active when <samp><span class="option">-fstack-protector</span></samp> is active. It warns about functions that are not protected against stack smashing. <br><dt><code>-Woverlength-strings</code><dd><a name="index-Woverlength_002dstrings-621"></a><a name="index-Wno_002doverlength_002dstrings-622"></a>Warn about string constants that are longer than the “minimum maximum” length specified in the C standard. Modern compilers generally allow string constants that are much longer than the standard's minimum limit, but very portable programs should avoid using longer strings. <p>The limit applies <em>after</em> string constant concatenation, and does not count the trailing NUL. In C90, the limit was 509 characters; in C99, it was raised to 4095. C++98 does not specify a normative minimum maximum, so we do not diagnose overlength strings in C++. <p>This option is implied by <samp><span class="option">-Wpedantic</span></samp>, and can be disabled with <samp><span class="option">-Wno-overlength-strings</span></samp>. <br><dt><code>-Wunsuffixed-float-constants </code><span class="roman">(C and Objective-C only)</span><dd><a name="index-Wunsuffixed_002dfloat_002dconstants-623"></a> Issue a warning for any floating constant that does not have a suffix. When used together with <samp><span class="option">-Wsystem-headers</span></samp> it warns about such constants in system header files. This can be useful when preparing code to use with the <code>FLOAT_CONST_DECIMAL64</code> pragma from the decimal floating-point extension to C99. <br><dt><code>-Wno-designated-init </code><span class="roman">(C and Objective-C only)</span><dd>Suppress warnings when a positional initializer is used to initialize a structure that has been marked with the <code>designated_init</code> attribute. </dl> </body></html>