neulab/tldr huggingface dataset:
-Wstrict-overflow=4 Also warn about other simplifications not covered by the above cases.  For example: "(x * 10) / 5" is simplified to "x * 2".
-Wstrict-overflow=5 Also warn about cases where the compiler reduces the magnitude of a constant involved in a comparison.  For example: "x + 2 > y" is simplified to "x + 1 >= y".  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.
-Wstring-compare Warn for calls to "strcmp" and "strncmp" whose result is determined to be either zero or non-zero in tests for such equality owing to the length of one argument being greater than the size of the array the other argument is stored in (or the bound in the case of "strncmp"). Such calls could be mistakes.  For example, the call to "strcmp" below is diagnosed because its result is necessarily non-zero irrespective of the contents of the array "a".
extern char a[4]; void f (char *d) { strcpy (d, "string"); ... if (0 == strcmp (a, d))   // cannot be true puts ("a and d are the same"); }
-Wstring-compare is enabled by -Wextra.
-Wno-stringop-overflow -Wstringop-overflow -Wstringop-overflow=type Warn for calls to string manipulation functions such as "memcpy" and "strcpy" that are determined to overflow the destination buffer.  The optional argument is one greater than the type of Object Size Checking to perform to determine the size of the destination.  The argument is meaningful only for functions that operate on character arrays but not for raw memory functions like "memcpy" which always make use of Object Size type-0.  The option also warns for calls that specify a size in excess of the largest possible object or at most "SIZE_MAX / 2" bytes.  The option produces the best results with optimization enabled but can detect a small subset of simple buffer overflows even without optimization in calls to the GCC built-in functions like "__builtin_memcpy" that correspond to the standard functions.  In any case, the option warns about just a subset of buffer overflows detected by the corresponding overflow checking built-ins.  For example, the option issues a warning for the "strcpy" call below because it copies at least 5 characters (the string "blue" including the terminating NUL) into the buffer of size 4.
enum Color { blue, purple, yellow }; const char* f (enum Color clr) { static char buf [4]; const char *str; switch (clr) { case blue: str = "blue"; break; case purple: str = "purple"; break; case yellow: str = "yellow"; break; }
return strcpy (buf, str);   // warning here }
Option -Wstringop-overflow=2 is enabled by default.
-Wstringop-overflow -Wstringop-overflow=1 The -Wstringop-overflow=1 option uses type-zero Object Size Checking to determine the sizes of destination objects.  At this setting the option does not warn for writes past the end of subobjects of larger objects accessed by pointers unless the size of the largest surrounding object is known.  When the destination may be one of several objects it is assumed to be the largest one of them.  On Linux systems, when optimization is enabled at this setting the option warns for the same code as when the "_FORTIFY_SOURCE" macro is defined to a non-zero value.
-Wstringop-overflow=2 The -Wstringop-overflow=2 option uses type-one Object Size Checking to determine the sizes of destination objects.  At this setting the option warns about overflows when writing to members of the largest complete objects whose exact size is known. However, it does not warn for excessive writes to the same members of unknown objects referenced by pointers since they may point to arrays containing unknown numbers of elements.  This is the default setting of the option.
-Wstringop-overflow=3 The -Wstringop-overflow=3 option uses type-two Object Size Checking to determine the sizes of destination objects.  At this setting the option warns about overflowing the smallest object or data member.  This is the most restrictive setting of the option that may result in warnings for safe code.
-Wstringop-overflow=4 The -Wstringop-overflow=4 option uses type-three Object Size Checking to determine the sizes of destination objects.  At this setting the option warns about overflowing any data members, and when the destination is one of several objects it uses the size of the largest of them to decide whether to issue a warning. Similarly to -Wstringop-overflow=3 this setting of the option may result in warnings for benign code.
-Wno-stringop-overread Warn for calls to string manipulation functions such as "memchr", or "strcpy" that are determined to read past the end of the source sequence.
Option -Wstringop-overread is enabled by default.
-Wno-stringop-truncation Do not warn for calls to bounded string manipulation functions such as "strncat", "strncpy", and "stpncpy" that may either truncate the copied string or leave the destination unchanged.
In the following example, the call to "strncat" specifies a bound that is less than the length of the source string.  As a result, the copy of the source will be truncated and so the call is diagnosed. To avoid the warning use "bufsize - strlen (buf) - 1)" as the bound.
void append (char *buf, size_t bufsize) { strncat (buf, ".txt", 3); }
As another example, the following call to "strncpy" results in copying to "d" just the characters preceding the terminating NUL, without appending the NUL to the end.  Assuming the result of "strncpy" is necessarily a NUL-terminated string is a common mistake, and so the call is diagnosed.  To avoid the warning when the result is not expected to be NUL-terminated, call "memcpy" instead.
void copy (char *d, const char *s) { strncpy (d, s, strlen (s)); }
In the following example, the call to "strncpy" specifies the size of the destination buffer as the bound.  If the length of the source string is equal to or greater than this size the result of the copy will not be NUL-terminated.  Therefore, the call is also diagnosed. To avoid the warning, specify "sizeof buf - 1" as the bound and set the last element of the buffer to "NUL".
void copy (const char *s) { char buf[80]; strncpy (buf, s, sizeof buf); ... }
In situations where a character array is intended to store a sequence of bytes with no terminating "NUL" such an array may be annotated with attribute "nonstring" to avoid this warning.  Such arrays, however, are not suitable arguments to functions that expect "NUL"-terminated strings.  To help detect accidental misuses of such arrays GCC issues warnings unless it can prove that the use is safe.
-Wsuggest-attribute=[pure|const|noreturn|format|cold|malloc] Warn for cases where adding an attribute may be beneficial. The attributes currently supported are listed below.
-Wsuggest-attribute=pure -Wsuggest-attribute=const -Wsuggest-attribute=noreturn -Wmissing-noreturn -Wsuggest-attribute=malloc Warn about functions that might be candidates for attributes "pure", "const" or "noreturn" or "malloc". The compiler only warns for functions visible in other compilation units or (in the case of "pure" and "const") 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 "abort" or trapping.  This analysis requires option -fipa-pure-const, which is enabled by default at -O and higher. Higher optimization levels improve the accuracy of the analysis.
-Wsuggest-attribute=format -Wmissing-format-attribute Warn about function pointers that might be candidates for "format" attributes.  Note these are only possible candidates, not absolute ones.  GCC guesses that function pointers with "format" attributes that are used in assignment, initialization, parameter passing or return statements should have a corresponding "format" 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 "format" attribute to avoid the warning.
GCC also warns about function definitions that might be candidates for "format" attributes.  Again, these are only possible candidates.  GCC guesses that "format" attributes might be appropriate for any function that calls a function like "vprintf" or "vscanf", but this might not always be the case, and some functions for which "format" attributes are appropriate may not be detected.
-Wsuggest-attribute=cold Warn about functions that might be candidates for "cold" attribute.  This is based on static detection and generally only warns about functions which always leads to a call to another "cold" function such as wrappers of C++ "throw" or fatal error reporting functions leading to "abort".
-Walloc-zero Warn about calls to allocation functions decorated with attribute "alloc_size" that specify zero bytes, including those to the built-in forms of the functions "aligned_alloc", "alloca", "calloc", "malloc", and "realloc".  Because the behavior of these functions when called with a zero size differs among implementations (and in the case of "realloc" has been deprecated) relying on it may result in subtle portability bugs and should be avoided.
-Walloc-size-larger-than=byte-size Warn about calls to functions decorated with attribute "alloc_size" that attempt to allocate objects larger than the specified number of bytes, or where the result of the size computation in an integer type with infinite precision would exceed the value of PTRDIFF_MAX on the target.  -Walloc-size-larger-than=PTRDIFF_MAX is enabled by default. Warnings controlled by the option can be disabled either by specifying byte-size of SIZE_MAX or more or by -Wno-alloc-size-larger-than.
-Wno-alloc-size-larger-than Disable -Walloc-size-larger-than= warnings.  The option is equivalent to -Walloc-size-larger-than=SIZE_MAX or larger.
-Walloca This option warns on all uses of "alloca" in the source.
-Walloca-larger-than=byte-size This option warns on calls to "alloca" with an integer argument whose value is either zero, or that is not bounded by a controlling predicate that limits its value to at most byte-size.  It also warns for calls to "alloca" where the bound value is unknown.  Arguments of non-integer types are considered unbounded even if they appear to be constrained to the expected range.
For example, a bounded case of "alloca" could be:
void func (size_t n) { void *p; if (n <= 1000) p = alloca (n); else p = malloc (n); f (p); }
In the above example, passing "-Walloca-larger-than=1000" would not issue a warning because the call to "alloca" is known to be at most 1000 bytes.  However, if "-Walloca-larger-than=500" were passed, the compiler would emit a warning.
Unbounded uses, on the other hand, are uses of "alloca" with no controlling predicate constraining its integer argument.  For example:
void func () { void *p = alloca (n); f (p); }
If "-Walloca-larger-than=500" were passed, the above would trigger a warning, but this time because of the lack of bounds checking.
Note, that even seemingly correct code involving signed integers could cause a warning:
void func (signed int n) { if (n < 500) { p = alloca (n); f (p); } }
In the above example, n could be negative, causing a larger than expected argument to be implicitly cast into the "alloca" call.
This option also warns when "alloca" is used in a loop.
-Walloca-larger-than=PTRDIFF_MAX is enabled by default but is usually only effective  when -ftree-vrp is active (default for -O2 and above).
See also -Wvla-larger-than=byte-size.
-Wno-alloca-larger-than Disable -Walloca-larger-than= warnings.  The option is equivalent to -Walloca-larger-than=SIZE_MAX or larger.
-Warith-conversion Do warn about implicit conversions from arithmetic operations even when conversion of the operands to the same type cannot change their values.  This affects warnings from -Wconversion, -Wfloat-conversion, and -Wsign-conversion.
void f (char c, int i) { c = c + i; // warns with B<-Wconversion> c = c + 1; // only warns with B<-Warith-conversion> }
-Warray-bounds -Warray-bounds=n This option is only active when -ftree-vrp is active (default for -O2 and above). It warns about subscripts to arrays that are always out of bounds. This warning is enabled by -Wall.
-Warray-bounds=1 This is the warning level of -Warray-bounds and is enabled by -Wall; higher levels are not, and must be explicitly requested.
-Warray-bounds=2 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.
-Warray-parameter -Warray-parameter=n Warn about redeclarations of functions involving arguments of array or pointer types of inconsistent kinds or forms, and enable the detection of out-of-bounds accesses to such parameters by warnings such as -Warray-bounds.
If the first function declaration uses the array form the bound specified in the array is assumed to be the minimum number of elements expected to be provided in calls to the function and the maximum number of elements accessed by it.  Failing to provide arguments of sufficient size or accessing more than the maximum number of elements may be diagnosed by warnings such as -Warray-bounds.  At level 1 the warning diagnoses inconsistencies involving array parameters declared using the "T[static N]" form.
For example, the warning triggers for the following redeclarations because the first one allows an array of any size to be passed to "f" while the second one with the keyword "static" specifies that the array argument must have at least four elements.
void f (int[static 4]); void f (int[]);           // warning (inconsistent array form)
void g (void) { int *p = (int *)malloc (4); f (p);                  // warning (array too small) ... }
At level 2 the warning also triggers for redeclarations involving any other inconsistency in array or pointer argument forms denoting array sizes.  Pointers and arrays of unspecified bound are considered equivalent and do not trigger a warning.
void g (int*); void g (int[]);     // no warning void g (int[8]);    // warning (inconsistent array bound)
-Warray-parameter=2 is included in -Wall.  The -Wvla-parameter option triggers warnings for similar inconsistencies involving Variable Length Array arguments.
-Wattribute-alias=n -Wno-attribute-alias Warn about declarations using the "alias" and similar attributes whose target is incompatible with the type of the alias.
-Wattribute-alias=1 The default warning level of the -Wattribute-alias option diagnoses incompatibilities between the type of the alias declaration and that of its target.  Such incompatibilities are typically indicative of bugs.
-Wattribute-alias=2 At this level -Wattribute-alias also diagnoses cases where the attributes of the alias declaration are more restrictive than the attributes applied to its target.  These mismatches can potentially result in incorrect code generation.  In other cases they may be benign and could be resolved simply by adding the missing attribute to the target.  For comparison, see the -Wmissing-attributes option, which controls diagnostics when the alias declaration is less restrictive than the target, rather than more restrictive.
Attributes considered include "alloc_align", "alloc_size", "cold", "const", "hot", "leaf", "malloc", "nonnull", "noreturn", "nothrow", "pure", "returns_nonnull", and "returns_twice".
-Wattribute-alias is equivalent to -Wattribute-alias=1.  This is the default.  You can disable these warnings with either -Wno-attribute-alias or -Wattribute-alias=0.
-Wbool-compare Warn about boolean expression compared with an integer value different from "true"/"false".  For instance, the following comparison is always false:
int n = 5; ... if ((n > 1) == 2) { ... }
-Wbool-operation Warn about suspicious operations on expressions of a boolean type. For instance, bitwise negation of a boolean is very likely a bug in the program.  For C, this warning also warns about incrementing or decrementing a boolean, which rarely makes sense.  (In C++, decrementing a boolean is always invalid.  Incrementing a boolean is invalid in C++17, and deprecated otherwise.)
-Wduplicated-branches Warn when an if-else has identical branches.  This warning detects cases like
if (p != NULL) return 0; else return 0;
It doesn't warn when both branches contain just a null statement. This warning also warn for conditional operators:
int i = x ? *p : *p;
-Wduplicated-cond Warn about duplicated conditions in an if-else-if chain.  For instance, warn for the following code:
if (p->q != NULL) { ... } else if (p->q != NULL) { ... }
-Wframe-address Warn when the __builtin_frame_address or __builtin_return_address is called with an argument greater than 0.  Such calls may return indeterminate values or crash the program.  The warning is included in -Wall.
-Wno-discarded-qualifiers (C and Objective-C only) Do not warn if type qualifiers on pointers are being discarded. Typically, the compiler warns if a "const char *" variable is passed to a function that takes a "char *" parameter.  This option can be used to suppress such a warning.
-Wno-discarded-array-qualifiers (C and Objective-C only) Do not warn if type qualifiers on arrays which are pointer targets are being discarded.  Typically, the compiler warns if a "const int (*)[]" variable is passed to a function that takes a "int (*)[]" parameter.  This option can be used to suppress such a warning.
-Wno-incompatible-pointer-types (C and Objective-C only) Do not warn when there is a conversion between pointers that have incompatible types.  This warning is for cases not covered by -Wno-pointer-sign, which warns for pointer argument passing or assignment with different signedness.
-Wno-int-conversion (C and Objective-C only) Do not warn about incompatible integer to pointer and pointer to integer conversions.  This warning is about implicit conversions; for explicit conversions the warnings -Wno-int-to-pointer-cast and -Wno-pointer-to-int-cast may be used.
-Wzero-length-bounds Warn about accesses to elements of zero-length array members that might overlap other members of the same object.  Declaring interior zero-length arrays is discouraged because accesses to them are undefined.  See
For example, the first two stores in function "bad" are diagnosed because the array elements overlap the subsequent members "b" and "c".  The third store is diagnosed by -Warray-bounds because it is beyond the bounds of the enclosing object.
struct X { int a[0]; int b, c; }; struct X x;
void bad (void) { x.a[0] = 0;   // -Wzero-length-bounds x.a[1] = 1;   // -Wzero-length-bounds x.a[2] = 2;   // -Warray-bounds }
Option -Wzero-length-bounds is enabled by -Warray-bounds.
-Wno-div-by-zero 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.
-Wsystem-headers 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 -Wall in conjunction with this option does not warn about unknown pragmas in system headers---for that, -Wunknown-pragmas must also be used.
-Wtautological-compare Warn if a self-comparison always evaluates to true or false.  This warning detects various mistakes such as:
int i = 1; ... if (i > i) { ... }
This warning also warns about bitwise comparisons that always evaluate to true or false, for instance:
if ((a & 16) == 10) { ... }
will always be false.
-Wtrampolines 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.
-Wfloat-equal Warn if floating-point values are used in equality comparisons.
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.
-Wtraditional (C and Objective-C only) 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.
*   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.
*   In traditional C, some preprocessor directives did not exist. Traditional preprocessors only considered a line to be a directive if the # appeared in column 1 on the line.  Therefore -Wtraditional warns about directives that traditional C understands but ignores because the # does not appear as the first character on the line.  It also suggests you hide directives like "#pragma" not understood by traditional C by indenting them.  Some traditional implementations do not recognize "#elif", so this option suggests avoiding it altogether.
*   A function-like macro that appears without arguments.
*   The unary plus operator.
*   The U integer constant suffix, or the F or L floating-point constant suffixes.  (Traditional C does support the L suffix on integer constants.)  Note, these suffixes appear in macros defined in the system headers of most modern systems, e.g. the _MIN/_MAX macros in "<limits.h>".  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.
*   A function declared external in one block and then used after the end of the block.
*   A "switch" statement has an operand of type "long".
*   A non-"static" function declaration follows a "static" one.  This construct is not accepted by some traditional C compilers.
*   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.
*   Usage of ISO string concatenation is detected.
*   Initialization of automatic aggregates.
*   Identifier conflicts with labels.  Traditional C lacks a separate namespace for labels.
*   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. "__STDC__" to avoid missing initializer warnings and relies on default initialization to zero in the traditional C case.
*   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 -Wtraditional-conversion.
*   Use of ISO C style function definitions.  This warning intentionally is not issued for prototype declarations or variadic functions because these ISO C features appear in your code when using libiberty's traditional C compatibility macros, "PARAMS" and "VPARAMS".  This warning is also bypassed for nested functions because that feature is already a GCC extension and thus not relevant to traditional C compatibility.
-Wtraditional-conversion (C and Objective-C only) 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.
-Wdeclaration-after-statement (C and Objective-C only) 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.
-Wshadow 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.  If this warning is enabled, it includes also all instances of local shadowing.  This means that -Wno-shadow=local and -Wno-shadow=compatible-local are ignored when -Wshadow is used.  Same as -Wshadow=global.
-Wno-shadow-ivar (Objective-C only) Do not warn whenever a local variable shadows an instance variable in an Objective-C method.
-Wshadow=global Warn for any shadowing.  Same as -Wshadow.
-Wshadow=local Warn when a local variable shadows another local variable or parameter.
-Wshadow=compatible-local Warn when a local variable shadows another local variable or parameter whose type is compatible with that of the shadowing variable.  In C++, type compatibility here means the type of the shadowing variable can be converted to that of the shadowed variable. The creation of this flag (in addition to -Wshadow=local) is based on the idea that when a local variable shadows another one of incompatible type, it is most likely intentional, not a bug or typo, as shown in the following example:
for (SomeIterator i = SomeObj.begin(); i != SomeObj.end(); ++i) { for (int i = 0; i < N; ++i) { ... } ... }
Since the two variable "i" in the example above have incompatible types, enabling only -Wshadow=compatible-local does not emit a warning.  Because their types are incompatible, if a programmer accidentally uses one in place of the other, type checking is expected to catch that and emit an error or warning.  Use of this flag instead of -Wshadow=local can possibly reduce the number of warnings triggered by intentional shadowing.  Note that this also means that shadowing "const char *i" by "char *i" does not emit a warning.
This warning is also enabled by -Wshadow=local.
-Wlarger-than=byte-size Warn whenever an object is defined whose size exceeds byte-size. -Wlarger-than=PTRDIFF_MAX is enabled by default.  Warnings controlled by the option can be disabled either by specifying byte-size of SIZE_MAX or more or by -Wno-larger-than.
Also warn for calls to bounded functions such as "memchr" or "strnlen" that specify a bound greater than the largest possible object, which is PTRDIFF_MAX bytes by default.  These warnings can only be disabled by -Wno-larger-than.
-Wno-larger-than Disable -Wlarger-than= warnings.  The option is equivalent to -Wlarger-than=SIZE_MAX or larger.
-Wframe-larger-than=byte-size Warn if the size of a function frame exceeds byte-size.  The computation done to determine the stack frame size is approximate and not conservative.  The actual requirements may be somewhat greater than byte-size even if you do not get a warning.  In addition, any space allocated via "alloca", variable-length arrays, or related constructs is not included by the compiler when determining whether or not to issue a warning.  -Wframe-larger-than=PTRDIFF_MAX is enabled by default.  Warnings controlled by the option can be disabled either by specifying byte-size of SIZE_MAX or more or by -Wno-frame-larger-than.
-Wno-frame-larger-than Disable -Wframe-larger-than= warnings.  The option is equivalent to -Wframe-larger-than=SIZE_MAX or larger.
-Wno-free-nonheap-object Warn when attempting to deallocate an object that was either not allocated on the heap, or by using a pointer that was not returned from a prior call to the corresponding allocation function.  For example, because the call to "stpcpy" returns a pointer to the terminating nul character and not to the begginning of the object, the call to "free" below is diagnosed.
void f (char *p) { p = stpcpy (p, "abc"); // ... free (p);   // warning }
-Wfree-nonheap-object is enabled by default.
-Wstack-usage=byte-size Warn if the stack usage of a function might exceed byte-size.  The computation done to determine the stack usage is conservative.  Any space allocated via "alloca", variable-length arrays, or related constructs is included by the compiler when determining whether or not to issue a warning.
The message is in keeping with the output of -fstack-usage.
*   If the stack usage is fully static but exceeds the specified amount, it's:
warning: stack usage is 1120 bytes
*   If the stack usage is (partly) dynamic but bounded, it's:
warning: stack usage might be 1648 bytes
*   If the stack usage is (partly) dynamic and not bounded, it's:
warning: stack usage might be unbounded
-Wstack-usage=PTRDIFF_MAX is enabled by default.  Warnings controlled by the option can be disabled either by specifying byte-size of SIZE_MAX or more or by -Wno-stack-usage.
-Wno-stack-usage Disable -Wstack-usage= warnings.  The option is equivalent to -Wstack-usage=SIZE_MAX or larger.
-Wunsafe-loop-optimizations Warn if the loop cannot be optimized because the compiler cannot assume anything on the bounds of the loop indices.  With -funsafe-loop-optimizations warn if the compiler makes such assumptions.
-Wno-pedantic-ms-format (MinGW targets only) When used in combination with -Wformat and -pedantic without GNU extensions, this option disables the warnings about non-ISO "printf" / "scanf" format width specifiers "I32", "I64", and "I" used on Windows targets, which depend on the MS runtime.
-Wpointer-arith Warn about anything that depends on the "size of" a function type or of "void".  GNU C assigns these types a size of 1, for convenience in calculations with "void *" pointers and pointers to functions.  In C++, warn also when an arithmetic operation involves "NULL".  This warning is also enabled by -Wpedantic.
-Wno-pointer-compare Do not warn if a pointer is compared with a zero character constant. This usually means that the pointer was meant to be dereferenced. For example:
const char *p = foo (); if (p == '\0') return 42;
Note that the code above is invalid in C++11.
-Wtsan Warn about unsupported features in ThreadSanitizer.
ThreadSanitizer does not support "std::atomic_thread_fence" and can report false positives.
-Wtype-limits 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 "<" or ">=".  This warning is also enabled by -Wextra.
-Wabsolute-value (C and Objective-C only) Warn for calls to standard functions that compute the absolute value of an argument when a more appropriate standard function is available.  For example, calling "abs(3.14)" triggers the warning because the appropriate function to call to compute the absolute value of a double argument is "fabs".  The option also triggers warnings when the argument in a call to such a function has an unsigned type.  This warning can be suppressed with an explicit type cast and it is also enabled by -Wextra.
-Wcomment -Wcomments Warn whenever a comment-start sequence /* appears in a /* comment, or whenever a backslash-newline appears in a // comment.  This warning is enabled by -Wall.
-Wtrigraphs Warn if any trigraphs are encountered that might change the meaning of the program.  Trigraphs within comments are not warned about, except those that would form escaped newlines.
This option is implied by -Wall.  If -Wall is not given, this option is still enabled unless trigraphs are enabled.  To get trigraph conversion without warnings, but get the other -Wall warnings, use -trigraphs -Wall -Wno-trigraphs.
-Wundef Warn if an undefined identifier is evaluated in an "#if" directive. Such identifiers are replaced with zero.
-Wexpansion-to-defined Warn whenever defined is encountered in the expansion of a macro (including the case where the macro is expanded by an #if directive). Such usage is not portable.  This warning is also enabled by -Wpedantic and -Wextra.
-Wunused-macros Warn about macros defined in the main file that are unused.  A macro is used if it is expanded or tested for existence at least once.  The preprocessor also warns if the macro has not been used at the time it is redefined or undefined.
Built-in macros, macros defined on the command line, and macros defined in include files are not warned about.
Note: If a macro is actually used, but only used in skipped conditional blocks, then the preprocessor reports it as unused.  To avoid the warning in such a case, you might improve the scope of the macro's definition by, for example, moving it into the first skipped block.  Alternatively, you could provide a dummy use with something like:
#if defined the_macro_causing_the_warning #endif
-Wno-endif-labels Do not warn whenever an "#else" or an "#endif" are followed by text. This sometimes happens in older programs with code of the form
#if FOO ... #else FOO ... #endif FOO
The second and third "FOO" should be in comments.  This warning is on by default.
-Wbad-function-cast (C and Objective-C only) 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.
-Wc90-c99-compat (C and Objective-C only) Warn about features not present in ISO C90, but present in ISO C99. For instance, warn about use of variable length arrays, "long long" type, "bool" type, compound literals, designated initializers, and so on.  This option is independent of the standards mode.  Warnings are disabled in the expression that follows "__extension__".
-Wc99-c11-compat (C and Objective-C only) Warn about features not present in ISO C99, but present in ISO C11. For instance, warn about use of anonymous structures and unions, "_Atomic" type qualifier, "_Thread_local" storage-class specifier, "_Alignas" specifier, "Alignof" operator, "_Generic" keyword, and so on.  This option is independent of the standards mode.  Warnings are disabled in the expression that follows "__extension__".
-Wc11-c2x-compat (C and Objective-C only) Warn about features not present in ISO C11, but present in ISO C2X. For instance, warn about omitting the string in "_Static_assert", use of [[]] syntax for attributes, use of decimal floating-point types, and so on.  This option is independent of the standards mode. Warnings are disabled in the expression that follows "__extension__".
-Wc++-compat (C and Objective-C only) 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 "void *" to a pointer to non-"void" type.
-Wc++11-compat (C++ and Objective-C++ only) 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 -Wnarrowing and is enabled by -Wall.
-Wc++14-compat (C++ and Objective-C++ only) Warn about C++ constructs whose meaning differs between ISO C++ 2011 and ISO C++ 2014.  This warning is enabled by -Wall.
-Wc++17-compat (C++ and Objective-C++ only) Warn about C++ constructs whose meaning differs between ISO C++ 2014 and ISO C++ 2017.  This warning is enabled by -Wall.
-Wc++20-compat (C++ and Objective-C++ only) Warn about C++ constructs whose meaning differs between ISO C++ 2017 and ISO C++ 2020.  This warning is enabled by -Wall.
-Wcast-qual Warn whenever a pointer is cast so as to remove a type qualifier from the target type.  For example, warn if a "const char *" is cast to an ordinary "char *".
Also warn when making a cast that introduces a type qualifier in an unsafe way.  For example, casting "char **" to "const char **" is unsafe, as in this example:
/* 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';
-Wcast-align Warn whenever a pointer is cast such that the required alignment of the target is increased.  For example, warn if a "char *" is cast to an "int *" on machines where integers can only be accessed at two- or four-byte boundaries.
-Wcast-align=strict Warn whenever a pointer is cast such that the required alignment of the target is increased.  For example, warn if a "char *" is cast to an "int *" regardless of the target machine.
-Wcast-function-type Warn when a function pointer is cast to an incompatible function pointer.  In a cast involving function types with a variable argument list only the types of initial arguments that are provided are considered.  Any parameter of pointer-type matches any other pointer- type.  Any benign differences in integral types are ignored, like "int" vs. "long" on ILP32 targets.  Likewise type qualifiers are ignored.  The function type "void (*) (void)" is special and matches everything, which can be used to suppress this warning.  In a cast involving pointer to member types this warning warns whenever the type cast is changing the pointer to member type.  This warning is enabled by -Wextra.
-Wwrite-strings When compiling C, give string constants the type "const char[length]" so that copying the address of one into a non-"const" "char *" 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 "const" in declarations and prototypes.  Otherwise, it is just a nuisance. This is why we did not make -Wall request these warnings.
When compiling C++, warn about the deprecated conversion from string literals to "char *".  This warning is enabled by default for C++ programs.
-Wclobbered Warn for variables that might be changed by "longjmp" or "vfork". This warning is also enabled by -Wextra.
-Wconversion Warn for implicit conversions that may alter a value. This includes conversions between real and integer, like "abs (x)" when "x" is "double"; conversions between signed and unsigned, like "unsigned ui = -1"; and conversions to smaller types, like "sqrtf (M_PI)". Do not warn for explicit casts like "abs ((int) x)" and "ui = (unsigned) -1", or if the value is not changed by the conversion like in "abs (2.0)".  Warnings about conversions between signed and unsigned integers can be disabled by using -Wno-sign-conversion.
For C++, also warn for confusing overload resolution for user-defined conversions; and conversions that never use a type conversion operator: conversions to "void", 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 -Wsign-conversion is explicitly enabled.
Warnings about conversion from arithmetic on a small type back to that type are only given with -Warith-conversion.
-Wdangling-else Warn about constructions where there may be confusion to which "if" statement an "else" branch belongs.  Here is an example of such a case:
{ if (a) if (b) foo (); else bar (); }
In C/C++, every "else" branch belongs to the innermost possible "if" statement, which in this example is "if (b)".  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 "if" statement so there is no way the "else" can belong to the enclosing "if".  The resulting code looks like this:
{ if (a) { if (b) foo (); else bar (); } }
This warning is enabled by -Wparentheses.
-Wdate-time Warn when macros "__TIME__", "__DATE__" or "__TIMESTAMP__" are encountered as they might prevent bit-wise-identical reproducible compilations.
-Wempty-body Warn if an empty body occurs in an "if", "else" or "do while" statement.  This warning is also enabled by -Wextra.
-Wno-endif-labels Do not warn about stray tokens after "#else" and "#endif".
-Wenum-compare Warn about a comparison between values of different enumerated types. In C++ enumerated type mismatches in conditional expressions are also diagnosed and the warning is enabled by default.  In C this warning is enabled by -Wall.
-Wenum-conversion Warn when a value of enumerated type is implicitly converted to a different enumerated type.  This warning is enabled by -Wextra in C.
-Wjump-misses-init (C, Objective-C only) Warn if a "goto" statement or a "switch" 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.
-Wjump-misses-init is included in -Wc++-compat.  It can be disabled with the -Wno-jump-misses-init option.
-Wsign-compare Warn when a comparison between signed and unsigned values could produce an incorrect result when the signed value is converted to unsigned.  In C++, this warning is also enabled by -Wall.  In C, it is also enabled by -Wextra.
-Wsign-conversion 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 -Wconversion.
-Wfloat-conversion 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 -Wconversion.
-Wno-scalar-storage-order Do not warn on suspicious constructs involving reverse scalar storage order.
-Wsizeof-array-div Warn about divisions of two sizeof operators when the first one is applied to an array and the divisor does not equal the size of the array element.  In such a case, the computation will not yield the number of elements in the array, which is likely what the user intended.  This warning warns e.g. about
int fn () { int arr[10]; return sizeof (arr) / sizeof (short); }
-Wsizeof-pointer-div Warn for suspicious divisions of two sizeof expressions that divide the pointer size by the element size, which is the usual way to compute the array size but won't work out correctly with pointers. This warning warns e.g. about "sizeof (ptr) / sizeof (ptr[0])" if "ptr" is not an array, but a pointer.  This warning is enabled by -Wall.
-Wsizeof-pointer-memaccess Warn for suspicious length parameters to certain string and memory built-in functions if the argument uses "sizeof".  This warning triggers for example for "memset (ptr, 0, sizeof (ptr));" if "ptr" is not an array, but a pointer, and suggests a possible fix, or about "memcpy (&foo, ptr, sizeof (&foo));".  -Wsizeof-pointer-memaccess also warns about calls to bounded string copy functions like "strncat" or "strncpy" that specify as the bound a "sizeof" expression of the source array.  For example, in the following function the call to "strncat" specifies the size of the source string as the bound.  That is almost certainly a mistake and so the call is diagnosed.
void make_file (const char *name) { char path[PATH_MAX]; strncpy (path, name, sizeof path - 1); strncat (path, ".text", sizeof ".text"); ... }
The -Wsizeof-pointer-memaccess option is enabled by -Wall.
-Wno-sizeof-array-argument Do not warn when the "sizeof" 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.
-Wmemset-elt-size Warn for suspicious calls to the "memset" built-in function, if the first argument references an array, and the third argument is a number equal to the number of elements, but not equal to the size of the array in memory.  This indicates that the user has omitted a multiplication by the element size.  This warning is enabled by -Wall.
-Wmemset-transposed-args Warn for suspicious calls to the "memset" built-in function where the second argument is not zero and the third argument is zero.  For example, the call "memset (buf, sizeof buf, 0)" is diagnosed because "memset (buf, 0, sizeof buf)" was meant instead.  The diagnostic is only emitted if the third argument is a literal zero.  Otherwise, if it is an expression that is folded to zero, or a cast of zero to some type, it is far less likely that the arguments have been mistakenly transposed and no warning is emitted.  This warning is enabled by -Wall.
-Waddress Warn about suspicious uses of memory addresses. These include using the address of a function in a conditional expression, such as "void func(void); if (func)", and comparisons against the memory address of a string literal, such as "if (x == "abc")".  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 "strcmp".  This warning is enabled by -Wall.
-Wno-address-of-packed-member Do not warn when the address of packed member of struct or union is taken, which usually results in an unaligned pointer value.  This is enabled by default.
-Wlogical-op 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.  Also warns when the operands of a logical operator are the same:
extern int a; if (a < 0 && a < 0) { ... }
-Wlogical-not-parentheses Warn about logical not used on the left hand side operand of a comparison.  This option does not warn if the right operand is considered to be a boolean expression.  Its purpose is to detect suspicious code like the following:
int a; ... if (!a > 1) { ... }
It is possible to suppress the warning by wrapping the LHS into parentheses:
if ((!a) > 1) { ... }
-Waggregate-return 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.)
-Wno-aggressive-loop-optimizations 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.
-Wno-attributes Do not warn if an unexpected "__attribute__" is used, such as unrecognized attributes, function attributes applied to variables, etc.  This does not stop errors for incorrect use of supported attributes.
-Wno-builtin-declaration-mismatch Warn if a built-in function is declared with an incompatible signature or as a non-function, or when a built-in function declared with a type that does not include a prototype is called with arguments whose promoted types do not match those expected by the function.  When -Wextra is specified, also warn when a built-in function that takes arguments is declared without a prototype.  The -Wbuiltin-declaration-mismatch warning is enabled by default.  To avoid the warning include the appropriate header to bring the prototypes of built-in functions into scope.
For example, the call to "memset" below is diagnosed by the warning because the function expects a value of type "size_t" as its argument but the type of 32 is "int".  With -Wextra, the declaration of the function is diagnosed as well.
extern void* memset (); void f (void *d) { memset (d, '\0', 32); }
-Wno-builtin-macro-redefined Do not warn if certain built-in macros are redefined.  This suppresses warnings for redefinition of "__TIMESTAMP__", "__TIME__", "__DATE__", "__FILE__", and "__BASE_FILE__".
-Wstrict-prototypes (C and Objective-C only) 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.)