neulab/tldr huggingface dataset:
For C, also warn if the return type of a function has a type qualifier such as "const".  Such a type qualifier has no effect, since the value returned by a function is not an lvalue.  ISO C prohibits qualified "void" return types on function definitions, so such return types always receive a warning even without this option.
For C++, a function without return type always produces a diagnostic message, even when -Wno-return-type is specified.  The only exceptions are main and functions defined in system headers.
-Wswitch Warn whenever a "switch" statement has an index of enumerated type and lacks a "case" for one or more of the named codes of that enumeration.  (The presence of a "default" label prevents this warning.)  "case" labels outside the enumeration range also provoke warnings when this option is used.  This warning is enabled by -Wall.
-Wswitch-enum Warn whenever a "switch" statement has an index of enumerated type and lacks a "case" for one or more of the named codes of that enumeration.  "case" labels outside the enumeration range also provoke warnings when this option is used.
-Wtrigraphs 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 -Wall.
To suppress this warning use the unused attribute.
-Wunused-variable Warn whenever a local variable or non-constant static variable is unused aside from its declaration.  This warning is enabled by -Wall.
-Wunused-value Warn whenever a statement computes a result that is explicitly not used.  This warning is enabled by -Wall.
To suppress this warning cast the expression to void.
-Wuninitialized Warn if an automatic variable is used without first being initialized or if a variable may be clobbered by a "setjmp" call.
These warnings are possible only in optimizing compilation, because they require data flow information that is computed only when optimizing.  If you do not specify -O, you will not get these warnings. Instead, GCC will issue a warning about -Wuninitialized requiring -O.
If you want to warn about code which uses the uninitialized value of the variable in its own initializer, use the -Winit-self option.
These warnings occur for individual uninitialized or clobbered elements of structure, union or array variables as well as for variables which are uninitialized or clobbered as a whole.  They do not occur for variables or elements declared "volatile".  Because these warnings depend on optimization, the exact variables or elements for which there are warnings will depend on the precise optimization options and version of GCC used.
These warnings are made optional because GCC is not smart enough to see all the reasons why the code might be correct despite appearing to have an error.  Here is one example of how this can happen:
If the value of "y" is always 1, 2 or 3, then "x" is always initialized, but GCC doesn't know this.  Here is another common case:
{ int save_y; if (change_y) save_y = y, y = new_y; ... if (change_y) y = save_y; }
This has no bug because "save_y" is used only if it is set.
This option also warns when a non-volatile automatic variable might be changed by a call to "longjmp".  These warnings as well are possible only in optimizing compilation.
The compiler sees only the calls to "setjmp".  It cannot know where "longjmp" 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 "longjmp" cannot in fact be called at the place which would cause a problem.
-Wunknown-pragmas Warn when a #pragma directive is encountered which is not understood by GCC.  If this command line option is used, warnings will even be issued for unknown pragmas in system header files.  This is not the case if the warnings were only enabled by the -Wall command line option.
-Wstrict-aliasing This option is only active when -fstrict-aliasing is active.  It warns about code which 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 -Wall.
-Wstrict-aliasing=2 This option is only active when -fstrict-aliasing is active.  It warns about code which might break the strict aliasing rules that the compiler is using for optimization.  This warning catches more cases than -Wstrict-aliasing, but it will also give a warning for some ambiguous cases that are safe.
-Wstrict-overflow -Wstrict-overflow=n This option is only active when -fstrict-overflow 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.
An optimization which 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 which 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 will require, in particular when determining whether a loop will be executed at all.
-Wstrict-overflow=1 Warn about cases which are both questionable and easy to avoid. For example: "x + 1 > x"; with -fstrict-overflow, the compiler will simplify this to 1.  This level of -Wstrict-overflow is enabled by -Wall; higher levels are not, and must be explicitly requested.
-Wstrict-overflow=2 Also warn about other cases where a comparison is simplified to a constant.  For example: "abs (x) >= 0".  This can only be simplified when -fstrict-overflow is in effect, because "abs (INT_MIN)" overflows to "INT_MIN", which is less than zero. -Wstrict-overflow (with no level) is the same as -Wstrict-overflow=2.
-Wstrict-overflow=3 Also warn about other cases where a comparison is simplified. For example: "x + 1 > 1" will be simplified to "x > 0".
-Wstrict-overflow=4 Also warn about other simplifications not covered by the above cases.  For example: "(x * 10) / 5" will be 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" will be 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 will give a very large number of false positives.
-Wall All of the above -W options combined.  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 C++ Dialect Options and Objective-C and Objective-C++ Dialect Options.
-Wmost This is equivalent to -Wall -Wno-parentheses.  (APPLE ONLY)
The following -W... options are not implied by -Wall.  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.
-Wextra (This option used to be called -W.  The older name is still supported, but the newer name is more descriptive.)  Print extra warning messages for these events:
•   A function can return either with or without a value.  (Falling off the end of the function body is considered returning without a value.)  For example, this function would evoke such a warning:
foo (a) { if (a > 0) return a; }
•   An expression-statement or the left-hand side of a comma expression contains no side effects.  To suppress the warning, cast the unused expression to void.  For example, an expression such as x[i,j] will cause a warning, but x[(void)i,j] will not.
•   An unsigned value is compared against zero with < or >=.
•   Storage-class specifiers like "static" are not the first things in a declaration.  According to the C Standard, this usage is obsolescent.
•   If -Wall or -Wunused is also specified, warn about unused arguments.
•   A comparison between signed and unsigned values could produce an incorrect result when the signed value is converted to unsigned. (But don't warn if -Wno-sign-compare is also specified.)
•   An aggregate has an initializer which does not initialize all members.  This warning can be independently controlled by -Wmissing-field-initializers.
•   An initialized field without side effects is overridden when using designated initializers.  This warning can be independently controlled by -Woverride-init.
•   A function parameter is declared without a type specifier in K&R-style functions:
•   An empty body occurs in an if or else statement.
•   (C++ only) An empty body occurs in a while or for statement with no whitespacing before the semicolon. This warning can be independently controlled by -Wempty-body.
•   A pointer is compared against integer zero with <, <=, >, or >=.
•   A variable might be changed by longjmp or vfork.
•   (C++ only) An enumerator and a non-enumerator both appear in a conditional expression.
•   (C++ only) A non-static reference or non-static const member appears in a class without constructors.
•   (C++ only) Ambiguous virtual bases.
•   (C++ only) Subscripting an array which has been declared register.
•   (C++ only) Taking the address of a variable which has been declared register.
•   (C++ only) A base class is not initialized in a derived class' copy constructor.
-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 will not warn about unknown pragmas in system headers---for that, -Wunknown-pragmas must also be used.
-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 would 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.
-Wfour-char-constants Warn about four char constants, e.g. OSType 'APPL'.  This warning is disabled by default.
-Wtraditional (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 which 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 does not in ISO C.
•   In traditional C, some preprocessor directives did not exist. Traditional preprocessors would only consider 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 would ignore 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 would not recognize #elif, so it 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 would cause serious problems.  This is a subset of the possible conversion warnings, for the full set use -Wconversion.
•   Use of ISO C style function definitions.  This warning intentionally is not issued for prototype declarations or variadic functions because these ISO C features will 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.
-Wdeclaration-after-statement (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 and was not supported by GCC versions before GCC 3.0.
-Wno-discard-qual This flag allows user to suppress warning that is issued when qualification is discarded in situations like, initialization, assignment and argument passing.
-Wundef Warn if an undefined identifier is evaluated in an #if directive.
-Wno-endif-labels Do not warn whenever an #else or an #endif are followed by text.
-Wshadow Warn whenever a local variable shadows another local variable, parameter or global variable or whenever a built-in function is shadowed.
-Wlarger-than-len Warn whenever an object of larger than len bytes is defined.
-Wunsafe-loop-optimizations Warn if the loop cannot be optimized because the compiler could not assume anything on the bounds of the loop indices.  With -funsafe-loop-optimizations warn if the compiler made such assumptions.
-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.
-Wbad-function-cast (C only) Warn whenever a function call is cast to a non-matching type.  For example, warn if "int malloc()" is cast to "anything *".
-Wc++-compat 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.
-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 will get a warning; when compiling C++, warn about the deprecated conversion from string literals to "char *".  This warning, by default, is enabled for C++ programs.  These warnings will 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 will just be a nuisance; this is why we did not make -Wall request these warnings.
-Wconversion 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.
Also, warn if a negative integer constant expression is implicitly converted to an unsigned type.  For example, warn about the assignment "x = -1" if "x" is unsigned.  But do not warn about explicit casts like "(unsigned) -1".
-Wshorten-64-to-32 Warn if a value is implicitly converted from a 64 bit type to a 32 bit type.
-Wempty-body Warn if an empty body occurs in an if or else statement. Additionally, in C++, warn when an empty body occurs in a while or for statement with no whitespacing before the semicolon.  This warning is also enabled by -Wextra.
-Wsign-compare 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 -Wextra; to get the other warnings of -Wextra without this warning, use -Wextra -Wno-sign-compare.
-Wno-attributes Do not warn if an unexpected "__attribute__" is used, such as unrecognized attributes, function attributes applied to variables, etc.  This will not stop errors for incorrect use of supported attributes.
-Wstrict-prototypes (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 which specifies the argument types.)
-Wold-style-definition (C only) Warn if an old-style function definition is used.  A warning is given even if there is a previous prototype.
-Wmissing-prototypes Warn if a global function is defined without a previous prototype declaration.  This warning is issued even if the definition itself provides a prototype.  The aim is to detect global functions that fail to be declared in header files.
-Wmissing-declarations (C only) 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.
-Wmissing-field-initializers Warn if a structure's initializer has some fields missing.  For example, the following code would cause such a warning, because "x.h" is implicitly zero:
This option does not warn about designated initializers, so the following modification would not trigger a warning:
-Wmissing-noreturn Warn about functions which might be candidates for attribute "noreturn".  Note these are only possible candidates, not absolute ones.  Care should be taken to manually verify functions actually do not ever return before adding the "noreturn" attribute, otherwise subtle code generation bugs could be introduced.  You will not get a warning for "main" in hosted C environments.
-Wmissing-format-attribute Warn about function pointers which might be candidates for "format" attributes.  Note these are only possible candidates, not absolute ones.  GCC will guess 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 will also warn about function definitions which might be candidates for "format" attributes.  Again, these are only possible candidates.  GCC will guess 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.
-Wno-multichar Do not warn if a multicharacter constant ('FOO') 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.  This flag does not control warning for a constant with four characters, use -Wfour-char-constants instead.
-Wnormalized=<none|id|nfc|nfkc> 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 normalization rules 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 which have not been normalized; this option controls that warning.
There are four levels of warning that GCC supports.  The default is -Wnormalized=nfc, which warns about any identifier which is not in the ISO 10646 "C" normalized form, NFC.  NFC is the recommended form for most uses.
Unfortunately, there are some characters which ISO C and ISO C++ allow in identifiers that when turned into NFC aren't allowable as identifiers.  That is, there's no way to use these symbols in portable ISO C or C++ and have all your identifiers in NFC. -Wnormalized=id 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.
You can switch the warning off for all characters by writing -Wnormalized=none.  You would only want to do this if you were using some other normalization scheme (like "D"), because otherwise you can easily create bugs that are literally impossible to see.
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 "\u207F", "SUPERSCRIPT LATIN SMALL LETTER N", will display just like a regular "n" which has been placed in a superscript.  ISO 10646 defines the NFKC normalization scheme to convert all these into a standard form as well, and GCC will warn if your code is not in NFKC if you use -Wnormalized=nfkc.  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 is unable to be fixed to display these characters distinctly.
-Woverride-init Warn if an initialized field without side effects is overridden when using designated initializers.
-Wpacked 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 "f.x" in "struct bar" will be misaligned even though "struct bar" does not itself have the packed attribute:
-Wnested-externs (C only) Warn if an "extern" declaration is encountered within a function.
-Wunreachable-code Warn if the compiler detects that code will never be executed.
This option is intended to warn when the compiler detects that at least a whole line of source code will never be executed, because some condition is never satisfied or because it is after a procedure that never returns.
It is possible for this option to produce a warning even though there are circumstances under which part of the affected line can be executed, so care should be taken when removing apparently- unreachable code.
For instance, when a function is inlined, a warning may mean that the line is unreachable in only one inlined copy of the function.
This option is not made part of -Wall because in a debugging version of a program there is often substantial code which checks correct functioning of the program and is, hopefully, unreachable because the program does work.  Another common use of unreachable code is to provide behavior which is selectable at compile-time.
-Winline Warn if a function can not be inlined and it was declared as inline. Even with this option, the compiler will not warn about failures to inline functions declared in system headers.
-Wno-invalid-offsetof (C++ only) Suppress warnings from applying the offsetof macro to a non-POD type. According to the 1998 ISO C++ standard, applying offsetof to a non- POD type is undefined.  In existing C++ implementations, however, offsetof typically gives meaningful results even when applied to certain kinds of non-POD types. (Such as a simple struct that fails to be a POD type only by virtue of having a constructor.)  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.
The restrictions on offsetof may be relaxed in a future version of the C++ standard.
-Wno-int-to-pointer-cast (C only) Suppress warnings from casts to pointer type of an integer of a different size.
-Wno-pointer-to-int-cast (C only) Suppress warnings from casts from a pointer to an integer type of a different size.
-Winvalid-pch Warn if a precompiled header is found in the search path but can't be used.
-Wlong-long Warn if long long type is used.  This is default.  To inhibit the warning messages, use -Wno-long-long.  Flags -Wlong-long and -Wno-long-long are taken into account only when -pedantic flag is used.
-Wvariadic-macros Warn if variadic macros are used in pedantic ISO C90 mode, or the GNU alternate syntax when in pedantic ISO C99 mode.  This is default.  To inhibit the warning messages, use -Wno-variadic-macros.
-Wvolatile-register-var 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.
-Wdisabled-optimization 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 were unable to handle the code effectively.  Often, the problem is that your code is too big or too complex; GCC will refuse to optimize programs when the optimization itself is likely to take inordinate amounts of time.
-Wpointer-sign Warn for pointer argument passing or assignment with different signedness.  This option is only supported for C and Objective-C.  It is implied by -Wall and by -pedantic, which can be disabled with -Wno-pointer-sign.
-Werror= Make the specified warning into an errors.  The specifier for a warning is appended, for example -Werror=switch turns the warnings controlled by -Wswitch into errors.  This switch takes a negative form, to be used to negate -Werror for specific warnings, for example -Wno-error=switch makes -Wswitch warnings not be errors, even when -Werror is in effect.  You can use the -fdiagnostics-show-option option to have each controllable warning amended with the option which controls it, to determine what to use with this option.
-Wstack-protector This option is only active when -fstack-protector is active.  It warns about functions that will not be protected against stack smashing.
-Woverlength-strings Warn about string constants which are longer than the "minimum maximum" length specified in the C standard.  Modern compilers generally allow string constants which are much longer than the standard's minimum limit, but very portable programs should avoid using longer strings.
The limit applies after string constant concatenation, and does not count the trailing NUL.  In C89, 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++.
This option is implied by -pedantic, and can be disabled with -Wno-overlength-strings.
Options for Debugging Your Program or GCC GCC has various special options that are used for debugging either your program or GCC:
-g  Produce debugging information in the operating system's native format (stabs, COFF, XCOFF, or DWARF 2).  GDB can work with this debugging information.
On most systems that use stabs format, -g enables use of extra debugging information that only GDB can use; this extra information makes debugging work better in GDB but will probably make other debuggers crash or refuse to read the program.  If you want to control for certain whether to generate the extra information, use -gstabs+ or -gstabs (see below).
GCC allows you to use -g with -O.  The shortcuts taken by optimized code may occasionally produce surprising results: some variables you declared may not exist at all; flow of control may briefly move where you did not expect it; some statements may not be executed because they compute constant results or their values were already at hand; some statements may execute in different places because they were moved out of loops.
Nevertheless it proves possible to debug optimized output.  This makes it reasonable to use the optimizer for programs that might have bugs.
The following options are useful when GCC is generated with the capability for more than one debugging format.
-ggdb Produce debugging information for use by GDB.  This means to use the most expressive format available (DWARF 2, stabs, or the native format if neither of those are supported), including GDB extensions if at all possible.
-gstabs Produce debugging information in stabs format (if that is supported), without GDB extensions.  This is the format used by DBX on most BSD systems.  On MIPS, Alpha and System V Release 4 systems this option produces stabs debugging output which is not understood by DBX or SDB.  On System V Release 4 systems this option requires the GNU assembler.
-flimit-debug-info Limit debug information produced to reduce size of debug binary.
-feliminate-unused-debug-symbols Produce debugging information in stabs format (if that is supported), for only symbols that are actually used.
-femit-class-debug-always Instead of emitting debugging information for a C++ class in only one object file, emit it in all object files using the class.  This option should be used only with debuggers that are unable to handle the way GCC normally emits debugging information for classes because using this option will increase the size of debugging information by as much as a factor of two.
-gdwarf-2 Produce debugging information in DWARF version 2 format (if that is supported).  This is the format used by DBX on IRIX 6.  With this option, GCC uses features of DWARF version 3 when they are useful; version 3 is upward compatible with version 2, but may still cause problems for older debuggers.
(Other debug formats, such as -gcoff, are not supported in Darwin or Mac OS X.)
-glevel -ggdblevel -gstabslevel Request debugging information and also use level to specify how much information.  The default level is 2.
Level 1 produces minimal information, enough for making backtraces in parts of the program that you don't plan to debug.  This includes descriptions of functions and external variables, but no information about local variables and no line numbers.
-gdwarf-2 does not accept a concatenated debug level, because GCC used to support an option -gdwarf that meant to generate debug information in version 1 of the DWARF format (which is very different from version 2), and it would have been too confusing.  That debug format is long obsolete, but the option cannot be changed now. Instead use an additional -glevel option to change the debug level for DWARF2.
-feliminate-dwarf2-dups Compress DWARF2 debugging information by eliminating duplicated information about each symbol.  This option only makes sense when generating DWARF2 debugging information with -gdwarf-2.
-p  Generate extra code to write profile information suitable for the analysis program prof.  You must use this option when compiling the source files you want data about, and you must also use it when linking.
-pg Generate extra code to write profile information suitable for the analysis program gprof.  You must use this option when compiling the source files you want data about, and you must also use it when linking.
-fopt-diary Enable optimization diary entries using DWARF encoding. This option does nothing unless gdwarf-2 is specified.
-fprofile-arcs Add code so that program flow arcs are instrumented.  During execution the program records how many times each branch and call is executed and how many times it is taken or returns.  When the compiled program exits it saves this data to a file called auxname.gcda for each source file.  The data may be used for profile- directed optimizations (-fbranch-probabilities), or for test coverage analysis (-ftest-coverage).  Each object file's auxname is generated from the name of the output file, if explicitly specified and it is not the final executable, otherwise it is the basename of the source file.  In both cases any suffix is removed (e.g. foo.gcda for input file dir/foo.c, or dir/foo.gcda for output file specified as -o dir/foo.o).
•   Compile the source files with -fprofile-arcs plus optimization and code generation options.  For test coverage analysis, use the additional -ftest-coverage option.  You do not need to profile every source file in a program.
•   Link your object files with -lgcov or -fprofile-arcs (the latter implies the former).
•   Run the program on a representative workload to generate the arc profile information.  This may be repeated any number of times. You can run concurrent instances of your program, and provided that the file system supports locking, the data files will be correctly updated.  Also "fork" calls are detected and correctly handled (double counting will not happen).
•   For profile-directed optimizations, compile the source files again with the same optimization and code generation options plus -fbranch-probabilities.
•   For test coverage analysis, use gcov to produce human readable information from the .gcno and .gcda files.  Refer to the gcov documentation for further information.
-ftest-coverage Produce a notes file that the gcov code-coverage utility can use to show program coverage.  Each source file's note file is called auxname.gcno.  Refer to the -fprofile-arcs option above for a description of auxname and instructions on how to generate test coverage data.  Coverage data will match the source files more closely, if you do not optimize.
-dletters -fdump-rtl-pass Says to make debugging dumps during compilation at times specified by letters.    This is used for debugging the RTL-based passes of the compiler.  The file names for most of the dumps are made by appending a pass number and a word to the dumpname.  dumpname is generated from the name of the output file, if explicitly specified and it is not an executable, otherwise it is the basename of the source file. These switches may have different effects when -E is used for preprocessing.
Most debug dumps can be enabled either passing a letter to the -d option, or with a long -fdump-rtl switch; here are the possible letters for use in letters and pass, and their meanings:
-dB -fdump-rtl-bbro Dump after block reordering, to file.148r.bbro.
-dc -fdump-rtl-combine Dump after instruction combination, to the file file.129r.combine.
-dC -fdump-rtl-ce1 -fdump-rtl-ce2 -dC and -fdump-rtl-ce1 enable dumping after the first if conversion, to the file file.117r.ce1.  -dC and -fdump-rtl-ce2 enable dumping after the second if conversion, to the file file.130r.ce2.
-dd -fdump-rtl-btl -fdump-rtl-dbr -dd and -fdump-rtl-btl enable dumping after branch target load optimization, to file.31.btl.  -dd and -fdump-rtl-dbr enable dumping after delayed branch scheduling, to file.36.dbr.
-dE -fdump-rtl-ce3 Dump after the third if conversion, to file.146r.ce3.
-df -fdump-rtl-cfg -fdump-rtl-life -df and -fdump-rtl-cfg enable dumping after control and data flow analysis, to file.116r.cfg.  -df and -fdump-rtl-cfg enable dumping dump after life analysis, to file.128r.life1 and file.135r.life2.
-dg -fdump-rtl-greg Dump after global register allocation, to file.139r.greg.
-dG -fdump-rtl-gcse -fdump-rtl-bypass -dG and -fdump-rtl-gcse enable dumping after GCSE, to file.114r.gcse.  -dG and -fdump-rtl-bypass enable dumping after jump bypassing and control flow optimizations, to file.115r.bypass.
-dh -fdump-rtl-eh Dump after finalization of EH handling code, to file.02.eh.
-di -fdump-rtl-sibling Dump after sibling call optimizations, to file.106r.sibling.
-dj -fdump-rtl-jump Dump after the first jump optimization, to file.112r.jump.
-dk -fdump-rtl-stack Dump after conversion from registers to stack, to file.152r.stack.
-dl -fdump-rtl-lreg Dump after local register allocation, to file.138r.lreg.
-dL -fdump-rtl-loop2 -dL and -fdump-rtl-loop2 enable dumping after the loop optimization pass, to file.119r.loop2, file.120r.loop2_init, file.121r.loop2_invariant, and file.125r.loop2_done.
-dm -fdump-rtl-sms Dump after modulo scheduling, to file.136r.sms.
-dM -fdump-rtl-mach Dump after performing the machine dependent reorganization pass, to file.155r.mach if that pass exists.
-dn -fdump-rtl-rnreg Dump after register renumbering, to file.147r.rnreg.
-dN -fdump-rtl-regmove Dump after the register move pass, to file.132r.regmove.
-do -fdump-rtl-postreload Dump after post-reload optimizations, to file.24.postreload.
-dr -fdump-rtl-expand Dump after RTL generation, to file.104r.expand.
-dR -fdump-rtl-sched2 Dump after the second scheduling pass, to file.150r.sched2.
-ds -fdump-rtl-cse Dump after CSE (including the jump optimization that sometimes follows CSE), to file.113r.cse.
-dS -fdump-rtl-sched Dump after the first scheduling pass, to file.21.sched.
-dt -fdump-rtl-cse2 Dump after the second CSE pass (including the jump optimization that sometimes follows CSE), to file.127r.cse2.
-dT -fdump-rtl-tracer Dump after running tracer, to file.118r.tracer.
-dV -fdump-rtl-vpt -fdump-rtl-vartrack -dV and -fdump-rtl-vpt enable dumping after the value profile transformations, to file.10.vpt.  -dV and -fdump-rtl-vartrack enable dumping after variable tracking, to file.154r.vartrack.
-dw -fdump-rtl-flow2 Dump after the second flow pass, to file.142r.flow2.
-dz -fdump-rtl-peephole2 Dump after the peephole pass, to file.145r.peephole2.
-dZ -fdump-rtl-web Dump after live range splitting, to file.126r.web.
-dm Print statistics on memory usage, at the end of the run, to standard error.
-dp Annotate the assembler output with a comment indicating which pattern and alternative was used.  The length of each instruction is also printed.
-dv For each of the other indicated dump files (either with -d or -fdump-rtl-pass), dump a representation of the control flow graph suitable for viewing with VCG to file.pass.vcg.
-dx Just generate RTL for a function instead of compiling it. Usually used with r (-fdump-rtl-expand).
-dy Dump debugging information during parsing, to standard error.
-fdump-noaddr When doing debugging dumps (see -d option above), suppress address output.  This makes it more feasible to use diff on debugging dumps for compiler invocations with different compiler binaries and/or different text / bss / data / heap / stack / dso start locations.
-fdump-unnumbered When doing debugging dumps (see -d option above), suppress instruction numbers, line number note and address output.  This makes it more feasible to use diff on debugging dumps for compiler invocations with different options, in particular with and without -g.
-fdump-translation-unit (C++ only) -fdump-translation-unit-options (C++ only) Dump a representation of the tree structure for the entire translation unit to a file.  The file name is made by appending .tu to the source file name.  If the -options form is used, options controls the details of the dump as described for the -fdump-tree options.
-fdump-class-hierarchy (C++ only) -fdump-class-hierarchy-options (C++ only) Dump a representation of each class's hierarchy and virtual function table layout to a file.  The file name is made by appending .class to the source file name.  If the -options form is used, options controls the details of the dump as described for the -fdump-tree options.
-fdump-ipa-switch Control the dumping at various stages of inter-procedural analysis language tree to a file.  The file name is generated by appending a switch specific suffix to the source file name.  The following dumps are possible:
all Enables all inter-procedural analysis dumps; currently the only produced dump is the cgraph dump.
-fdump-tree-switch -fdump-tree-switch-options Control the dumping at various stages of processing the intermediate language tree to a file.  The file name is generated by appending a switch specific suffix to the source file name.  If the -options form is used, options is a list of - separated options that control the details of the dump.  Not all options are applicable to all dumps, those which are not meaningful will be ignored.  The following options are available
slim Inhibit dumping of members of a scope or body of a function merely because that scope has been reached.  Only dump such items when they are directly reachable by some other path.  When dumping pretty-printed trees, this option inhibits dumping the bodies of control structures.
details Enable more detailed dumps (not honored by every dump option).
all Turn on all options, except raw, slim and lineno.
The following tree dumps are possible:
original Dump before any tree based optimization, to file.original.
optimized Dump after all tree based optimization, to file.optimized.
inlined Dump after function inlining, to file.inlined.
gimple Dump each function before and after the gimplification pass to a file.  The file name is made by appending .gimple to the source file name.
cfg Dump the control flow graph of each function to a file.  The file name is made by appending .cfg to the source file name.
vcg Dump the control flow graph of each function to a file in VCG format.  The file name is made by appending .vcg to the source file name.  Note that if the file contains more than one function, the generated file cannot be used directly by VCG.  You will need to cut and paste each function's graph into its own separate file first.
ch  Dump each function after copying loop headers.  The file name is made by appending .ch to the source file name.
ssa Dump SSA related information to a file.  The file name is made by appending .ssa to the source file name.
salias Dump structure aliasing variable information to a file.  This file name is made by appending .salias to the source file name.
alias Dump aliasing information for each function.  The file name is made by appending .alias to the source file name.
ccp Dump each function after CCP.  The file name is made by appending .ccp to the source file name.
storeccp Dump each function after STORE-CCP.  The file name is made by appending .storeccp to the source file name.
pre Dump trees after partial redundancy elimination.  The file name is made by appending .pre to the source file name.
fre Dump trees after full redundancy elimination.  The file name is made by appending .fre to the source file name.
copyprop Dump trees after copy propagation.  The file name is made by appending .copyprop to the source file name.
store_copyprop Dump trees after store copy-propagation.  The file name is made by appending .store_copyprop to the source file name.
dce Dump each function after dead code elimination.  The file name is made by appending .dce to the source file name.
mudflap Dump each function after adding mudflap instrumentation.  The file name is made by appending .mudflap to the source file name.
sra Dump each function after performing scalar replacement of aggregates.  The file name is made by appending .sra to the source file name.
sink Dump each function after performing code sinking.  The file name is made by appending .sink to the source file name.
dom Dump each function after applying dominator tree optimizations. The file name is made by appending .dom to the source file name.
dse Dump each function after applying dead store elimination.  The file name is made by appending .dse to the source file name.
phiopt Dump each function after optimizing PHI nodes into straightline code.  The file name is made by appending .phiopt to the source file name.
forwprop Dump each function after forward propagating single use variables.  The file name is made by appending .forwprop to the source file name.
copyrename Dump each function after applying the copy rename optimization. The file name is made by appending .copyrename to the source file name.
nrv Dump each function after applying the named return value optimization on generic trees.  The file name is made by appending .nrv to the source file name.
vect Dump each function after applying vectorization of loops.  The file name is made by appending .vect to the source file name.
vrp Dump each function after Value Range Propagation (VRP).  The file name is made by appending .vrp to the source file name.
all Enable all the available tree dumps with the flags provided in this option.
-ftree-vectorizer-verbose=n This option controls the amount of debugging output the vectorizer prints.  This information is written to standard error, unless -fdump-tree-all or -fdump-tree-vect is specified, in which case it is output to the usual dump listing file, .vect.  For n=0 no diagnostic information is reported.  If n=1 the vectorizer reports each loop that got vectorized, and the total number of loops that got vectorized.  If n=2 the vectorizer also reports non-vectorized loops that passed the first analysis phase (vect_analyze_loop_form) - i.e. countable, inner-most, single-bb, single-entry/exit loops.  This is the same verbosity level that -fdump-tree-vect-stats uses.  Higher verbosity levels mean either more information dumped for each reported loop, or same amount of information reported for more loops: If n=3, alignment related information is added to the reports.  If n=4, data-references related information (e.g. memory dependences, memory access-patterns) is added to the reports.  If n=5, the vectorizer reports also non-vectorized inner-most loops that did not pass the first analysis phase (i.e. may not be countable, or may have complicated control-flow).  If n=6, the vectorizer reports also non- vectorized nested loops.  For n=7, all the information the vectorizer generates during its analysis and transformation is reported.  This is the same verbosity level that -fdump-tree-vect-details uses.
-frandom-seed=string This option provides a seed that GCC uses when it would otherwise use random numbers.  It is used to generate certain symbol names that have to be different in every compiled file.  It is also used to place unique stamps in coverage data files and the object files that produce them.  You can use the -frandom-seed option to produce reproducibly identical object files.
-fsched-verbose=n On targets that use instruction scheduling, this option controls the amount of debugging output the scheduler prints.  This information is written to standard error, unless -dS or -dR is specified, in which case it is output to the usual dump listing file, .sched or .sched2 respectively.  However for n greater than nine, the output is always printed to standard error.
For n greater than zero, -fsched-verbose outputs the same information as -dRS.  For n greater than one, it also output basic block probabilities, detailed ready list information and unit/insn info. For n greater than two, it includes RTL at abort point, control-flow and regions info.  And for n over four, -fsched-verbose also includes dependence info.
-save-temps Store the usual "temporary" intermediate files permanently; place them in the current directory and name them based on the source file. Thus, compiling foo.c with -c -save-temps would produce files foo.i and foo.s, as well as foo.o.  This creates a preprocessed foo.i output file even though the compiler now normally uses an integrated preprocessor.