前言:
目前你们对“rt3290驱动ubuntu”大体比较关怀,你们都需要分析一些“rt3290驱动ubuntu”的相关文章。那么小编同时在网络上网罗了一些有关“rt3290驱动ubuntu””的相关资讯,希望大家能喜欢,朋友们一起来了解一下吧!GCC是每个从事Linux,以及嵌入式开发等必备的编译器,由于帮助手册较多,这里使用了分页的形式进行分享,如下为Ubuntu Server 22.04操作系统平台和GCC编译器的基本信息。
GCC帮助手册的第12小节,3288行~5288行最后全部的帮助信息,如下。
3288 This warning is enabled by -Wall.3289 -Wunused-label3290 Warn whenever a label is declared but not used. This warning is enabled by -Wall.3291 To suppress this warning use the "unused" attribute.3292 -Wunused-local-typedefs (C, Objective-C, C++ and Objective-C++ only)3293 Warn when a typedef locally defined in a function is not used. This warning is enabled by -Wall.3294 -Wunused-parameter3295 Warn whenever a function parameter is unused aside from its declaration.3296 To suppress this warning use the "unused" attribute.3297 -Wno-unused-result3298 Do not warn if a caller of a function marked with attribute "warn_unused_result" does not use its return3299 value. The default is -Wunused-result.3300 -Wunused-variable3301 Warn whenever a local or static variable is unused aside from its declaration. This option implies3302 -Wunused-const-variable=1 for C, but not for C++. This warning is enabled by -Wall.3303 To suppress this warning use the "unused" attribute.3304 -Wunused-const-variable3305 -Wunused-const-variable=n3306 Warn whenever a constant static variable is unused aside from its declaration. -Wunused-const-variable=13307 is enabled by -Wunused-variable for C, but not for C++. In C this declares variable storage, but in C++3308 this is not an error since const variables take the place of "#define"s.3309 To suppress this warning use the "unused" attribute.3310 -Wunused-const-variable=13311 This is the warning level that is enabled by -Wunused-variable for C. It warns only about unused3312 static const variables defined in the main compilation unit, but not about static const variables3313 declared in any header included.3314 -Wunused-const-variable=23315 This warning level also warns for unused constant static variables in headers (excluding system3316 headers). This is the warning level of -Wunused-const-variable and must be explicitly requested since3317 in C++ this isn't an error and in C it might be harder to clean up all headers included.3318 -Wunused-value3319 Warn whenever a statement computes a result that is explicitly not used. To suppress this warning cast the3320 unused expression to "void". This includes an expression-statement or the left-hand side of a comma3321 expression that contains no side effects. For example, an expression such as "x[i,j]" causes a warning,3322 while "x[(void)i,j]" does not.3323 This warning is enabled by -Wall.3324 -Wunused3325 All the above -Wunused options combined.3326 In order to get a warning about an unused function parameter, you must either specify -Wextra -Wunused3327 (note that -Wall implies -Wunused), or separately specify -Wunused-parameter.3328 -Wuninitialized3329 Warn if an object with automatic or allocated storage duration is used without having been initialized. In3330 C++, also warn if a non-static reference or non-static "const" member appears in a class without3331 constructors.3332 In addition, passing a pointer (or in C++, a reference) to an uninitialized object to a "const"-qualified3333 argument of a built-in function known to read the object is also diagnosed by this warning.3334 (-Wmaybe-uninitialized is issued for ordinary functions.)3335 If you want to warn about code that uses the uninitialized value of the variable in its own initializer,3336 use the -Winit-self option.3337 These warnings occur for individual uninitialized elements of structure, union or array variables as well3338 as for variables that are uninitialized as a whole. They do not occur for variables or elements declared3339 "volatile". Because these warnings depend on optimization, the exact variables or elements for which there3340 are warnings depend on the precise optimization options and version of GCC used.3341 Note that there may be no warning about a variable that is used only to compute a value that itself is3342 never used, because such computations may be deleted by data flow analysis before the warnings are printed.3343 -Wno-invalid-memory-model3344 This option controls warnings for invocations of __atomic Builtins, __sync Builtins, and the C11 atomic3345 generic functions with a memory consistency argument that is either invalid for the operation or outside3346 the range of values of the "memory_order" enumeration. For example, since the "__atomic_store" and3347 "__atomic_store_n" built-ins are only defined for the relaxed, release, and sequentially consistent memory3348 orders the following code is diagnosed:3349 void store (int *i)3350 {3351 __atomic_store_n (i, 0, memory_order_consume);3352 }3353 -Winvalid-memory-model is enabled by default.3354 -Wmaybe-uninitialized3355 For an object with automatic or allocated storage duration, if there exists a path from the function entry3356 to a use of the object that is initialized, but there exist some other paths for which the object is not3357 initialized, the compiler emits a warning if it cannot prove the uninitialized paths are not executed at3358 run time.3359 In addition, passing a pointer (or in C++, a reference) to an uninitialized object to a "const"-qualified3360 function argument is also diagnosed by this warning. (-Wuninitialized is issued for built-in functions3361 known to read the object.) Annotating the function with attribute "access (none)" indicates that the3362 argument isn't used to access the object and avoids the warning.3363 These warnings are only possible in optimizing compilation, because otherwise GCC does not keep track of3364 the state of variables.3365 These warnings are made optional because GCC may not be able to determine when the code is correct in spite3366 of appearing to have an error. Here is one example of how this can happen:3367 {3368 int x;3369 switch (y)3370 {3371 case 1: x = 1;3372 break;3373 case 2: x = 4;3374 break;3375 case 3: x = 5;3376 }3377 foo (x);3378 }3379 If the value of "y" is always 1, 2 or 3, then "x" is always initialized, but GCC doesn't know this. To3380 suppress the warning, you need to provide a default case with assert(0) or similar code.3381 This option also warns when a non-volatile automatic variable might be changed by a call to "longjmp". The3382 compiler sees only the calls to "setjmp". It cannot know where "longjmp" will be called; in fact, a signal3383 handler could call it at any point in the code. As a result, you may get a warning even when there is in3384 fact no problem because "longjmp" cannot in fact be called at the place that would cause a problem.3385 Some spurious warnings can be avoided if you declare all the functions you use that never return as3386 "noreturn".3387 This warning is enabled by -Wall or -Wextra.3388 -Wunknown-pragmas3389 Warn when a "#pragma" directive is encountered that is not understood by GCC. If this command-line option3390 is used, warnings are even issued for unknown pragmas in system header files. This is not the case if the3391 warnings are only enabled by the -Wall command-line option.3392 -Wno-pragmas3393 Do not warn about misuses of pragmas, such as incorrect parameters, invalid syntax, or conflicts between3394 pragmas. See also -Wunknown-pragmas.3395 -Wno-prio-ctor-dtor3396 Do not warn if a priority from 0 to 100 is used for constructor or destructor. The use of constructor and3397 destructor attributes allow you to assign a priority to the constructor/destructor to control its order of3398 execution before "main" is called or after it returns. The priority values must be greater than 100 as the3399 compiler reserves priority values between 0--100 for the implementation.3400 -Wstrict-aliasing3401 This option is only active when -fstrict-aliasing is active. It warns about code that might break the3402 strict aliasing rules that the compiler is using for optimization. The warning does not catch all cases,3403 but does attempt to catch the more common pitfalls. It is included in -Wall. It is equivalent to3404 -Wstrict-aliasing=33405 -Wstrict-aliasing=n3406 This option is only active when -fstrict-aliasing is active. It warns about code that might break the3407 strict aliasing rules that the compiler is using for optimization. Higher levels correspond to higher3408 accuracy (fewer false positives). Higher levels also correspond to more effort, similar to the way -O3409 works. -Wstrict-aliasing is equivalent to -Wstrict-aliasing=3.3410 Level 1: Most aggressive, quick, least accurate. Possibly useful when higher levels do not warn but3411 -fstrict-aliasing still breaks the code, as it has very few false negatives. However, it has many false3412 positives. Warns for all pointer conversions between possibly incompatible types, even if never3413 dereferenced. Runs in the front end only.3414 Level 2: Aggressive, quick, not too precise. May still have many false positives (not as many as level 13415 though), and few false negatives (but possibly more than level 1). Unlike level 1, it only warns when an3416 address is taken. Warns about incomplete types. Runs in the front end only.3417 Level 3 (default for -Wstrict-aliasing): Should have very few false positives and few false negatives.3418 Slightly slower than levels 1 or 2 when optimization is enabled. Takes care of the common pun+dereference3419 pattern in the front end: "*(int*)&some_float". If optimization is enabled, it also runs in the back end,3420 where it deals with multiple statement cases using flow-sensitive points-to information. Only warns when3421 the converted pointer is dereferenced. Does not warn about incomplete types.3422 -Wstrict-overflow3423 -Wstrict-overflow=n3424 This option is only active when signed overflow is undefined. It warns about cases where the compiler3425 optimizes based on the assumption that signed overflow does not occur. Note that it does not warn about3426 all cases where the code might overflow: it only warns about cases where the compiler implements some3427 optimization. Thus this warning depends on the optimization level.3428 An optimization that assumes that signed overflow does not occur is perfectly safe if the values of the3429 variables involved are such that overflow never does, in fact, occur. Therefore this warning can easily3430 give a false positive: a warning about code that is not actually a problem. To help focus on important3431 issues, several warning levels are defined. No warnings are issued for the use of undefined signed3432 overflow when estimating how many iterations a loop requires, in particular when determining whether a loop3433 will be executed at all.3434 -Wstrict-overflow=13435 Warn about cases that are both questionable and easy to avoid. For example the compiler simplifies "x3436 + 1 > x" to 1. This level of -Wstrict-overflow is enabled by -Wall; higher levels are not, and must be3437 explicitly requested.3438 -Wstrict-overflow=23439 Also warn about other cases where a comparison is simplified to a constant. For example: "abs (x) >=3440 0". This can only be simplified when signed integer overflow is undefined, because "abs (INT_MIN)"3441 overflows to "INT_MIN", which is less than zero. -Wstrict-overflow (with no level) is the same as3442 -Wstrict-overflow=2.3443 -Wstrict-overflow=33444 Also warn about other cases where a comparison is simplified. For example: "x + 1 > 1" is simplified3445 to "x > 0".3446 -Wstrict-overflow=43447 Also warn about other simplifications not covered by the above cases. For example: "(x * 10) / 5" is3448 simplified to "x * 2".3449 -Wstrict-overflow=53450 Also warn about cases where the compiler reduces the magnitude of a constant involved in a comparison.3451 For example: "x + 2 > y" is simplified to "x + 1 >= y". This is reported only at the highest warning3452 level because this simplification applies to many comparisons, so this warning level gives a very large3453 number of false positives.3454 -Wstring-compare3455 Warn for calls to "strcmp" and "strncmp" whose result is determined to be either zero or non-zero in tests3456 for such equality owing to the length of one argument being greater than the size of the array the other3457 argument is stored in (or the bound in the case of "strncmp"). Such calls could be mistakes. For example,3458 the call to "strcmp" below is diagnosed because its result is necessarily non-zero irrespective of the3459 contents of the array "a".3460 extern char a[4];3461 void f (char *d)3462 {3463 strcpy (d, "string");3464 ...3465 if (0 == strcmp (a, d)) // cannot be true3466 puts ("a and d are the same");3467 }3468 -Wstring-compare is enabled by -Wextra.3469 -Wno-stringop-overflow3470 -Wstringop-overflow3471 -Wstringop-overflow=type3472 Warn for calls to string manipulation functions such as "memcpy" and "strcpy" that are determined to3473 overflow the destination buffer. The optional argument is one greater than the type of Object Size3474 Checking to perform to determine the size of the destination. The argument is meaningful only for3475 functions that operate on character arrays but not for raw memory functions like "memcpy" which always make3476 use of Object Size type-0. The option also warns for calls that specify a size in excess of the largest3477 possible object or at most "SIZE_MAX / 2" bytes. The option produces the best results with optimization3478 enabled but can detect a small subset of simple buffer overflows even without optimization in calls to the3479 GCC built-in functions like "__builtin_memcpy" that correspond to the standard functions. In any case, the3480 option warns about just a subset of buffer overflows detected by the corresponding overflow checking built-3481 ins. For example, the option issues a warning for the "strcpy" call below because it copies at least 53482 characters (the string "blue" including the terminating NUL) into the buffer of size 4.3483 enum Color { blue, purple, yellow };3484 const char* f (enum Color clr)3485 {3486 static char buf [4];3487 const char *str;3488 switch (clr)3489 {3490 case blue: str = "blue"; break;3491 case purple: str = "purple"; break;3492 case yellow: str = "yellow"; break;3493 }3494 return strcpy (buf, str); // warning here3495 }3496 Option -Wstringop-overflow=2 is enabled by default.3497 -Wstringop-overflow3498 -Wstringop-overflow=13499 The -Wstringop-overflow=1 option uses type-zero Object Size Checking to determine the sizes of3500 destination objects. At this setting the option does not warn for writes past the end of subobjects of3501 larger objects accessed by pointers unless the size of the largest surrounding object is known. When3502 the destination may be one of several objects it is assumed to be the largest one of them. On Linux3503 systems, when optimization is enabled at this setting the option warns for the same code as when the3504 "_FORTIFY_SOURCE" macro is defined to a non-zero value.3505 -Wstringop-overflow=23506 The -Wstringop-overflow=2 option uses type-one Object Size Checking to determine the sizes of3507 destination objects. At this setting the option warns about overflows when writing to members of the3508 largest complete objects whose exact size is known. However, it does not warn for excessive writes to3509 the same members of unknown objects referenced by pointers since they may point to arrays containing3510 unknown numbers of elements. This is the default setting of the option.3511 -Wstringop-overflow=33512 The -Wstringop-overflow=3 option uses type-two Object Size Checking to determine the sizes of3513 destination objects. At this setting the option warns about overflowing the smallest object or data3514 member. This is the most restrictive setting of the option that may result in warnings for safe code.3515 -Wstringop-overflow=43516 The -Wstringop-overflow=4 option uses type-three Object Size Checking to determine the sizes of3517 destination objects. At this setting the option warns about overflowing any data members, and when the3518 destination is one of several objects it uses the size of the largest of them to decide whether to3519 issue a warning. Similarly to -Wstringop-overflow=3 this setting of the option may result in warnings3520 for benign code.3521 -Wno-stringop-overread3522 Warn for calls to string manipulation functions such as "memchr", or "strcpy" that are determined to read3523 past the end of the source sequence.3524 Option -Wstringop-overread is enabled by default.3525 -Wno-stringop-truncation3526 Do not warn for calls to bounded string manipulation functions such as "strncat", "strncpy", and "stpncpy"3527 that may either truncate the copied string or leave the destination unchanged.3528 In the following example, the call to "strncat" specifies a bound that is less than the length of the3529 source string. As a result, the copy of the source will be truncated and so the call is diagnosed. To3530 avoid the warning use "bufsize - strlen (buf) - 1)" as the bound.3531 void append (char *buf, size_t bufsize)3532 {3533 strncat (buf, ".txt", 3);3534 }3535 As another example, the following call to "strncpy" results in copying to "d" just the characters preceding3536 the terminating NUL, without appending the NUL to the end. Assuming the result of "strncpy" is necessarily3537 a NUL-terminated string is a common mistake, and so the call is diagnosed. To avoid the warning when the3538 result is not expected to be NUL-terminated, call "memcpy" instead.3539 void copy (char *d, const char *s)3540 {3541 strncpy (d, s, strlen (s));3542 }3543 In the following example, the call to "strncpy" specifies the size of the destination buffer as the bound.3544 If the length of the source string is equal to or greater than this size the result of the copy will not be3545 NUL-terminated. Therefore, the call is also diagnosed. To avoid the warning, specify "sizeof buf - 1" as3546 the bound and set the last element of the buffer to "NUL".3547 void copy (const char *s)3548 {3549 char buf[80];3550 strncpy (buf, s, sizeof buf);3551 ...3552 }3553 In situations where a character array is intended to store a sequence of bytes with no terminating "NUL"3554 such an array may be annotated with attribute "nonstring" to avoid this warning. Such arrays, however, are3555 not suitable arguments to functions that expect "NUL"-terminated strings. To help detect accidental3556 misuses of such arrays GCC issues warnings unless it can prove that the use is safe.3557 -Wsuggest-attribute=[pure|const|noreturn|format|cold|malloc]3558 Warn for cases where adding an attribute may be beneficial. The attributes currently supported are listed3559 below.3560 -Wsuggest-attribute=pure3561 -Wsuggest-attribute=const3562 -Wsuggest-attribute=noreturn3563 -Wmissing-noreturn3564 -Wsuggest-attribute=malloc3565 Warn about functions that might be candidates for attributes "pure", "const" or "noreturn" or "malloc".3566 The compiler only warns for functions visible in other compilation units or (in the case of "pure" and3567 "const") if it cannot prove that the function returns normally. A function returns normally if it3568 doesn't contain an infinite loop or return abnormally by throwing, calling "abort" or trapping. This3569 analysis requires option -fipa-pure-const, which is enabled by default at -O and higher. Higher3570 optimization levels improve the accuracy of the analysis.3571 -Wsuggest-attribute=format3572 -Wmissing-format-attribute3573 Warn about function pointers that might be candidates for "format" attributes. Note these are only3574 possible candidates, not absolute ones. GCC guesses that function pointers with "format" attributes3575 that are used in assignment, initialization, parameter passing or return statements should have a3576 corresponding "format" attribute in the resulting type. I.e. the left-hand side of the assignment or3577 initialization, the type of the parameter variable, or the return type of the containing function3578 respectively should also have a "format" attribute to avoid the warning.3579 GCC also warns about function definitions that might be candidates for "format" attributes. Again,3580 these are only possible candidates. GCC guesses that "format" attributes might be appropriate for any3581 function that calls a function like "vprintf" or "vscanf", but this might not always be the case, and3582 some functions for which "format" attributes are appropriate may not be detected.3583 -Wsuggest-attribute=cold3584 Warn about functions that might be candidates for "cold" attribute. This is based on static detection3585 and generally only warns about functions which always leads to a call to another "cold" function such3586 as wrappers of C++ "throw" or fatal error reporting functions leading to "abort".3587 -Walloc-zero3588 Warn about calls to allocation functions decorated with attribute "alloc_size" that specify zero bytes,3589 including those to the built-in forms of the functions "aligned_alloc", "alloca", "calloc", "malloc", and3590 "realloc". Because the behavior of these functions when called with a zero size differs among3591 implementations (and in the case of "realloc" has been deprecated) relying on it may result in subtle3592 portability bugs and should be avoided.3593 -Walloc-size-larger-than=byte-size3594 Warn about calls to functions decorated with attribute "alloc_size" that attempt to allocate objects larger3595 than the specified number of bytes, or where the result of the size computation in an integer type with3596 infinite precision would exceed the value of PTRDIFF_MAX on the target.3597 -Walloc-size-larger-than=PTRDIFF_MAX is enabled by default. Warnings controlled by the option can be3598 disabled either by specifying byte-size of SIZE_MAX or more or by -Wno-alloc-size-larger-than.3599 -Wno-alloc-size-larger-than3600 Disable -Walloc-size-larger-than= warnings. The option is equivalent to -Walloc-size-larger-than=SIZE_MAX3601 or larger.3602 -Walloca3603 This option warns on all uses of "alloca" in the source.3604 -Walloca-larger-than=byte-size3605 This option warns on calls to "alloca" with an integer argument whose value is either zero, or that is not3606 bounded by a controlling predicate that limits its value to at most byte-size. It also warns for calls to3607 "alloca" where the bound value is unknown. Arguments of non-integer types are considered unbounded even if3608 they appear to be constrained to the expected range.3609 For example, a bounded case of "alloca" could be:3610 void func (size_t n)3611 {3612 void *p;3613 if (n <= 1000)3614 p = alloca (n);3615 else3616 p = malloc (n);3617 f (p);3618 }3619 In the above example, passing "-Walloca-larger-than=1000" would not issue a warning because the call to3620 "alloca" is known to be at most 1000 bytes. However, if "-Walloca-larger-than=500" were passed, the3621 compiler would emit a warning.3622 Unbounded uses, on the other hand, are uses of "alloca" with no controlling predicate constraining its3623 integer argument. For example:3624 void func ()3625 {3626 void *p = alloca (n);3627 f (p);3628 }3629 If "-Walloca-larger-than=500" were passed, the above would trigger a warning, but this time because of the3630 lack of bounds checking.3631 Note, that even seemingly correct code involving signed integers could cause a warning:3632 void func (signed int n)3633 {3634 if (n < 500)3635 {3636 p = alloca (n);3637 f (p);3638 }3639 }3640 In the above example, n could be negative, causing a larger than expected argument to be implicitly cast3641 into the "alloca" call.3642 This option also warns when "alloca" is used in a loop.3643 -Walloca-larger-than=PTRDIFF_MAX is enabled by default but is usually only effective when -ftree-vrp is3644 active (default for -O2 and above).3645 See also -Wvla-larger-than=byte-size.3646 -Wno-alloca-larger-than3647 Disable -Walloca-larger-than= warnings. The option is equivalent to -Walloca-larger-than=SIZE_MAX or3648 larger.3649 -Warith-conversion3650 Do warn about implicit conversions from arithmetic operations even when conversion of the operands to the3651 same type cannot change their values. This affects warnings from -Wconversion, -Wfloat-conversion, and3652 -Wsign-conversion.3653 void f (char c, int i)3654 {3655 c = c + i; // warns with B<-Wconversion>3656 c = c + 1; // only warns with B<-Warith-conversion>3657 }3658 -Warray-bounds3659 -Warray-bounds=n3660 This option is only active when -ftree-vrp is active (default for -O2 and above). It warns about subscripts3661 to arrays that are always out of bounds. This warning is enabled by -Wall.3662 -Warray-bounds=13663 This is the warning level of -Warray-bounds and is enabled by -Wall; higher levels are not, and must be3664 explicitly requested.3665 -Warray-bounds=23666 This warning level also warns about out of bounds access for arrays at the end of a struct and for3667 arrays accessed through pointers. This warning level may give a larger number of false positives and is3668 deactivated by default.3669 -Warray-parameter3670 -Warray-parameter=n3671 Warn about redeclarations of functions involving arguments of array or pointer types of inconsistent kinds3672 or forms, and enable the detection of out-of-bounds accesses to such parameters by warnings such as3673 -Warray-bounds.3674 If the first function declaration uses the array form the bound specified in the array is assumed to be the3675 minimum number of elements expected to be provided in calls to the function and the maximum number of3676 elements accessed by it. Failing to provide arguments of sufficient size or accessing more than the3677 maximum number of elements may be diagnosed by warnings such as -Warray-bounds. At level 1 the warning3678 diagnoses inconsistencies involving array parameters declared using the "T[static N]" form.3679 For example, the warning triggers for the following redeclarations because the first one allows an array of3680 any size to be passed to "f" while the second one with the keyword "static" specifies that the array3681 argument must have at least four elements.3682 void f (int[static 4]);3683 void f (int[]); // warning (inconsistent array form)3684 void g (void)3685 {3686 int *p = (int *)malloc (4);3687 f (p); // warning (array too small)3688 ...3689 }3690 At level 2 the warning also triggers for redeclarations involving any other inconsistency in array or3691 pointer argument forms denoting array sizes. Pointers and arrays of unspecified bound are considered3692 equivalent and do not trigger a warning.3693 void g (int*);3694 void g (int[]); // no warning3695 void g (int[8]); // warning (inconsistent array bound)3696 -Warray-parameter=2 is included in -Wall. The -Wvla-parameter option triggers warnings for similar3697 inconsistencies involving Variable Length Array arguments.3698 -Wattribute-alias=n3699 -Wno-attribute-alias3700 Warn about declarations using the "alias" and similar attributes whose target is incompatible with the type3701 of the alias.3702 -Wattribute-alias=13703 The default warning level of the -Wattribute-alias option diagnoses incompatibilities between the type3704 of the alias declaration and that of its target. Such incompatibilities are typically indicative of3705 bugs.3706 -Wattribute-alias=23707 At this level -Wattribute-alias also diagnoses cases where the attributes of the alias declaration are3708 more restrictive than the attributes applied to its target. These mismatches can potentially result in3709 incorrect code generation. In other cases they may be benign and could be resolved simply by adding3710 the missing attribute to the target. For comparison, see the -Wmissing-attributes option, which3711 controls diagnostics when the alias declaration is less restrictive than the target, rather than more3712 restrictive.3713 Attributes considered include "alloc_align", "alloc_size", "cold", "const", "hot", "leaf", "malloc",3714 "nonnull", "noreturn", "nothrow", "pure", "returns_nonnull", and "returns_twice".3715 -Wattribute-alias is equivalent to -Wattribute-alias=1. This is the default. You can disable these3716 warnings with either -Wno-attribute-alias or -Wattribute-alias=0.3717 -Wbool-compare3718 Warn about boolean expression compared with an integer value different from "true"/"false". For instance,3719 the following comparison is always false:3720 int n = 5;3721 ...3722 if ((n > 1) == 2) { ... }3723 This warning is enabled by -Wall.3724 -Wbool-operation3725 Warn about suspicious operations on expressions of a boolean type. For instance, bitwise negation of a3726 boolean is very likely a bug in the program. For C, this warning also warns about incrementing or3727 decrementing a boolean, which rarely makes sense. (In C++, decrementing a boolean is always invalid.3728 Incrementing a boolean is invalid in C++17, and deprecated otherwise.)3729 This warning is enabled by -Wall.3730 -Wduplicated-branches3731 Warn when an if-else has identical branches. This warning detects cases like3732 if (p != NULL)3733 return 0;3734 else3735 return 0;3736 It doesn't warn when both branches contain just a null statement. This warning also warn for conditional3737 operators:3738 int i = x ? *p : *p;3739 -Wduplicated-cond3740 Warn about duplicated conditions in an if-else-if chain. For instance, warn for the following code:3741 if (p->q != NULL) { ... }3742 else if (p->q != NULL) { ... }3743 -Wframe-address3744 Warn when the __builtin_frame_address or __builtin_return_address is called with an argument greater than3745 0. Such calls may return indeterminate values or crash the program. The warning is included in -Wall.3746 -Wno-discarded-qualifiers (C and Objective-C only)3747 Do not warn if type qualifiers on pointers are being discarded. Typically, the compiler warns if a "const3748 char *" variable is passed to a function that takes a "char *" parameter. This option can be used to3749 suppress such a warning.3750 -Wno-discarded-array-qualifiers (C and Objective-C only)3751 Do not warn if type qualifiers on arrays which are pointer targets are being discarded. Typically, the3752 compiler warns if a "const int (*)[]" variable is passed to a function that takes a "int (*)[]" parameter.3753 This option can be used to suppress such a warning.3754 -Wno-incompatible-pointer-types (C and Objective-C only)3755 Do not warn when there is a conversion between pointers that have incompatible types. This warning is for3756 cases not covered by -Wno-pointer-sign, which warns for pointer argument passing or assignment with3757 different signedness.3758 -Wno-int-conversion (C and Objective-C only)3759 Do not warn about incompatible integer to pointer and pointer to integer conversions. This warning is3760 about implicit conversions; for explicit conversions the warnings -Wno-int-to-pointer-cast and3761 -Wno-pointer-to-int-cast may be used.3762 -Wzero-length-bounds3763 Warn about accesses to elements of zero-length array members that might overlap other members of the same3764 object. Declaring interior zero-length arrays is discouraged because accesses to them are undefined. See3765 For example, the first two stores in function "bad" are diagnosed because the array elements overlap the3766 subsequent members "b" and "c". The third store is diagnosed by -Warray-bounds because it is beyond the3767 bounds of the enclosing object.3768 struct X { int a[0]; int b, c; };3769 struct X x;3770 void bad (void)3771 {3772 x.a[0] = 0; // -Wzero-length-bounds3773 x.a[1] = 1; // -Wzero-length-bounds3774 x.a[2] = 2; // -Warray-bounds3775 }3776 Option -Wzero-length-bounds is enabled by -Warray-bounds.3777 -Wno-div-by-zero3778 Do not warn about compile-time integer division by zero. Floating-point division by zero is not warned3779 about, as it can be a legitimate way of obtaining infinities and NaNs.3780 -Wsystem-headers3781 Print warning messages for constructs found in system header files. Warnings from system headers are3782 normally suppressed, on the assumption that they usually do not indicate real problems and would only make3783 the compiler output harder to read. Using this command-line option tells GCC to emit warnings from system3784 headers as if they occurred in user code. However, note that using -Wall in conjunction with this option3785 does not warn about unknown pragmas in system headers---for that, -Wunknown-pragmas must also be used.3786 -Wtautological-compare3787 Warn if a self-comparison always evaluates to true or false. This warning detects various mistakes such3788 as:3789 int i = 1;3790 ...3791 if (i > i) { ... }3792 This warning also warns about bitwise comparisons that always evaluate to true or false, for instance:3793 if ((a & 16) == 10) { ... }3794 will always be false.3795 This warning is enabled by -Wall.3796 -Wtrampolines3797 Warn about trampolines generated for pointers to nested functions. A trampoline is a small piece of data3798 or code that is created at run time on the stack when the address of a nested function is taken, and is3799 used to call the nested function indirectly. For some targets, it is made up of data only and thus3800 requires no special treatment. But, for most targets, it is made up of code and thus requires the stack to3801 be made executable in order for the program to work properly.3802 -Wfloat-equal3803 Warn if floating-point values are used in equality comparisons.3804 The idea behind this is that sometimes it is convenient (for the programmer) to consider floating-point3805 values as approximations to infinitely precise real numbers. If you are doing this, then you need to3806 compute (by analyzing the code, or in some other way) the maximum or likely maximum error that the3807 computation introduces, and allow for it when performing comparisons (and when producing output, but that's3808 a different problem). In particular, instead of testing for equality, you should check to see whether the3809 two values have ranges that overlap; and this is done with the relational operators, so equality3810 comparisons are probably mistaken.3811 -Wtraditional (C and Objective-C only)3812 Warn about certain constructs that behave differently in traditional and ISO C. Also warn about ISO C3813 constructs that have no traditional C equivalent, and/or problematic constructs that should be avoided.3814 * Macro parameters that appear within string literals in the macro body. In traditional C macro3815 replacement takes place within string literals, but in ISO C it does not.3816 * In traditional C, some preprocessor directives did not exist. Traditional preprocessors only3817 considered a line to be a directive if the # appeared in column 1 on the line. Therefore -Wtraditional3818 warns about directives that traditional C understands but ignores because the # does not appear as the3819 first character on the line. It also suggests you hide directives like "#pragma" not understood by3820 traditional C by indenting them. Some traditional implementations do not recognize "#elif", so this3821 option suggests avoiding it altogether.3822 * A function-like macro that appears without arguments.3823 * The unary plus operator.3824 * The U integer constant suffix, or the F or L floating-point constant suffixes. (Traditional C does3825 support the L suffix on integer constants.) Note, these suffixes appear in macros defined in the3826 system headers of most modern systems, e.g. the _MIN/_MAX macros in "<limits.h>". Use of these macros3827 in user code might normally lead to spurious warnings, however GCC's integrated preprocessor has enough3828 context to avoid warning in these cases.3829 * A function declared external in one block and then used after the end of the block.3830 * A "switch" statement has an operand of type "long".3831 * A non-"static" function declaration follows a "static" one. This construct is not accepted by some3832 traditional C compilers.3833 * The ISO type of an integer constant has a different width or signedness from its traditional type.3834 This warning is only issued if the base of the constant is ten. I.e. hexadecimal or octal values,3835 which typically represent bit patterns, are not warned about.3836 * Usage of ISO string concatenation is detected.3837 * Initialization of automatic aggregates.3838 * Identifier conflicts with labels. Traditional C lacks a separate namespace for labels.3839 * Initialization of unions. If the initializer is zero, the warning is omitted. This is done under the3840 assumption that the zero initializer in user code appears conditioned on e.g. "__STDC__" to avoid3841 missing initializer warnings and relies on default initialization to zero in the traditional C case.3842 * Conversions by prototypes between fixed/floating-point values and vice versa. The absence of these3843 prototypes when compiling with traditional C causes serious problems. This is a subset of the possible3844 conversion warnings; for the full set use -Wtraditional-conversion.3845 * Use of ISO C style function definitions. This warning intentionally is not issued for prototype3846 declarations or variadic functions because these ISO C features appear in your code when using3847 libiberty's traditional C compatibility macros, "PARAMS" and "VPARAMS". This warning is also bypassed3848 for nested functions because that feature is already a GCC extension and thus not relevant to3849 traditional C compatibility.3850 -Wtraditional-conversion (C and Objective-C only)3851 Warn if a prototype causes a type conversion that is different from what would happen to the same argument3852 in the absence of a prototype. This includes conversions of fixed point to floating and vice versa, and3853 conversions changing the width or signedness of a fixed-point argument except when the same as the default3854 promotion.3855 -Wdeclaration-after-statement (C and Objective-C only)3856 Warn when a declaration is found after a statement in a block. This construct, known from C++, was3857 introduced with ISO C99 and is by default allowed in GCC. It is not supported by ISO C90.3858 -Wshadow3859 Warn whenever a local variable or type declaration shadows another variable, parameter, type, class member3860 (in C++), or instance variable (in Objective-C) or whenever a built-in function is shadowed. Note that in3861 C++, the compiler warns if a local variable shadows an explicit typedef, but not if it shadows a3862 struct/class/enum. If this warning is enabled, it includes also all instances of local shadowing. This3863 means that -Wno-shadow=local and -Wno-shadow=compatible-local are ignored when -Wshadow is used. Same as3864 -Wshadow=global.3865 -Wno-shadow-ivar (Objective-C only)3866 Do not warn whenever a local variable shadows an instance variable in an Objective-C method.3867 -Wshadow=global3868 Warn for any shadowing. Same as -Wshadow.3869 -Wshadow=local3870 Warn when a local variable shadows another local variable or parameter.3871 -Wshadow=compatible-local3872 Warn when a local variable shadows another local variable or parameter whose type is compatible with that3873 of the shadowing variable. In C++, type compatibility here means the type of the shadowing variable can be3874 converted to that of the shadowed variable. The creation of this flag (in addition to -Wshadow=local) is3875 based on the idea that when a local variable shadows another one of incompatible type, it is most likely3876 intentional, not a bug or typo, as shown in the following example:3877 for (SomeIterator i = SomeObj.begin(); i != SomeObj.end(); ++i)3878 {3879 for (int i = 0; i < N; ++i)3880 {3881 ...3882 }3883 ...3884 }3885 Since the two variable "i" in the example above have incompatible types, enabling only3886 -Wshadow=compatible-local does not emit a warning. Because their types are incompatible, if a programmer3887 accidentally uses one in place of the other, type checking is expected to catch that and emit an error or3888 warning. Use of this flag instead of -Wshadow=local can possibly reduce the number of warnings triggered3889 by intentional shadowing. Note that this also means that shadowing "const char *i" by "char *i" does not3890 emit a warning.3891 This warning is also enabled by -Wshadow=local.3892 -Wlarger-than=byte-size3893 Warn whenever an object is defined whose size exceeds byte-size. -Wlarger-than=PTRDIFF_MAX is enabled by3894 default. Warnings controlled by the option can be disabled either by specifying byte-size of SIZE_MAX or3895 more or by -Wno-larger-than.3896 Also warn for calls to bounded functions such as "memchr" or "strnlen" that specify a bound greater than3897 the largest possible object, which is PTRDIFF_MAX bytes by default. These warnings can only be disabled by3898 -Wno-larger-than.3899 -Wno-larger-than3900 Disable -Wlarger-than= warnings. The option is equivalent to -Wlarger-than=SIZE_MAX or larger.3901 -Wframe-larger-than=byte-size3902 Warn if the size of a function frame exceeds byte-size. The computation done to determine the stack frame3903 size is approximate and not conservative. The actual requirements may be somewhat greater than byte-size3904 even if you do not get a warning. In addition, any space allocated via "alloca", variable-length arrays,3905 or related constructs is not included by the compiler when determining whether or not to issue a warning.3906 -Wframe-larger-than=PTRDIFF_MAX is enabled by default. Warnings controlled by the option can be disabled3907 either by specifying byte-size of SIZE_MAX or more or by -Wno-frame-larger-than.3908 -Wno-frame-larger-than3909 Disable -Wframe-larger-than= warnings. The option is equivalent to -Wframe-larger-than=SIZE_MAX or larger.3910 -Wno-free-nonheap-object3911 Warn when attempting to deallocate an object that was either not allocated on the heap, or by using a3912 pointer that was not returned from a prior call to the corresponding allocation function. For example,3913 because the call to "stpcpy" returns a pointer to the terminating nul character and not to the begginning3914 of the object, the call to "free" below is diagnosed.3915 void f (char *p)3916 {3917 p = stpcpy (p, "abc");3918 // ...3919 free (p); // warning3920 }3921 -Wfree-nonheap-object is enabled by default.3922 -Wstack-usage=byte-size3923 Warn if the stack usage of a function might exceed byte-size. The computation done to determine the stack3924 usage is conservative. Any space allocated via "alloca", variable-length arrays, or related constructs is3925 included by the compiler when determining whether or not to issue a warning.3926 The message is in keeping with the output of -fstack-usage.3927 * If the stack usage is fully static but exceeds the specified amount, it's:3928 warning: stack usage is 1120 bytes3929 * If the stack usage is (partly) dynamic but bounded, it's:3930 warning: stack usage might be 1648 bytes3931 * If the stack usage is (partly) dynamic and not bounded, it's:3932 warning: stack usage might be unbounded3933 -Wstack-usage=PTRDIFF_MAX is enabled by default. Warnings controlled by the option can be disabled either3934 by specifying byte-size of SIZE_MAX or more or by -Wno-stack-usage.3935 -Wno-stack-usage3936 Disable -Wstack-usage= warnings. The option is equivalent to -Wstack-usage=SIZE_MAX or larger.3937 -Wunsafe-loop-optimizations3938 Warn if the loop cannot be optimized because the compiler cannot assume anything on the bounds of the loop3939 indices. With -funsafe-loop-optimizations warn if the compiler makes such assumptions.3940 -Wno-pedantic-ms-format (MinGW targets only)3941 When used in combination with -Wformat and -pedantic without GNU extensions, this option disables the3942 warnings about non-ISO "printf" / "scanf" format width specifiers "I32", "I64", and "I" used on Windows3943 targets, which depend on the MS runtime.3944 -Wpointer-arith3945 Warn about anything that depends on the "size of" a function type or of "void". GNU C assigns these types3946 a size of 1, for convenience in calculations with "void *" pointers and pointers to functions. In C++,3947 warn also when an arithmetic operation involves "NULL". This warning is also enabled by -Wpedantic.3948 -Wno-pointer-compare3949 Do not warn if a pointer is compared with a zero character constant. This usually means that the pointer3950 was meant to be dereferenced. For example:3951 const char *p = foo ();3952 if (p == '\0')3953 return 42;3954 Note that the code above is invalid in C++11.3955 This warning is enabled by default.3956 -Wtsan3957 Warn about unsupported features in ThreadSanitizer.3958 ThreadSanitizer does not support "std::atomic_thread_fence" and can report false positives.3959 This warning is enabled by default.3960 -Wtype-limits3961 Warn if a comparison is always true or always false due to the limited range of the data type, but do not3962 warn for constant expressions. For example, warn if an unsigned variable is compared against zero with "<"3963 or ">=". This warning is also enabled by -Wextra.3964 -Wabsolute-value (C and Objective-C only)3965 Warn for calls to standard functions that compute the absolute value of an argument when a more appropriate3966 standard function is available. For example, calling "abs(3.14)" triggers the warning because the3967 appropriate function to call to compute the absolute value of a double argument is "fabs". The option also3968 triggers warnings when the argument in a call to such a function has an unsigned type. This warning can be3969 suppressed with an explicit type cast and it is also enabled by -Wextra.3970 -Wcomment3971 -Wcomments3972 Warn whenever a comment-start sequence /* appears in a /* comment, or whenever a backslash-newline appears3973 in a // comment. This warning is enabled by -Wall.3974 -Wtrigraphs3975 Warn if any trigraphs are encountered that might change the meaning of the program. Trigraphs within3976 comments are not warned about, except those that would form escaped newlines.3977 This option is implied by -Wall. If -Wall is not given, this option is still enabled unless trigraphs are3978 enabled. To get trigraph conversion without warnings, but get the other -Wall warnings, use -trigraphs3979 -Wall -Wno-trigraphs.3980 -Wundef3981 Warn if an undefined identifier is evaluated in an "#if" directive. Such identifiers are replaced with3982 zero.3983 -Wexpansion-to-defined3984 Warn whenever defined is encountered in the expansion of a macro (including the case where the macro is3985 expanded by an #if directive). Such usage is not portable. This warning is also enabled by -Wpedantic and3986 -Wextra.3987 -Wunused-macros3988 Warn about macros defined in the main file that are unused. A macro is used if it is expanded or tested3989 for existence at least once. The preprocessor also warns if the macro has not been used at the time it is3990 redefined or undefined.3991 Built-in macros, macros defined on the command line, and macros defined in include files are not warned3992 about.3993 Note: If a macro is actually used, but only used in skipped conditional blocks, then the preprocessor3994 reports it as unused. To avoid the warning in such a case, you might improve the scope of the macro's3995 definition by, for example, moving it into the first skipped block. Alternatively, you could provide a3996 dummy use with something like:3997 #if defined the_macro_causing_the_warning3998 #endif3999 -Wno-endif-labels4000 Do not warn whenever an "#else" or an "#endif" are followed by text. This sometimes happens in older4001 programs with code of the form4002 #if FOO4003 ...4004 #else FOO4005 ...4006 #endif FOO4007 The second and third "FOO" should be in comments. This warning is on by default.4008 -Wbad-function-cast (C and Objective-C only)4009 Warn when a function call is cast to a non-matching type. For example, warn if a call to a function4010 returning an integer type is cast to a pointer type.4011 -Wc90-c99-compat (C and Objective-C only)4012 Warn about features not present in ISO C90, but present in ISO C99. For instance, warn about use of4013 variable length arrays, "long long" type, "bool" type, compound literals, designated initializers, and so4014 on. This option is independent of the standards mode. Warnings are disabled in the expression that4015 follows "__extension__".4016 -Wc99-c11-compat (C and Objective-C only)4017 Warn about features not present in ISO C99, but present in ISO C11. For instance, warn about use of4018 anonymous structures and unions, "_Atomic" type qualifier, "_Thread_local" storage-class specifier,4019 "_Alignas" specifier, "Alignof" operator, "_Generic" keyword, and so on. This option is independent of the4020 standards mode. Warnings are disabled in the expression that follows "__extension__".4021 -Wc11-c2x-compat (C and Objective-C only)4022 Warn about features not present in ISO C11, but present in ISO C2X. For instance, warn about omitting the4023 string in "_Static_assert", use of [[]] syntax for attributes, use of decimal floating-point types, and so4024 on. This option is independent of the standards mode. Warnings are disabled in the expression that4025 follows "__extension__".4026 -Wc++-compat (C and Objective-C only)4027 Warn about ISO C constructs that are outside of the common subset of ISO C and ISO C++, e.g. request for4028 implicit conversion from "void *" to a pointer to non-"void" type.4029 -Wc++11-compat (C++ and Objective-C++ only)4030 Warn about C++ constructs whose meaning differs between ISO C++ 1998 and ISO C++ 2011, e.g., identifiers in4031 ISO C++ 1998 that are keywords in ISO C++ 2011. This warning turns on -Wnarrowing and is enabled by -Wall.4032 -Wc++14-compat (C++ and Objective-C++ only)4033 Warn about C++ constructs whose meaning differs between ISO C++ 2011 and ISO C++ 2014. This warning is4034 enabled by -Wall.4035 -Wc++17-compat (C++ and Objective-C++ only)4036 Warn about C++ constructs whose meaning differs between ISO C++ 2014 and ISO C++ 2017. This warning is4037 enabled by -Wall.4038 -Wc++20-compat (C++ and Objective-C++ only)4039 Warn about C++ constructs whose meaning differs between ISO C++ 2017 and ISO C++ 2020. This warning is4040 enabled by -Wall.4041 -Wcast-qual4042 Warn whenever a pointer is cast so as to remove a type qualifier from the target type. For example, warn4043 if a "const char *" is cast to an ordinary "char *".4044 Also warn when making a cast that introduces a type qualifier in an unsafe way. For example, casting "char4045 **" to "const char **" is unsafe, as in this example:4046 /* p is char ** value. */4047 const char **q = (const char **) p;4048 /* Assignment of readonly string to const char * is OK. */4049 *q = "string";4050 /* Now char** pointer points to read-only memory. */4051 **p = 'b';4052 -Wcast-align4053 Warn whenever a pointer is cast such that the required alignment of the target is increased. For example,4054 warn if a "char *" is cast to an "int *" on machines where integers can only be accessed at two- or four-4055 byte boundaries.4056 -Wcast-align=strict4057 Warn whenever a pointer is cast such that the required alignment of the target is increased. For example,4058 warn if a "char *" is cast to an "int *" regardless of the target machine.4059 -Wcast-function-type4060 Warn when a function pointer is cast to an incompatible function pointer. In a cast involving function4061 types with a variable argument list only the types of initial arguments that are provided are considered.4062 Any parameter of pointer-type matches any other pointer-type. Any benign differences in integral types are4063 ignored, like "int" vs. "long" on ILP32 targets. Likewise type qualifiers are ignored. The function type4064 "void (*) (void)" is special and matches everything, which can be used to suppress this warning. In a cast4065 involving pointer to member types this warning warns whenever the type cast is changing the pointer to4066 member type. This warning is enabled by -Wextra.4067 -Wwrite-strings4068 When compiling C, give string constants the type "const char[length]" so that copying the address of one4069 into a non-"const" "char *" pointer produces a warning. These warnings help you find at compile time code4070 that can try to write into a string constant, but only if you have been very careful about using "const" in4071 declarations and prototypes. Otherwise, it is just a nuisance. This is why we did not make -Wall request4072 these warnings.4073 When compiling C++, warn about the deprecated conversion from string literals to "char *". This warning is4074 enabled by default for C++ programs.4075 -Wclobbered4076 Warn for variables that might be changed by "longjmp" or "vfork". This warning is also enabled by -Wextra.4077 -Wconversion4078 Warn for implicit conversions that may alter a value. This includes conversions between real and integer,4079 like "abs (x)" when "x" is "double"; conversions between signed and unsigned, like "unsigned ui = -1"; and4080 conversions to smaller types, like "sqrtf (M_PI)". Do not warn for explicit casts like "abs ((int) x)" and4081 "ui = (unsigned) -1", or if the value is not changed by the conversion like in "abs (2.0)". Warnings about4082 conversions between signed and unsigned integers can be disabled by using -Wno-sign-conversion.4083 For C++, also warn for confusing overload resolution for user-defined conversions; and conversions that4084 never use a type conversion operator: conversions to "void", the same type, a base class or a reference to4085 them. Warnings about conversions between signed and unsigned integers are disabled by default in C++ unless4086 -Wsign-conversion is explicitly enabled.4087 Warnings about conversion from arithmetic on a small type back to that type are only given with4088 -Warith-conversion.4089 -Wdangling-else4090 Warn about constructions where there may be confusion to which "if" statement an "else" branch belongs.4091 Here is an example of such a case:4092 {4093 if (a)4094 if (b)4095 foo ();4096 else4097 bar ();4098 }4099 In C/C++, every "else" branch belongs to the innermost possible "if" statement, which in this example is4100 "if (b)". This is often not what the programmer expected, as illustrated in the above example by4101 indentation the programmer chose. When there is the potential for this confusion, GCC issues a warning4102 when this flag is specified. To eliminate the warning, add explicit braces around the innermost "if"4103 statement so there is no way the "else" can belong to the enclosing "if". The resulting code looks like4104 this:4105 {4106 if (a)4107 {4108 if (b)4109 foo ();4110 else4111 bar ();4112 }4113 }4114 This warning is enabled by -Wparentheses.4115 -Wdate-time4116 Warn when macros "__TIME__", "__DATE__" or "__TIMESTAMP__" are encountered as they might prevent bit-wise-4117 identical reproducible compilations.4118 -Wempty-body4119 Warn if an empty body occurs in an "if", "else" or "do while" statement. This warning is also enabled by4120 -Wextra.4121 -Wno-endif-labels4122 Do not warn about stray tokens after "#else" and "#endif".4123 -Wenum-compare4124 Warn about a comparison between values of different enumerated types. In C++ enumerated type mismatches in4125 conditional expressions are also diagnosed and the warning is enabled by default. In C this warning is4126 enabled by -Wall.4127 -Wenum-conversion4128 Warn when a value of enumerated type is implicitly converted to a different enumerated type. This warning4129 is enabled by -Wextra in C.4130 -Wjump-misses-init (C, Objective-C only)4131 Warn if a "goto" statement or a "switch" statement jumps forward across the initialization of a variable,4132 or jumps backward to a label after the variable has been initialized. This only warns about variables that4133 are initialized when they are declared. This warning is only supported for C and Objective-C; in C++ this4134 sort of branch is an error in any case.4135 -Wjump-misses-init is included in -Wc++-compat. It can be disabled with the -Wno-jump-misses-init option.4136 -Wsign-compare4137 Warn when a comparison between signed and unsigned values could produce an incorrect result when the signed4138 value is converted to unsigned. In C++, this warning is also enabled by -Wall. In C, it is also enabled4139 by -Wextra.4140 -Wsign-conversion4141 Warn for implicit conversions that may change the sign of an integer value, like assigning a signed integer4142 expression to an unsigned integer variable. An explicit cast silences the warning. In C, this option is4143 enabled also by -Wconversion.4144 -Wfloat-conversion4145 Warn for implicit conversions that reduce the precision of a real value. This includes conversions from4146 real to integer, and from higher precision real to lower precision real values. This option is also4147 enabled by -Wconversion.4148 -Wno-scalar-storage-order4149 Do not warn on suspicious constructs involving reverse scalar storage order.4150 -Wsizeof-array-div4151 Warn about divisions of two sizeof operators when the first one is applied to an array and the divisor does4152 not equal the size of the array element. In such a case, the computation will not yield the number of4153 elements in the array, which is likely what the user intended. This warning warns e.g. about4154 int fn ()4155 {4156 int arr[10];4157 return sizeof (arr) / sizeof (short);4158 }4159 This warning is enabled by -Wall.4160 -Wsizeof-pointer-div4161 Warn for suspicious divisions of two sizeof expressions that divide the pointer size by the element size,4162 which is the usual way to compute the array size but won't work out correctly with pointers. This warning4163 warns e.g. about "sizeof (ptr) / sizeof (ptr[0])" if "ptr" is not an array, but a pointer. This warning is4164 enabled by -Wall.4165 -Wsizeof-pointer-memaccess4166 Warn for suspicious length parameters to certain string and memory built-in functions if the argument uses4167 "sizeof". This warning triggers for example for "memset (ptr, 0, sizeof (ptr));" if "ptr" is not an array,4168 but a pointer, and suggests a possible fix, or about "memcpy (&foo, ptr, sizeof (&foo));".4169 -Wsizeof-pointer-memaccess also warns about calls to bounded string copy functions like "strncat" or4170 "strncpy" that specify as the bound a "sizeof" expression of the source array. For example, in the4171 following function the call to "strncat" specifies the size of the source string as the bound. That is4172 almost certainly a mistake and so the call is diagnosed.4173 void make_file (const char *name)4174 {4175 char path[PATH_MAX];4176 strncpy (path, name, sizeof path - 1);4177 strncat (path, ".text", sizeof ".text");4178 ...4179 }4180 The -Wsizeof-pointer-memaccess option is enabled by -Wall.4181 -Wno-sizeof-array-argument4182 Do not warn when the "sizeof" operator is applied to a parameter that is declared as an array in a function4183 definition. This warning is enabled by default for C and C++ programs.4184 -Wmemset-elt-size4185 Warn for suspicious calls to the "memset" built-in function, if the first argument references an array, and4186 the third argument is a number equal to the number of elements, but not equal to the size of the array in4187 memory. This indicates that the user has omitted a multiplication by the element size. This warning is4188 enabled by -Wall.4189 -Wmemset-transposed-args4190 Warn for suspicious calls to the "memset" built-in function where the second argument is not zero and the4191 third argument is zero. For example, the call "memset (buf, sizeof buf, 0)" is diagnosed because "memset4192 (buf, 0, sizeof buf)" was meant instead. The diagnostic is only emitted if the third argument is a literal4193 zero. Otherwise, if it is an expression that is folded to zero, or a cast of zero to some type, it is far4194 less likely that the arguments have been mistakenly transposed and no warning is emitted. This warning is4195 enabled by -Wall.4196 -Waddress4197 Warn about suspicious uses of memory addresses. These include using the address of a function in a4198 conditional expression, such as "void func(void); if (func)", and comparisons against the memory address of4199 a string literal, such as "if (x == "abc")". Such uses typically indicate a programmer error: the address4200 of a function always evaluates to true, so their use in a conditional usually indicate that the programmer4201 forgot the parentheses in a function call; and comparisons against string literals result in unspecified4202 behavior and are not portable in C, so they usually indicate that the programmer intended to use "strcmp".4203 This warning is enabled by -Wall.4204 -Wno-address-of-packed-member4205 Do not warn when the address of packed member of struct or union is taken, which usually results in an4206 unaligned pointer value. This is enabled by default.4207 -Wlogical-op4208 Warn about suspicious uses of logical operators in expressions. This includes using logical operators in4209 contexts where a bit-wise operator is likely to be expected. Also warns when the operands of a logical4210 operator are the same:4211 extern int a;4212 if (a < 0 && a < 0) { ... }4213 -Wlogical-not-parentheses4214 Warn about logical not used on the left hand side operand of a comparison. This option does not warn if4215 the right operand is considered to be a boolean expression. Its purpose is to detect suspicious code like4216 the following:4217 int a;4218 ...4219 if (!a > 1) { ... }4220 It is possible to suppress the warning by wrapping the LHS into parentheses:4221 if ((!a) > 1) { ... }4222 This warning is enabled by -Wall.4223 -Waggregate-return4224 Warn if any functions that return structures or unions are defined or called. (In languages where you can4225 return an array, this also elicits a warning.)4226 -Wno-aggressive-loop-optimizations4227 Warn if in a loop with constant number of iterations the compiler detects undefined behavior in some4228 statement during one or more of the iterations.4229 -Wno-attributes4230 Do not warn if an unexpected "__attribute__" is used, such as unrecognized attributes, function attributes4231 applied to variables, etc. This does not stop errors for incorrect use of supported attributes.4232 -Wno-builtin-declaration-mismatch4233 Warn if a built-in function is declared with an incompatible signature or as a non-function, or when a4234 built-in function declared with a type that does not include a prototype is called with arguments whose4235 promoted types do not match those expected by the function. When -Wextra is specified, also warn when a4236 built-in function that takes arguments is declared without a prototype. The -Wbuiltin-declaration-mismatch4237 warning is enabled by default. To avoid the warning include the appropriate header to bring the prototypes4238 of built-in functions into scope.4239 For example, the call to "memset" below is diagnosed by the warning because the function expects a value of4240 type "size_t" as its argument but the type of 32 is "int". With -Wextra, the declaration of the function4241 is diagnosed as well.4242 extern void* memset ();4243 void f (void *d)4244 {4245 memset (d, '\0', 32);4246 }4247 -Wno-builtin-macro-redefined4248 Do not warn if certain built-in macros are redefined. This suppresses warnings for redefinition of4249 "__TIMESTAMP__", "__TIME__", "__DATE__", "__FILE__", and "__BASE_FILE__".4250 -Wstrict-prototypes (C and Objective-C only)4251 Warn if a function is declared or defined without specifying the argument types. (An old-style function4252 definition is permitted without a warning if preceded by a declaration that specifies the argument types.)4253 -Wold-style-declaration (C and Objective-C only)4254 Warn for obsolescent usages, according to the C Standard, in a declaration. For example, warn if storage-4255 class specifiers like "static" are not the first things in a declaration. This warning is also enabled by4256 -Wextra.4257 -Wold-style-definition (C and Objective-C only)4258 Warn if an old-style function definition is used. A warning is given even if there is a previous4259 prototype. A definition using () is not considered an old-style definition in C2X mode, because it is4260 equivalent to (void) in that case, but is considered an old-style definition for older standards.4261 -Wmissing-parameter-type (C and Objective-C only)4262 A function parameter is declared without a type specifier in K&R-style functions:4263 void foo(bar) { }4264 This warning is also enabled by -Wextra.4265 -Wmissing-prototypes (C and Objective-C only)4266 Warn if a global function is defined without a previous prototype declaration. This warning is issued even4267 if the definition itself provides a prototype. Use this option to detect global functions that do not have4268 a matching prototype declaration in a header file. This option is not valid for C++ because all function4269 declarations provide prototypes and a non-matching declaration declares an overload rather than conflict4270 with an earlier declaration. Use -Wmissing-declarations to detect missing declarations in C++.4271 -Wmissing-declarations4272 Warn if a global function is defined without a previous declaration. Do so even if the definition itself4273 provides a prototype. Use this option to detect global functions that are not declared in header files.4274 In C, no warnings are issued for functions with previous non-prototype declarations; use4275 -Wmissing-prototypes to detect missing prototypes. In C++, no warnings are issued for function templates,4276 or for inline functions, or for functions in anonymous namespaces.4277 -Wmissing-field-initializers4278 Warn if a structure's initializer has some fields missing. For example, the following code causes such a4279 warning, because "x.h" is implicitly zero:4280 struct s { int f, g, h; };4281 struct s x = { 3, 4 };4282 This option does not warn about designated initializers, so the following modification does not trigger a4283 warning:4284 struct s { int f, g, h; };4285 struct s x = { .f = 3, .g = 4 };4286 In C this option does not warn about the universal zero initializer { 0 }:4287 struct s { int f, g, h; };4288 struct s x = { 0 };4289 Likewise, in C++ this option does not warn about the empty { } initializer, for example:4290 struct s { int f, g, h; };4291 s x = { };4292 This warning is included in -Wextra. To get other -Wextra warnings without this one, use -Wextra4293 -Wno-missing-field-initializers.4294 -Wno-multichar4295 Do not warn if a multicharacter constant ('FOOF') is used. Usually they indicate a typo in the user's4296 code, as they have implementation-defined values, and should not be used in portable code.4297 -Wnormalized=[none|id|nfc|nfkc]4298 In ISO C and ISO C++, two identifiers are different if they are different sequences of characters.4299 However, sometimes when characters outside the basic ASCII character set are used, you can have two4300 different character sequences that look the same. To avoid confusion, the ISO 10646 standard sets out some4301 normalization rules which when applied ensure that two sequences that look the same are turned into the4302 same sequence. GCC can warn you if you are using identifiers that have not been normalized; this option4303 controls that warning.4304 There are four levels of warning supported by GCC. The default is -Wnormalized=nfc, which warns about any4305 identifier that is not in the ISO 10646 "C" normalized form, NFC. NFC is the recommended form for most4306 uses. It is equivalent to -Wnormalized.4307 Unfortunately, there are some characters allowed in identifiers by ISO C and ISO C++ that, when turned into4308 NFC, are not allowed in identifiers. That is, there's no way to use these symbols in portable ISO C or C++4309 and have all your identifiers in NFC. -Wnormalized=id suppresses the warning for these characters. It is4310 hoped that future versions of the standards involved will correct this, which is why this option is not the4311 default.4312 You can switch the warning off for all characters by writing -Wnormalized=none or -Wno-normalized. You4313 should only do this if you are using some other normalization scheme (like "D"), because otherwise you can4314 easily create bugs that are literally impossible to see.4315 Some characters in ISO 10646 have distinct meanings but look identical in some fonts or display4316 methodologies, especially once formatting has been applied. For instance "\u207F", "SUPERSCRIPT LATIN4317 SMALL LETTER N", displays just like a regular "n" that has been placed in a superscript. ISO 10646 defines4318 the NFKC normalization scheme to convert all these into a standard form as well, and GCC warns if your code4319 is not in NFKC if you use -Wnormalized=nfkc. This warning is comparable to warning about every identifier4320 that contains the letter O because it might be confused with the digit 0, and so is not the default, but4321 may be useful as a local coding convention if the programming environment cannot be fixed to display these4322 characters distinctly.4323 -Wno-attribute-warning4324 Do not warn about usage of functions declared with "warning" attribute. By default, this warning is4325 enabled. -Wno-attribute-warning can be used to disable the warning or -Wno-error=attribute-warning can be4326 used to disable the error when compiled with -Werror flag.4327 -Wno-deprecated4328 Do not warn about usage of deprecated features.4329 -Wno-deprecated-declarations4330 Do not warn about uses of functions, variables, and types marked as deprecated by using the "deprecated"4331 attribute.4332 -Wno-overflow4333 Do not warn about compile-time overflow in constant expressions.4334 -Wno-odr4335 Warn about One Definition Rule violations during link-time optimization. Enabled by default.4336 -Wopenmp-simd4337 Warn if the vectorizer cost model overrides the OpenMP simd directive set by user. The4338 -fsimd-cost-model=unlimited option can be used to relax the cost model.4339 -Woverride-init (C and Objective-C only)4340 Warn if an initialized field without side effects is overridden when using designated initializers.4341 This warning is included in -Wextra. To get other -Wextra warnings without this one, use -Wextra4342 -Wno-override-init.4343 -Wno-override-init-side-effects (C and Objective-C only)4344 Do not warn if an initialized field with side effects is overridden when using designated initializers.4345 This warning is enabled by default.4346 -Wpacked4347 Warn if a structure is given the packed attribute, but the packed attribute has no effect on the layout or4348 size of the structure. Such structures may be mis-aligned for little benefit. For instance, in this code,4349 the variable "f.x" in "struct bar" is misaligned even though "struct bar" does not itself have the packed4350 attribute:4351 struct foo {4352 int x;4353 char a, b, c, d;4354 } __attribute__((packed));4355 struct bar {4356 char z;4357 struct foo f;4358 };4359 -Wnopacked-bitfield-compat4360 The 4.1, 4.2 and 4.3 series of GCC ignore the "packed" attribute on bit-fields of type "char". This was4361 fixed in GCC 4.4 but the change can lead to differences in the structure layout. GCC informs you when the4362 offset of such a field has changed in GCC 4.4. For example there is no longer a 4-bit padding between4363 field "a" and "b" in this structure:4364 struct foo4365 {4366 char a:4;4367 char b:8;4368 } __attribute__ ((packed));4369 This warning is enabled by default. Use -Wno-packed-bitfield-compat to disable this warning.4370 -Wpacked-not-aligned (C, C++, Objective-C and Objective-C++ only)4371 Warn if a structure field with explicitly specified alignment in a packed struct or union is misaligned.4372 For example, a warning will be issued on "struct S", like, "warning: alignment 1 of 'struct S' is less than4373 8", in this code:4374 struct __attribute__ ((aligned (8))) S8 { char a[8]; };4375 struct __attribute__ ((packed)) S {4376 struct S8 s8;4377 };4378 This warning is enabled by -Wall.4379 -Wpadded4380 Warn if padding is included in a structure, either to align an element of the structure or to align the4381 whole structure. Sometimes when this happens it is possible to rearrange the fields of the structure to4382 reduce the padding and so make the structure smaller.4383 -Wredundant-decls4384 Warn if anything is declared more than once in the same scope, even in cases where multiple declaration is4385 valid and changes nothing.4386 -Wrestrict4387 Warn when an object referenced by a "restrict"-qualified parameter (or, in C++, a "__restrict"-qualified4388 parameter) is aliased by another argument, or when copies between such objects overlap. For example, the4389 call to the "strcpy" function below attempts to truncate the string by replacing its initial characters4390 with the last four. However, because the call writes the terminating NUL into "a[4]", the copies overlap4391 and the call is diagnosed.4392 void foo (void)4393 {4394 char a[] = "abcd1234";4395 strcpy (a, a + 4);4396 ...4397 }4398 The -Wrestrict option detects some instances of simple overlap even without optimization but works best at4399 -O2 and above. It is included in -Wall.4400 -Wnested-externs (C and Objective-C only)4401 Warn if an "extern" declaration is encountered within a function.4402 -Winline4403 Warn if a function that is declared as inline cannot be inlined. Even with this option, the compiler does4404 not warn about failures to inline functions declared in system headers.4405 The compiler uses a variety of heuristics to determine whether or not to inline a function. For example,4406 the compiler takes into account the size of the function being inlined and the amount of inlining that has4407 already been done in the current function. Therefore, seemingly insignificant changes in the source4408 program can cause the warnings produced by -Winline to appear or disappear.4409 -Wint-in-bool-context4410 Warn for suspicious use of integer values where boolean values are expected, such as conditional4411 expressions (?:) using non-boolean integer constants in boolean context, like "if (a <= b ? 2 : 3)". Or4412 left shifting of signed integers in boolean context, like "for (a = 0; 1 << a; a++);". Likewise for all4413 kinds of multiplications regardless of the data type. This warning is enabled by -Wall.4414 -Wno-int-to-pointer-cast4415 Suppress warnings from casts to pointer type of an integer of a different size. In C++, casting to a4416 pointer type of smaller size is an error. Wint-to-pointer-cast is enabled by default.4417 -Wno-pointer-to-int-cast (C and Objective-C only)4418 Suppress warnings from casts from a pointer to an integer type of a different size.4419 -Winvalid-pch4420 Warn if a precompiled header is found in the search path but cannot be used.4421 -Wlong-long4422 Warn if "long long" type is used. This is enabled by either -Wpedantic or -Wtraditional in ISO C90 and4423 C++98 modes. To inhibit the warning messages, use -Wno-long-long.4424 -Wvariadic-macros4425 Warn if variadic macros are used in ISO C90 mode, or if the GNU alternate syntax is used in ISO C99 mode.4426 This is enabled by either -Wpedantic or -Wtraditional. To inhibit the warning messages, use4427 -Wno-variadic-macros.4428 -Wno-varargs4429 Do not warn upon questionable usage of the macros used to handle variable arguments like "va_start". These4430 warnings are enabled by default.4431 -Wvector-operation-performance4432 Warn if vector operation is not implemented via SIMD capabilities of the architecture. Mainly useful for4433 the performance tuning. Vector operation can be implemented "piecewise", which means that the scalar4434 operation is performed on every vector element; "in parallel", which means that the vector operation is4435 implemented using scalars of wider type, which normally is more performance efficient; and "as a single4436 scalar", which means that vector fits into a scalar type.4437 -Wvla4438 Warn if a variable-length array is used in the code. -Wno-vla prevents the -Wpedantic warning of the4439 variable-length array.4440 -Wvla-larger-than=byte-size4441 If this option is used, the compiler warns for declarations of variable-length arrays whose size is either4442 unbounded, or bounded by an argument that allows the array size to exceed byte-size bytes. This is similar4443 to how -Walloca-larger-than=byte-size works, but with variable-length arrays.4444 Note that GCC may optimize small variable-length arrays of a known value into plain arrays, so this warning4445 may not get triggered for such arrays.4446 -Wvla-larger-than=PTRDIFF_MAX is enabled by default but is typically only effective when -ftree-vrp is4447 active (default for -O2 and above).4448 See also -Walloca-larger-than=byte-size.4449 -Wno-vla-larger-than4450 Disable -Wvla-larger-than= warnings. The option is equivalent to -Wvla-larger-than=SIZE_MAX or larger.4451 -Wvla-parameter4452 Warn about redeclarations of functions involving arguments of Variable Length Array types of inconsistent4453 kinds or forms, and enable the detection of out-of-bounds accesses to such parameters by warnings such as4454 -Warray-bounds.4455 If the first function declaration uses the VLA form the bound specified in the array is assumed to be the4456 minimum number of elements expected to be provided in calls to the function and the maximum number of4457 elements accessed by it. Failing to provide arguments of sufficient size or accessing more than the4458 maximum number of elements may be diagnosed.4459 For example, the warning triggers for the following redeclarations because the first one allows an array of4460 any size to be passed to "f" while the second one specifies that the array argument must have at least "n"4461 elements. In addition, calling "f" with the assotiated VLA bound parameter in excess of the actual VLA4462 bound triggers a warning as well.4463 void f (int n, int[n]);4464 void f (int, int[]); // warning: argument 2 previously declared as a VLA4465 void g (int n)4466 {4467 if (n > 4)4468 return;4469 int a[n];4470 f (sizeof a, a); // warning: access to a by f may be out of bounds4471 ...4472 }4473 -Wvla-parameter is included in -Wall. The -Warray-parameter option triggers warnings for similar problems4474 involving ordinary array arguments.4475 -Wvolatile-register-var4476 Warn if a register variable is declared volatile. The volatile modifier does not inhibit all optimizations4477 that may eliminate reads and/or writes to register variables. This warning is enabled by -Wall.4478 -Wdisabled-optimization4479 Warn if a requested optimization pass is disabled. This warning does not generally indicate that there is4480 anything wrong with your code; it merely indicates that GCC's optimizers are unable to handle the code4481 effectively. Often, the problem is that your code is too big or too complex; GCC refuses to optimize4482 programs when the optimization itself is likely to take inordinate amounts of time.4483 -Wpointer-sign (C and Objective-C only)4484 Warn for pointer argument passing or assignment with different signedness. This option is only supported4485 for C and Objective-C. It is implied by -Wall and by -Wpedantic, which can be disabled with4486 -Wno-pointer-sign.4487 -Wstack-protector4488 This option is only active when -fstack-protector is active. It warns about functions that are not4489 protected against stack smashing.4490 -Woverlength-strings4491 Warn about string constants that are longer than the "minimum maximum" length specified in the C standard.4492 Modern compilers generally allow string constants that are much longer than the standard's minimum limit,4493 but very portable programs should avoid using longer strings.4494 The limit applies after string constant concatenation, and does not count the trailing NUL. In C90, the4495 limit was 509 characters; in C99, it was raised to 4095. C++98 does not specify a normative minimum4496 maximum, so we do not diagnose overlength strings in C++.4497 This option is implied by -Wpedantic, and can be disabled with -Wno-overlength-strings.4498 -Wunsuffixed-float-constants (C and Objective-C only)4499 Issue a warning for any floating constant that does not have a suffix. When used together with4500 -Wsystem-headers it warns about such constants in system header files. This can be useful when preparing4501 code to use with the "FLOAT_CONST_DECIMAL64" pragma from the decimal floating-point extension to C99.4502 -Wno-lto-type-mismatch4503 During the link-time optimization, do not warn about type mismatches in global declarations from different4504 compilation units. Requires -flto to be enabled. Enabled by default.4505 -Wno-designated-init (C and Objective-C only)4506 Suppress warnings when a positional initializer is used to initialize a structure that has been marked with4507 the "designated_init" attribute.4508 Options That Control Static Analysis4509 -fanalyzer4510 This option enables an static analysis of program flow which looks for "interesting" interprocedural paths4511 through the code, and issues warnings for problems found on them.4512 This analysis is much more expensive than other GCC warnings.4513 Enabling this option effectively enables the following warnings:4514 -Wanalyzer-double-fclose -Wanalyzer-double-free -Wanalyzer-exposure-through-output-file4515 -Wanalyzer-file-leak -Wanalyzer-free-of-non-heap -Wanalyzer-malloc-leak -Wanalyzer-mismatching-deallocation4516 -Wanalyzer-possible-null-argument -Wanalyzer-possible-null-dereference -Wanalyzer-null-argument4517 -Wanalyzer-null-dereference -Wanalyzer-shift-count-negative -Wanalyzer-shift-count-overflow4518 -Wanalyzer-stale-setjmp-buffer -Wanalyzer-tainted-array-index -Wanalyzer-unsafe-call-within-signal-handler4519 -Wanalyzer-use-after-free -Wanalyzer-use-of-pointer-in-stale-stack-frame -Wanalyzer-write-to-const4520 -Wanalyzer-write-to-string-literal4521 This option is only available if GCC was configured with analyzer support enabled.4522 -Wanalyzer-too-complex4523 If -fanalyzer is enabled, the analyzer uses various heuristics to attempt to explore the control flow and4524 data flow in the program, but these can be defeated by sufficiently complicated code.4525 By default, the analysis silently stops if the code is too complicated for the analyzer to fully explore4526 and it reaches an internal limit. The -Wanalyzer-too-complex option warns if this occurs.4527 -Wno-analyzer-double-fclose4528 This warning requires -fanalyzer, which enables it; use -Wno-analyzer-double-fclose to disable it.4529 This diagnostic warns for paths through the code in which a "FILE *" can have "fclose" called on it more4530 than once.4531 -Wno-analyzer-double-free4532 This warning requires -fanalyzer, which enables it; use -Wno-analyzer-double-free to disable it.4533 This diagnostic warns for paths through the code in which a pointer can have a deallocator called on it4534 more than once, either "free", or a deallocator referenced by attribute "malloc".4535 -Wno-analyzer-exposure-through-output-file4536 This warning requires -fanalyzer, which enables it; use -Wno-analyzer-exposure-through-output-file to4537 disable it.4538 This diagnostic warns for paths through the code in which a security-sensitive value is written to an4539 output file (such as writing a password to a log file).4540 -Wno-analyzer-file-leak4541 This warning requires -fanalyzer, which enables it; use -Wno-analyzer-file-leak to disable it.4542 This diagnostic warns for paths through the code in which a "<stdio.h>" "FILE *" stream object is leaked.4543 -Wno-analyzer-free-of-non-heap4544 This warning requires -fanalyzer, which enables it; use -Wno-analyzer-free-of-non-heap to disable it.4545 This diagnostic warns for paths through the code in which "free" is called on a non-heap pointer (e.g. an4546 on-stack buffer, or a global).4547 -Wno-analyzer-malloc-leak4548 This warning requires -fanalyzer, which enables it; use -Wno-analyzer-malloc-leak to disable it.4549 This diagnostic warns for paths through the code in which a pointer allocated via an allocator is leaked:4550 either "malloc", or a function marked with attribute "malloc".4551 -Wno-analyzer-mismatching-deallocation4552 This warning requires -fanalyzer, which enables it; use -Wno-analyzer-mismatching-deallocation to disable4553 it.4554 This diagnostic warns for paths through the code in which the wrong deallocation function is called on a4555 pointer value, based on which function was used to allocate the pointer value. The diagnostic will warn4556 about mismatches between "free", scalar "delete" and vector "delete[]", and those marked as4557 allocator/deallocator pairs using attribute "malloc".4558 -Wno-analyzer-possible-null-argument4559 This warning requires -fanalyzer, which enables it; use -Wno-analyzer-possible-null-argument to disable it.4560 This diagnostic warns for paths through the code in which a possibly-NULL value is passed to a function4561 argument marked with "__attribute__((nonnull))" as requiring a non-NULL value.4562 -Wno-analyzer-possible-null-dereference4563 This warning requires -fanalyzer, which enables it; use -Wno-analyzer-possible-null-dereference to disable4564 it.4565 This diagnostic warns for paths through the code in which a possibly-NULL value is dereferenced.4566 -Wno-analyzer-null-argument4567 This warning requires -fanalyzer, which enables it; use -Wno-analyzer-null-argument to disable it.4568 This diagnostic warns for paths through the code in which a value known to be NULL is passed to a function4569 argument marked with "__attribute__((nonnull))" as requiring a non-NULL value.4570 -Wno-analyzer-null-dereference4571 This warning requires -fanalyzer, which enables it; use -Wno-analyzer-null-dereference to disable it.4572 This diagnostic warns for paths through the code in which a value known to be NULL is dereferenced.4573 -Wno-analyzer-shift-count-negative4574 This warning requires -fanalyzer, which enables it; use -Wno-analyzer-shift-count-negative to disable it.4575 This diagnostic warns for paths through the code in which a shift is attempted with a negative count. It4576 is analogous to the -Wshift-count-negative diagnostic implemented in the C/C++ front ends, but is4577 implemented based on analyzing interprocedural paths, rather than merely parsing the syntax tree. However,4578 the analyzer does not prioritize detection of such paths, so false negatives are more likely relative to4579 other warnings.4580 -Wno-analyzer-shift-count-overflow4581 This warning requires -fanalyzer, which enables it; use -Wno-analyzer-shift-count-overflow to disable it.4582 This diagnostic warns for paths through the code in which a shift is attempted with a count greater than or4583 equal to the precision of the operand's type. It is analogous to the -Wshift-count-overflow diagnostic4584 implemented in the C/C++ front ends, but is implemented based on analyzing interprocedural paths, rather4585 than merely parsing the syntax tree. However, the analyzer does not prioritize detection of such paths, so4586 false negatives are more likely relative to other warnings.4587 -Wno-analyzer-stale-setjmp-buffer4588 This warning requires -fanalyzer, which enables it; use -Wno-analyzer-stale-setjmp-buffer to disable it.4589 This diagnostic warns for paths through the code in which "longjmp" is called to rewind to a "jmp_buf"4590 relating to a "setjmp" call in a function that has returned.4591 When "setjmp" is called on a "jmp_buf" to record a rewind location, it records the stack frame. The stack4592 frame becomes invalid when the function containing the "setjmp" call returns. Attempting to rewind to it4593 via "longjmp" would reference a stack frame that no longer exists, and likely lead to a crash (or worse).4594 -Wno-analyzer-tainted-array-index4595 This warning requires both -fanalyzer and -fanalyzer-checker=taint to enable it; use4596 -Wno-analyzer-tainted-array-index to disable it.4597 This diagnostic warns for paths through the code in which a value that could be under an attacker's control4598 is used as the index of an array access without being sanitized.4599 -Wno-analyzer-unsafe-call-within-signal-handler4600 This warning requires -fanalyzer, which enables it; use -Wno-analyzer-unsafe-call-within-signal-handler to4601 disable it.4602 This diagnostic warns for paths through the code in which a function known to be async-signal-unsafe (such4603 as "fprintf") is called from a signal handler.4604 -Wno-analyzer-use-after-free4605 This warning requires -fanalyzer, which enables it; use -Wno-analyzer-use-after-free to disable it.4606 This diagnostic warns for paths through the code in which a pointer is used after a deallocator is called4607 on it: either "free", or a deallocator referenced by attribute "malloc".4608 -Wno-analyzer-use-of-pointer-in-stale-stack-frame4609 This warning requires -fanalyzer, which enables it; use -Wno-analyzer-use-of-pointer-in-stale-stack-frame4610 to disable it.4611 This diagnostic warns for paths through the code in which a pointer is dereferenced that points to a4612 variable in a stale stack frame.4613 -Wno-analyzer-write-to-const4614 This warning requires -fanalyzer, which enables it; use -Wno-analyzer-write-to-const to disable it.4615 This diagnostic warns for paths through the code in which the analyzer detects an attempt to write through4616 a pointer to a "const" object. However, the analyzer does not prioritize detection of such paths, so false4617 negatives are more likely relative to other warnings.4618 -Wno-analyzer-write-to-string-literal4619 This warning requires -fanalyzer, which enables it; use -Wno-analyzer-write-to-string-literal to disable4620 it.4621 This diagnostic warns for paths through the code in which the analyzer detects an attempt to write through4622 a pointer to a string literal. However, the analyzer does not prioritize detection of such paths, so false4623 negatives are more likely relative to other warnings.4624 Pertinent parameters for controlling the exploration are: --param analyzer-bb-explosion-factor=value, --param4625 analyzer-max-enodes-per-program-point=value, --param analyzer-max-recursion-depth=value, and --param4626 analyzer-min-snodes-for-call-summary=value.4627 The following options control the analyzer.4628 -fanalyzer-call-summaries4629 Simplify interprocedural analysis by computing the effect of certain calls, rather than exploring all paths4630 through the function from callsite to each possible return.4631 If enabled, call summaries are only used for functions with more than one call site, and that are4632 sufficiently complicated (as per --param analyzer-min-snodes-for-call-summary=value).4633 -fanalyzer-checker=name4634 Restrict the analyzer to run just the named checker, and enable it.4635 Some checkers are disabled by default (even with -fanalyzer), such as the "taint" checker that implements4636 -Wanalyzer-tainted-array-index, and this option is required to enable them.4637 -fno-analyzer-feasibility4638 This option is intended for analyzer developers.4639 By default the analyzer verifies that there is a feasible control flow path for each diagnostic it emits:4640 that the conditions that hold are not mutually exclusive. Diagnostics for which no feasible path can be4641 found are rejected. This filtering can be suppressed with -fno-analyzer-feasibility, for debugging issues4642 in this code.4643 -fanalyzer-fine-grained4644 This option is intended for analyzer developers.4645 Internally the analyzer builds an "exploded graph" that combines control flow graphs with data flow4646 information.4647 By default, an edge in this graph can contain the effects of a run of multiple statements within a basic4648 block. With -fanalyzer-fine-grained, each statement gets its own edge.4649 -fanalyzer-show-duplicate-count4650 This option is intended for analyzer developers: if multiple diagnostics have been detected as being4651 duplicates of each other, it emits a note when reporting the best diagnostic, giving the number of4652 additional diagnostics that were suppressed by the deduplication logic.4653 -fno-analyzer-state-merge4654 This option is intended for analyzer developers.4655 By default the analyzer attempts to simplify analysis by merging sufficiently similar states at each4656 program point as it builds its "exploded graph". With -fno-analyzer-state-merge this merging can be4657 suppressed, for debugging state-handling issues.4658 -fno-analyzer-state-purge4659 This option is intended for analyzer developers.4660 By default the analyzer attempts to simplify analysis by purging aspects of state at a program point that4661 appear to no longer be relevant e.g. the values of locals that aren't accessed later in the function and4662 which aren't relevant to leak analysis.4663 With -fno-analyzer-state-purge this purging of state can be suppressed, for debugging state-handling4664 issues.4665 -fanalyzer-transitivity4666 This option enables transitivity of constraints within the analyzer.4667 -fanalyzer-verbose-edges4668 This option is intended for analyzer developers. It enables more verbose, lower-level detail in the4669 descriptions of control flow within diagnostic paths.4670 -fanalyzer-verbose-state-changes4671 This option is intended for analyzer developers. It enables more verbose, lower-level detail in the4672 descriptions of events relating to state machines within diagnostic paths.4673 -fanalyzer-verbosity=level4674 This option controls the complexity of the control flow paths that are emitted for analyzer diagnostics.4675 The level can be one of:4676 0 At this level, interprocedural call and return events are displayed, along with the most pertinent4677 state-change events relating to a diagnostic. For example, for a double-"free" diagnostic, both calls4678 to "free" will be shown.4679 1 As per the previous level, but also show events for the entry to each function.4680 2 As per the previous level, but also show events relating to control flow that are significant to4681 triggering the issue (e.g. "true path taken" at a conditional).4682 This level is the default.4683 3 As per the previous level, but show all control flow events, not just significant ones.4684 4 This level is intended for analyzer developers; it adds various other events intended for debugging the4685 analyzer.4686 -fdump-analyzer4687 Dump internal details about what the analyzer is doing to file.analyzer.txt. This option is overridden by4688 -fdump-analyzer-stderr.4689 -fdump-analyzer-stderr4690 Dump internal details about what the analyzer is doing to stderr. This option overrides -fdump-analyzer.4691 -fdump-analyzer-callgraph4692 Dump a representation of the call graph suitable for viewing with GraphViz to file.callgraph.dot.4693 -fdump-analyzer-exploded-graph4694 Dump a representation of the "exploded graph" suitable for viewing with GraphViz to file.eg.dot. Nodes are4695 color-coded based on state-machine states to emphasize state changes.4696 -fdump-analyzer-exploded-nodes4697 Emit diagnostics showing where nodes in the "exploded graph" are in relation to the program source.4698 -fdump-analyzer-exploded-nodes-24699 Dump a textual representation of the "exploded graph" to file.eg.txt.4700 -fdump-analyzer-exploded-nodes-34701 Dump a textual representation of the "exploded graph" to one dump file per node, to file.eg-id.txt. This4702 is typically a large number of dump files.4703 -fdump-analyzer-feasibility4704 Dump internal details about the analyzer's search for feasible paths. The details are written in a form4705 suitable for viewing with GraphViz to filenames of the form file.*.fg.dot and file.*.tg.dot.4706 -fdump-analyzer-json4707 Dump a compressed JSON representation of analyzer internals to file.analyzer.json.gz. The precise format4708 is subject to change.4709 -fdump-analyzer-state-purge4710 As per -fdump-analyzer-supergraph, dump a representation of the "supergraph" suitable for viewing with4711 GraphViz, but annotate the graph with information on what state will be purged at each node. The graph is4712 written to file.state-purge.dot.4713 -fdump-analyzer-supergraph4714 Dump representations of the "supergraph" suitable for viewing with GraphViz to file.supergraph.dot and to4715 file.supergraph-eg.dot. These show all of the control flow graphs in the program, with interprocedural4716 edges for calls and returns. The second dump contains annotations showing nodes in the "exploded graph"4717 and diagnostics associated with them.4718 Options for Debugging Your Program4719 To tell GCC to emit extra information for use by a debugger, in almost all cases you need only to add -g to4720 your other options.4721 GCC allows you to use -g with -O. The shortcuts taken by optimized code may occasionally be surprising: some4722 variables you declared may not exist at all; flow of control may briefly move where you did not expect it; some4723 statements may not be executed because they compute constant results or their values are already at hand; some4724 statements may execute in different places because they have been moved out of loops. Nevertheless it is4725 possible to debug optimized output. This makes it reasonable to use the optimizer for programs that might have4726 bugs.4727 If you are not using some other optimization option, consider using -Og with -g. With no -O option at all,4728 some compiler passes that collect information useful for debugging do not run at all, so that -Og may result in4729 a better debugging experience.4730 -g Produce debugging information in the operating system's native format (stabs, COFF, XCOFF, or DWARF). GDB4731 can work with this debugging information.4732 On most systems that use stabs format, -g enables use of extra debugging information that only GDB can use;4733 this extra information makes debugging work better in GDB but probably makes other debuggers crash or4734 refuse to read the program. If you want to control for certain whether to generate the extra information,4735 use -gstabs+, -gstabs, -gxcoff+, -gxcoff, or -gvms (see below).4736 -ggdb4737 Produce debugging information for use by GDB. This means to use the most expressive format available4738 (DWARF, stabs, or the native format if neither of those are supported), including GDB extensions if at all4739 possible.4740 -gdwarf4741 -gdwarf-version4742 Produce debugging information in DWARF format (if that is supported). The value of version may be either4743 2, 3, 4 or 5; the default version for most targets is 5 (with the exception of VxWorks, TPF and Darwin/Mac4744 OS X, which default to version 2, and AIX, which defaults to version 4).4745 Note that with DWARF Version 2, some ports require and always use some non-conflicting DWARF 3 extensions4746 in the unwind tables.4747 Version 4 may require GDB 7.0 and -fvar-tracking-assignments for maximum benefit. Version 5 requires GDB4748 8.0 or higher.4749 GCC no longer supports DWARF Version 1, which is substantially different than Version 2 and later. For4750 historical reasons, some other DWARF-related options such as -fno-dwarf2-cfi-asm) retain a reference to4751 DWARF Version 2 in their names, but apply to all currently-supported versions of DWARF.4752 -gstabs4753 Produce debugging information in stabs format (if that is supported), without GDB extensions. This is the4754 format used by DBX on most BSD systems. On MIPS, Alpha and System V Release 4 systems this option produces4755 stabs debugging output that is not understood by DBX. On System V Release 4 systems this option requires4756 the GNU assembler.4757 -gstabs+4758 Produce debugging information in stabs format (if that is supported), using GNU extensions understood only4759 by the GNU debugger (GDB). The use of these extensions is likely to make other debuggers crash or refuse4760 to read the program.4761 -gxcoff4762 Produce debugging information in XCOFF format (if that is supported). This is the format used by the DBX4763 debugger on IBM RS/6000 systems.4764 -gxcoff+4765 Produce debugging information in XCOFF format (if that is supported), using GNU extensions understood only4766 by the GNU debugger (GDB). The use of these extensions is likely to make other debuggers crash or refuse4767 to read the program, and may cause assemblers other than the GNU assembler (GAS) to fail with an error.4768 -gvms4769 Produce debugging information in Alpha/VMS debug format (if that is supported). This is the format used by4770 DEBUG on Alpha/VMS systems.4771 -glevel4772 -ggdblevel4773 -gstabslevel4774 -gxcofflevel4775 -gvmslevel4776 Request debugging information and also use level to specify how much information. The default level is 2.4777 Level 0 produces no debug information at all. Thus, -g0 negates -g.4778 Level 1 produces minimal information, enough for making backtraces in parts of the program that you don't4779 plan to debug. This includes descriptions of functions and external variables, and line number tables, but4780 no information about local variables.4781 Level 3 includes extra information, such as all the macro definitions present in the program. Some4782 debuggers support macro expansion when you use -g3.4783 If you use multiple -g options, with or without level numbers, the last such option is the one that is4784 effective.4785 -gdwarf does not accept a concatenated debug level, to avoid confusion with -gdwarf-level. Instead use an4786 additional -glevel option to change the debug level for DWARF.4787 -fno-eliminate-unused-debug-symbols4788 By default, no debug information is produced for symbols that are not actually used. Use this option if you4789 want debug information for all symbols.4790 -femit-class-debug-always4791 Instead of emitting debugging information for a C++ class in only one object file, emit it in all object4792 files using the class. This option should be used only with debuggers that are unable to handle the way4793 GCC normally emits debugging information for classes because using this option increases the size of4794 debugging information by as much as a factor of two.4795 -fno-merge-debug-strings4796 Direct the linker to not merge together strings in the debugging information that are identical in4797 different object files. Merging is not supported by all assemblers or linkers. Merging decreases the size4798 of the debug information in the output file at the cost of increasing link processing time. Merging is4799 enabled by default.4800 -fdebug-prefix-map=old=new4801 When compiling files residing in directory old, record debugging information describing them as if the4802 files resided in directory new instead. This can be used to replace a build-time path with an install-time4803 path in the debug info. It can also be used to change an absolute path to a relative path by using . for4804 new. This can give more reproducible builds, which are location independent, but may require an extra4805 command to tell GDB where to find the source files. See also -ffile-prefix-map.4806 -fvar-tracking4807 Run variable tracking pass. It computes where variables are stored at each position in code. Better4808 debugging information is then generated (if the debugging information format supports this information).4809 It is enabled by default when compiling with optimization (-Os, -O, -O2, ...), debugging information (-g)4810 and the debug info format supports it.4811 -fvar-tracking-assignments4812 Annotate assignments to user variables early in the compilation and attempt to carry the annotations over4813 throughout the compilation all the way to the end, in an attempt to improve debug information while4814 optimizing. Use of -gdwarf-4 is recommended along with it.4815 It can be enabled even if var-tracking is disabled, in which case annotations are created and maintained,4816 but discarded at the end. By default, this flag is enabled together with -fvar-tracking, except when4817 selective scheduling is enabled.4818 -gsplit-dwarf4819 If DWARF debugging information is enabled, separate as much debugging information as possible into a4820 separate output file with the extension .dwo. This option allows the build system to avoid linking files4821 with debug information. To be useful, this option requires a debugger capable of reading .dwo files.4822 -gdwarf324823 -gdwarf644824 If DWARF debugging information is enabled, the -gdwarf32 selects the 32-bit DWARF format and the -gdwarf644825 selects the 64-bit DWARF format. The default is target specific, on most targets it is -gdwarf32 though.4826 The 32-bit DWARF format is smaller, but can't support more than 2GiB of debug information in any of the4827 DWARF debug information sections. The 64-bit DWARF format allows larger debug information and might not be4828 well supported by all consumers yet.4829 -gdescribe-dies4830 Add description attributes to some DWARF DIEs that have no name attribute, such as artificial variables,4831 external references and call site parameter DIEs.4832 -gpubnames4833 Generate DWARF ".debug_pubnames" and ".debug_pubtypes" sections.4834 -ggnu-pubnames4835 Generate ".debug_pubnames" and ".debug_pubtypes" sections in a format suitable for conversion into a GDB4836 index. This option is only useful with a linker that can produce GDB index version 7.4837 -fdebug-types-section4838 When using DWARF Version 4 or higher, type DIEs can be put into their own ".debug_types" section instead of4839 making them part of the ".debug_info" section. It is more efficient to put them in a separate comdat4840 section since the linker can then remove duplicates. But not all DWARF consumers support ".debug_types"4841 sections yet and on some objects ".debug_types" produces larger instead of smaller debugging information.4842 -grecord-gcc-switches4843 -gno-record-gcc-switches4844 This switch causes the command-line options used to invoke the compiler that may affect code generation to4845 be appended to the DW_AT_producer attribute in DWARF debugging information. The options are concatenated4846 with spaces separating them from each other and from the compiler version. It is enabled by default. See4847 also -frecord-gcc-switches for another way of storing compiler options into the object file.4848 -gstrict-dwarf4849 Disallow using extensions of later DWARF standard version than selected with -gdwarf-version. On most4850 targets using non-conflicting DWARF extensions from later standard versions is allowed.4851 -gno-strict-dwarf4852 Allow using extensions of later DWARF standard version than selected with -gdwarf-version.4853 -gas-loc-support4854 Inform the compiler that the assembler supports ".loc" directives. It may then use them for the assembler4855 to generate DWARF2+ line number tables.4856 This is generally desirable, because assembler-generated line-number tables are a lot more compact than4857 those the compiler can generate itself.4858 This option will be enabled by default if, at GCC configure time, the assembler was found to support such4859 directives.4860 -gno-as-loc-support4861 Force GCC to generate DWARF2+ line number tables internally, if DWARF2+ line number tables are to be4862 generated.4863 -gas-locview-support4864 Inform the compiler that the assembler supports "view" assignment and reset assertion checking in ".loc"4865 directives.4866 This option will be enabled by default if, at GCC configure time, the assembler was found to support them.4867 -gno-as-locview-support4868 Force GCC to assign view numbers internally, if -gvariable-location-views are explicitly requested.4869 -gcolumn-info4870 -gno-column-info4871 Emit location column information into DWARF debugging information, rather than just file and line. This4872 option is enabled by default.4873 -gstatement-frontiers4874 -gno-statement-frontiers4875 This option causes GCC to create markers in the internal representation at the beginning of statements, and4876 to keep them roughly in place throughout compilation, using them to guide the output of "is_stmt" markers4877 in the line number table. This is enabled by default when compiling with optimization (-Os, -O, -O2, ...),4878 and outputting DWARF 2 debug information at the normal level.4879 -gvariable-location-views4880 -gvariable-location-views=incompat54881 -gno-variable-location-views4882 Augment variable location lists with progressive view numbers implied from the line number table. This4883 enables debug information consumers to inspect state at certain points of the program, even if no4884 instructions associated with the corresponding source locations are present at that point. If the4885 assembler lacks support for view numbers in line number tables, this will cause the compiler to emit the4886 line number table, which generally makes them somewhat less compact. The augmented line number tables and4887 location lists are fully backward-compatible, so they can be consumed by debug information consumers that4888 are not aware of these augmentations, but they won't derive any benefit from them either.4889 This is enabled by default when outputting DWARF 2 debug information at the normal level, as long as there4890 is assembler support, -fvar-tracking-assignments is enabled and -gstrict-dwarf is not. When assembler4891 support is not available, this may still be enabled, but it will force GCC to output internal line number4892 tables, and if -ginternal-reset-location-views is not enabled, that will most certainly lead to silently4893 mismatching location views.4894 There is a proposed representation for view numbers that is not backward compatible with the location list4895 format introduced in DWARF 5, that can be enabled with -gvariable-location-views=incompat5. This option4896 may be removed in the future, is only provided as a reference implementation of the proposed4897 representation. Debug information consumers are not expected to support this extended format, and they4898 would be rendered unable to decode location lists using it.4899 -ginternal-reset-location-views4900 -gno-internal-reset-location-views4901 Attempt to determine location views that can be omitted from location view lists. This requires the4902 compiler to have very accurate insn length estimates, which isn't always the case, and it may cause4903 incorrect view lists to be generated silently when using an assembler that does not support location view4904 lists. The GNU assembler will flag any such error as a "view number mismatch". This is only enabled on4905 ports that define a reliable estimation function.4906 -ginline-points4907 -gno-inline-points4908 Generate extended debug information for inlined functions. Location view tracking markers are inserted at4909 inlined entry points, so that address and view numbers can be computed and output in debug information.4910 This can be enabled independently of location views, in which case the view numbers won't be output, but it4911 can only be enabled along with statement frontiers, and it is only enabled by default if location views are4912 enabled.4913 -gz[=type]4914 Produce compressed debug sections in DWARF format, if that is supported. If type is not given, the default4915 type depends on the capabilities of the assembler and linker used. type may be one of none (don't compress4916 debug sections), zlib (use zlib compression in ELF gABI format), or zlib-gnu (use zlib compression in4917 traditional GNU format). If the linker doesn't support writing compressed debug sections, the option is4918 rejected. Otherwise, if the assembler does not support them, -gz is silently ignored when producing object4919 files.4920 -femit-struct-debug-baseonly4921 Emit debug information for struct-like types only when the base name of the compilation source file matches4922 the base name of file in which the struct is defined.4923 This option substantially reduces the size of debugging information, but at significant potential loss in4924 type information to the debugger. See -femit-struct-debug-reduced for a less aggressive option. See4925 -femit-struct-debug-detailed for more detailed control.4926 This option works only with DWARF debug output.4927 -femit-struct-debug-reduced4928 Emit debug information for struct-like types only when the base name of the compilation source file matches4929 the base name of file in which the type is defined, unless the struct is a template or defined in a system4930 header.4931 This option significantly reduces the size of debugging information, with some potential loss in type4932 information to the debugger. See -femit-struct-debug-baseonly for a more aggressive option. See4933 -femit-struct-debug-detailed for more detailed control.4934 This option works only with DWARF debug output.4935 -femit-struct-debug-detailed[=spec-list]4936 Specify the struct-like types for which the compiler generates debug information. The intent is to reduce4937 duplicate struct debug information between different object files within the same program.4938 This option is a detailed version of -femit-struct-debug-reduced and -femit-struct-debug-baseonly, which4939 serves for most needs.4940 A specification has the syntax[dir:|ind:][ord:|gen:](any|sys|base|none)4941 The optional first word limits the specification to structs that are used directly (dir:) or used4942 indirectly (ind:). A struct type is used directly when it is the type of a variable, member. Indirect4943 uses arise through pointers to structs. That is, when use of an incomplete struct is valid, the use is4944 indirect. An example is struct one direct; struct two * indirect;.4945 The optional second word limits the specification to ordinary structs (ord:) or generic structs (gen:).4946 Generic structs are a bit complicated to explain. For C++, these are non-explicit specializations of4947 template classes, or non-template classes within the above. Other programming languages have generics, but4948 -femit-struct-debug-detailed does not yet implement them.4949 The third word specifies the source files for those structs for which the compiler should emit debug4950 information. The values none and any have the normal meaning. The value base means that the base of name4951 of the file in which the type declaration appears must match the base of the name of the main compilation4952 file. In practice, this means that when compiling foo.c, debug information is generated for types declared4953 in that file and foo.h, but not other header files. The value sys means those types satisfying base or4954 declared in system or compiler headers.4955 You may need to experiment to determine the best settings for your application.4956 The default is -femit-struct-debug-detailed=all.4957 This option works only with DWARF debug output.4958 -fno-dwarf2-cfi-asm4959 Emit DWARF unwind info as compiler generated ".eh_frame" section instead of using GAS ".cfi_*" directives.4960 -fno-eliminate-unused-debug-types4961 Normally, when producing DWARF output, GCC avoids producing debug symbol output for types that are nowhere4962 used in the source file being compiled. Sometimes it is useful to have GCC emit debugging information for4963 all types declared in a compilation unit, regardless of whether or not they are actually used in that4964 compilation unit, for example if, in the debugger, you want to cast a value to a type that is not actually4965 used in your program (but is declared). More often, however, this results in a significant amount of4966 wasted space.4967 Options That Control Optimization4968 These options control various sorts of optimizations.4969 Without any optimization option, the compiler's goal is to reduce the cost of compilation and to make debugging4970 produce the expected results. Statements are independent: if you stop the program with a breakpoint between4971 statements, you can then assign a new value to any variable or change the program counter to any other4972 statement in the function and get exactly the results you expect from the source code.4973 Turning on optimization flags makes the compiler attempt to improve the performance and/or code size at the4974 expense of compilation time and possibly the ability to debug the program.4975 The compiler performs optimization based on the knowledge it has of the program. Compiling multiple files at4976 once to a single output file mode allows the compiler to use information gained from all of the files when4977 compiling each of them.4978 Not all optimizations are controlled directly by a flag. Only optimizations that have a flag are listed in4979 this section.4980 Most optimizations are completely disabled at -O0 or if an -O level is not set on the command line, even if4981 individual optimization flags are specified. Similarly, -Og suppresses many optimization passes.4982 Depending on the target and how GCC was configured, a slightly different set of optimizations may be enabled at4983 each -O level than those listed here. You can invoke GCC with -Q --help=optimizers to find out the exact set4984 of optimizations that are enabled at each level.4985 -O4986 -O1 Optimize. Optimizing compilation takes somewhat more time, and a lot more memory for a large function.4987 With -O, the compiler tries to reduce code size and execution time, without performing any optimizations4988 that take a great deal of compilation time.4989 -O turns on the following optimization flags:4990 -fauto-inc-dec -fbranch-count-reg -fcombine-stack-adjustments -fcompare-elim -fcprop-registers -fdce4991 -fdefer-pop -fdelayed-branch -fdse -fforward-propagate -fguess-branch-probability -fif-conversion4992 -fif-conversion2 -finline-functions-called-once -fipa-modref -fipa-profile -fipa-pure-const -fipa-reference4993 -fipa-reference-addressable -fmerge-constants -fmove-loop-invariants -fomit-frame-pointer -freorder-blocks4994 -fshrink-wrap -fshrink-wrap-separate -fsplit-wide-types -fssa-backprop -fssa-phiopt -ftree-bit-ccp4995 -ftree-ccp -ftree-ch -ftree-coalesce-vars -ftree-copy-prop -ftree-dce -ftree-dominator-opts -ftree-dse4996 -ftree-forwprop -ftree-fre -ftree-phiprop -ftree-pta -ftree-scev-cprop -ftree-sink -ftree-slsr -ftree-sra4997 -ftree-ter -funit-at-a-time4998 -O2 Optimize even more. GCC performs nearly all supported optimizations that do not involve a space-speed4999 tradeoff. As compared to -O, this option increases both compilation time and the performance of the5000 generated code.5001 -O2 turns on all optimization flags specified by -O. It also turns on the following optimization flags:5002 -falign-functions -falign-jumps -falign-labels -falign-loops -fcaller-saves -fcode-hoisting5003 -fcrossjumping -fcse-follow-jumps -fcse-skip-blocks -fdelete-null-pointer-checks -fdevirtualize5004 -fdevirtualize-speculatively -fexpensive-optimizations -ffinite-loops -fgcse -fgcse-lm5005 -fhoist-adjacent-loads -finline-functions -finline-small-functions -findirect-inlining -fipa-bit-cp5006 -fipa-cp -fipa-icf -fipa-ra -fipa-sra -fipa-vrp -fisolate-erroneous-paths-dereference -flra-remat5007 -foptimize-sibling-calls -foptimize-strlen -fpartial-inlining -fpeephole2 -freorder-blocks-algorithm=stc5008 -freorder-blocks-and-partition -freorder-functions -frerun-cse-after-loop -fschedule-insns5009 -fschedule-insns2 -fsched-interblock -fsched-spec -fstore-merging -fstrict-aliasing -fthread-jumps5010 -ftree-builtin-call-dce -ftree-pre -ftree-switch-conversion -ftree-tail-merge -ftree-vrp5011 Please note the warning under -fgcse about invoking -O2 on programs that use computed gotos.5012 NOTE: In Ubuntu 8.10 and later versions, -D_FORTIFY_SOURCE=2 is set by default, and is activated when -O is5013 set to 2 or higher. This enables additional compile-time and run-time checks for several libc functions.5014 To disable, specify either -U_FORTIFY_SOURCE or -D_FORTIFY_SOURCE=0.5015 -O3 Optimize yet more. -O3 turns on all optimizations specified by -O2 and also turns on the following5016 optimization flags:5017 -fgcse-after-reload -fipa-cp-clone -floop-interchange -floop-unroll-and-jam -fpeel-loops5018 -fpredictive-commoning -fsplit-loops -fsplit-paths -ftree-loop-distribution -ftree-loop-vectorize5019 -ftree-partial-pre -ftree-slp-vectorize -funswitch-loops -fvect-cost-model -fvect-cost-model=dynamic5020 -fversion-loops-for-strides5021 -O0 Reduce compilation time and make debugging produce the expected results. This is the default.5022 -Os Optimize for size. -Os enables all -O2 optimizations except those that often increase code size:5023 -falign-functions -falign-jumps -falign-labels -falign-loops -fprefetch-loop-arrays5024 -freorder-blocks-algorithm=stc5025 It also enables -finline-functions, causes the compiler to tune for code size rather than execution speed,5026 and performs further optimizations designed to reduce code size.5027 -Ofast5028 Disregard strict standards compliance. -Ofast enables all -O3 optimizations. It also enables5029 optimizations that are not valid for all standard-compliant programs. It turns on -ffast-math,5030 -fallow-store-data-races and the Fortran-specific -fstack-arrays, unless -fmax-stack-var-size is specified,5031 and -fno-protect-parens.5032 -Og Optimize debugging experience. -Og should be the optimization level of choice for the standard edit-5033 compile-debug cycle, offering a reasonable level of optimization while maintaining fast compilation and a5034 good debugging experience. It is a better choice than -O0 for producing debuggable code because some5035 compiler passes that collect debug information are disabled at -O0.5036 Like -O0, -Og completely disables a number of optimization passes so that individual options controlling5037 them have no effect. Otherwise -Og enables all -O1 optimization flags except for those that may interfere5038 with debugging:5039 -fbranch-count-reg -fdelayed-branch -fdse -fif-conversion -fif-conversion25040 -finline-functions-called-once -fmove-loop-invariants -fssa-phiopt -ftree-bit-ccp -ftree-dse -ftree-pta5041 -ftree-sra5042 If you use multiple -O options, with or without level numbers, the last such option is the one that is5043 effective.5044 Options of the form -fflag specify machine-independent flags. Most flags have both positive and negative5045 forms; the negative form of -ffoo is -fno-foo. In the table below, only one of the forms is listed---the one5046 you typically use. You can figure out the other form by either removing no- or adding it.5047 The following options control specific optimizations. They are either activated by -O options or are related5048 to ones that are. You can use the following flags in the rare cases when "fine-tuning" of optimizations to be5049 performed is desired.5050 -fno-defer-pop5051 For machines that must pop arguments after a function call, always pop the arguments as soon as each5052 function returns. At levels -O1 and higher, -fdefer-pop is the default; this allows the compiler to let5053 arguments accumulate on the stack for several function calls and pop them all at once.5054 -fforward-propagate5055 Perform a forward propagation pass on RTL. The pass tries to combine two instructions and checks if the5056 result can be simplified. If loop unrolling is active, two passes are performed and the second is5057 scheduled after loop unrolling.5058 This option is enabled by default at optimization levels -O, -O2, -O3, -Os.5059 -ffp-contract=style5060 -ffp-contract=off disables floating-point expression contraction. -ffp-contract=fast enables floating-5061 point expression contraction such as forming of fused multiply-add operations if the target has native5062 support for them. -ffp-contract=on enables floating-point expression contraction if allowed by the5063 language standard. This is currently not implemented and treated equal to -ffp-contract=off.5064 The default is -ffp-contract=fast.5065 -fomit-frame-pointer5066 Omit the frame pointer in functions that don't need one. This avoids the instructions to save, set up and5067 restore the frame pointer; on many targets it also makes an extra register available.5068 On some targets this flag has no effect because the standard calling sequence always uses a frame pointer,5069 so it cannot be omitted.5070 Note that -fno-omit-frame-pointer doesn't guarantee the frame pointer is used in all functions. Several5071 targets always omit the frame pointer in leaf functions.5072 Enabled by default at -O and higher.5073 -foptimize-sibling-calls5074 Optimize sibling and tail recursive calls.5075 Enabled at levels -O2, -O3, -Os.5076 -foptimize-strlen5077 Optimize various standard C string functions (e.g. "strlen", "strchr" or "strcpy") and their5078 "_FORTIFY_SOURCE" counterparts into faster alternatives.5079 Enabled at levels -O2, -O3.5080 -fno-inline5081 Do not expand any functions inline apart from those marked with the "always_inline" attribute. This is the5082 default when not optimizing.5083 Single functions can be exempted from inlining by marking them with the "noinline" attribute.5084 -finline-small-functions5085 Integrate functions into their callers when their body is smaller than expected function call code (so5086 overall size of program gets smaller). The compiler heuristically decides which functions are simple5087 enough to be worth integrating in this way. This inlining applies to all functions, even those not5088 declared inline.5089 Enabled at levels -O2, -O3, -Os.5090 -findirect-inlining5091 Inline also indirect calls that are discovered to be known at compile time thanks to previous inlining.5092 This option has any effect only when inlining itself is turned on by the -finline-functions or5093 -finline-small-functions options.5094 Enabled at levels -O2, -O3, -Os.5095 -finline-functions5096 Consider all functions for inlining, even if they are not declared inline. The compiler heuristically5097 decides which functions are worth integrating in this way.5098 If all calls to a given function are integrated, and the function is declared "static", then the function5099 is normally not output as assembler code in its own right.5100 Enabled at levels -O2, -O3, -Os. Also enabled by -fprofile-use and -fauto-profile.5101 -finline-functions-called-once5102 Consider all "static" functions called once for inlining into their caller even if they are not marked5103 "inline". If a call to a given function is integrated, then the function is not output as assembler code5104 in its own right.5105 Enabled at levels -O1, -O2, -O3 and -Os, but not -Og.5106 -fearly-inlining5107 Inline functions marked by "always_inline" and functions whose body seems smaller than the function call5108 overhead early before doing -fprofile-generate instrumentation and real inlining pass. Doing so makes5109 profiling significantly cheaper and usually inlining faster on programs having large chains of nested5110 wrapper functions.5111 Enabled by default.5112 -fipa-sra5113 Perform interprocedural scalar replacement of aggregates, removal of unused parameters and replacement of5114 parameters passed by reference by parameters passed by value.5115 Enabled at levels -O2, -O3 and -Os.5116 -finline-limit=n5117 By default, GCC limits the size of functions that can be inlined. This flag allows coarse control of this5118 limit. n is the size of functions that can be inlined in number of pseudo instructions.5119 Inlining is actually controlled by a number of parameters, which may be specified individually by using5120 --param name=value. The -finline-limit=n option sets some of these parameters as follows:5121 max-inline-insns-single5122 is set to n/2.5123 max-inline-insns-auto5124 is set to n/2.5125 See below for a documentation of the individual parameters controlling inlining and for the defaults of5126 these parameters.5127 Note: there may be no value to -finline-limit that results in default behavior.5128 Note: pseudo instruction represents, in this particular context, an abstract measurement of function's5129 size. In no way does it represent a count of assembly instructions and as such its exact meaning might5130 change from one release to an another.5131 -fno-keep-inline-dllexport5132 This is a more fine-grained version of -fkeep-inline-functions, which applies only to functions that are5133 declared using the "dllexport" attribute or declspec.5134 -fkeep-inline-functions5135 In C, emit "static" functions that are declared "inline" into the object file, even if the function has5136 been inlined into all of its callers. This switch does not affect functions using the "extern inline"5137 extension in GNU C90. In C++, emit any and all inline functions into the object file.5138 -fkeep-static-functions5139 Emit "static" functions into the object file, even if the function is never used.5140 -fkeep-static-consts5141 Emit variables declared "static const" when optimization isn't turned on, even if the variables aren't5142 referenced.5143 GCC enables this option by default. If you want to force the compiler to check if a variable is5144 referenced, regardless of whether or not optimization is turned on, use the -fno-keep-static-consts option.5145 -fmerge-constants5146 Attempt to merge identical constants (string constants and floating-point constants) across compilation5147 units.5148 This option is the default for optimized compilation if the assembler and linker support it. Use5149 -fno-merge-constants to inhibit this behavior.5150 Enabled at levels -O, -O2, -O3, -Os.5151 -fmerge-all-constants5152 Attempt to merge identical constants and identical variables.5153 This option implies -fmerge-constants. In addition to -fmerge-constants this considers e.g. even constant5154 initialized arrays or initialized constant variables with integral or floating-point types. Languages like5155 C or C++ require each variable, including multiple instances of the same variable in recursive calls, to5156 have distinct locations, so using this option results in non-conforming behavior.5157 -fmodulo-sched5158 Perform swing modulo scheduling immediately before the first scheduling pass. This pass looks at innermost5159 loops and reorders their instructions by overlapping different iterations.5160 -fmodulo-sched-allow-regmoves5161 Perform more aggressive SMS-based modulo scheduling with register moves allowed. By setting this flag5162 certain anti-dependences edges are deleted, which triggers the generation of reg-moves based on the life-5163 range analysis. This option is effective only with -fmodulo-sched enabled.5164 -fno-branch-count-reg5165 Disable the optimization pass that scans for opportunities to use "decrement and branch" instructions on a5166 count register instead of instruction sequences that decrement a register, compare it against zero, and5167 then branch based upon the result. This option is only meaningful on architectures that support such5168 instructions, which include x86, PowerPC, IA-64 and S/390. Note that the -fno-branch-count-reg option5169 doesn't remove the decrement and branch instructions from the generated instruction stream introduced by5170 other optimization passes.5171 The default is -fbranch-count-reg at -O1 and higher, except for -Og.5172 -fno-function-cse5173 Do not put function addresses in registers; make each instruction that calls a constant function contain5174 the function's address explicitly.5175 This option results in less efficient code, but some strange hacks that alter the assembler output may be5176 confused by the optimizations performed when this option is not used.5177 The default is -ffunction-cse5178 -fno-zero-initialized-in-bss5179 If the target supports a BSS section, GCC by default puts variables that are initialized to zero into BSS.5180 This can save space in the resulting code.5181 This option turns off this behavior because some programs explicitly rely on variables going to the data5182 section---e.g., so that the resulting executable can find the beginning of that section and/or make5183 assumptions based on that.5184 The default is -fzero-initialized-in-bss.5185 -fthread-jumps5186 Perform optimizations that check to see if a jump branches to a location where another comparison subsumed5187 by the first is found. If so, the first branch is redirected to either the destination of the second5188 branch or a point immediately following it, depending on whether the condition is known to be true or5189 false.5190 Enabled at levels -O2, -O3, -Os.5191 -fsplit-wide-types5192 When using a type that occupies multiple registers, such as "long long" on a 32-bit system, split the5193 registers apart and allocate them independently. This normally generates better code for those types, but5194 may make debugging more difficult.5195 Enabled at levels -O, -O2, -O3, -Os.5196 -fsplit-wide-types-early5197 Fully split wide types early, instead of very late. This option has no effect unless -fsplit-wide-types is5198 turned on.5199 This is the default on some targets.5200 -fcse-follow-jumps5201 In common subexpression elimination (CSE), scan through jump instructions when the target of the jump is5202 not reached by any other path. For example, when CSE encounters an "if" statement with an "else" clause,5203 CSE follows the jump when the condition tested is false.5204 Enabled at levels -O2, -O3, -Os.5205 -fcse-skip-blocks5206 This is similar to -fcse-follow-jumps, but causes CSE to follow jumps that conditionally skip over blocks.5207 When CSE encounters a simple "if" statement with no else clause, -fcse-skip-blocks causes CSE to follow the5208 jump around the body of the "if".5209 Enabled at levels -O2, -O3, -Os.5210 -frerun-cse-after-loop5211 Re-run common subexpression elimination after loop optimizations are performed.5212 Enabled at levels -O2, -O3, -Os.5213 -fgcse5214 Perform a global common subexpression elimination pass. This pass also performs global constant and copy5215 propagation.5216 Note: When compiling a program using computed gotos, a GCC extension, you may get better run-time5217 performance if you disable the global common subexpression elimination pass by adding -fno-gcse to the5218 command line.5219 Enabled at levels -O2, -O3, -Os.5220 -fgcse-lm5221 When -fgcse-lm is enabled, global common subexpression elimination attempts to move loads that are only5222 killed by stores into themselves. This allows a loop containing a load/store sequence to be changed to a5223 load outside the loop, and a copy/store within the loop.5224 Enabled by default when -fgcse is enabled.5225 -fgcse-sm5226 When -fgcse-sm is enabled, a store motion pass is run after global common subexpression elimination. This5227 pass attempts to move stores out of loops. When used in conjunction with -fgcse-lm, loops containing a5228 load/store sequence can be changed to a load before the loop and a store after the loop.5229 Not enabled at any optimization level.5230 -fgcse-las5231 When -fgcse-las is enabled, the global common subexpression elimination pass eliminates redundant loads5232 that come after stores to the same memory location (both partial and full redundancies).5233 Not enabled at any optimization level.5234 -fgcse-after-reload5235 When -fgcse-after-reload is enabled, a redundant load elimination pass is performed after reload. The5236 purpose of this pass is to clean up redundant spilling.5237 Enabled by -fprofile-use and -fauto-profile.5238 -faggressive-loop-optimizations5239 This option tells the loop optimizer to use language constraints to derive bounds for the number of5240 iterations of a loop. This assumes that loop code does not invoke undefined behavior by for example5241 causing signed integer overflows or out-of-bound array accesses. The bounds for the number of iterations5242 of a loop are used to guide loop unrolling and peeling and loop exit test optimizations. This option is5243 enabled by default.5244 -funconstrained-commons5245 This option tells the compiler that variables declared in common blocks (e.g. Fortran) may later be5246 overridden with longer trailing arrays. This prevents certain optimizations that depend on knowing the5247 array bounds.5248 -fcrossjumping5249 Perform cross-jumping transformation. This transformation unifies equivalent code and saves code size.5250 The resulting code may or may not perform better than without cross-jumping.5251 Enabled at levels -O2, -O3, -Os.5252 -fauto-inc-dec5253 Combine increments or decrements of addresses with memory accesses. This pass is always skipped on5254 architectures that do not have instructions to support this. Enabled by default at -O and higher on5255 architectures that support this.5256 -fdce5257 Perform dead code elimination (DCE) on RTL. Enabled by default at -O and higher.5258 -fdse5259 Perform dead store elimination (DSE) on RTL. Enabled by default at -O and higher.5260 -fif-conversion5261 Attempt to transform conditional jumps into branch-less equivalents. This includes use of conditional5262 moves, min, max, set flags and abs instructions, and some tricks doable by standard arithmetics. The use5263 of conditional execution on chips where it is available is controlled by -fif-conversion2.5264 Enabled at levels -O, -O2, -O3, -Os, but not with -Og.5265 -fif-conversion25266 Use conditional execution (where available) to transform conditional jumps into branch-less equivalents.5267 Enabled at levels -O, -O2, -O3, -Os, but not with -Og.5268 -fdeclone-ctor-dtor5269 The C++ ABI requires multiple entry points for constructors and destructors: one for a base subobject, one5270 for a complete object, and one for a virtual destructor that calls operator delete afterwards. For a5271 hierarchy with virtual bases, the base and complete variants are clones, which means two copies of the5272 function. With this option, the base and complete variants are changed to be thunks that call a common5273 implementation.5274 Enabled by -Os.5275 -fdelete-null-pointer-checks5276 Assume that programs cannot safely dereference null pointers, and that no code or data element resides at5277 address zero. This option enables simple constant folding optimizations at all optimization levels. In5278 addition, other optimization passes in GCC use this flag to control global dataflow analyses that eliminate5279 useless checks for null pointers; these assume that a memory access to address zero always results in a5280 trap, so that if a pointer is checked after it has already been dereferenced, it cannot be null.5281 Note however that in some environments this assumption is not true. Use -fno-delete-null-pointer-checks to5282 disable this optimization for programs that depend on that behavior.5283 This option is enabled by default on most targets. On Nios II ELF, it defaults to off. On AVR, CR16, and5284 MSP430, this option is completely disabled.5285 Passes that use the dataflow information are enabled independently at different optimization levels.5286 -fdevirtualize5287 Attempt to convert calls to virtual functions to direct calls. This is done both within a procedure and5288 interprocedurally as part of indirect inlining (-findirect-inlining) and interprocedural constant
版权声明:
本站文章均来自互联网搜集,如有侵犯您的权益,请联系我们删除,谢谢。
标签: #rt3290驱动ubuntu #windows不能在本地启动sqlserver 3417 #ubuntu1204310