* [COMMITTED, obvious] Sort warning options in c-family/c.opt.
@ 2024-01-23 0:26 Sandra Loosemore
2024-01-23 0:26 ` [COMMITTED] Correct lists of options enabled by -Wall and -Wextra [PR90463] Sandra Loosemore
0 siblings, 1 reply; 2+ messages in thread
From: Sandra Loosemore @ 2024-01-23 0:26 UTC (permalink / raw)
To: gcc-patches
In spite of the plea "Please try to keep this file in ASCII collating
order" at the top of the file, the sorting of the entries for the
various -Wfoo options had increased in entropy. This made it hard to
correlate them against e.g. the list of options enabled by -Wall in
the manual (see PR90463). This patch is at least a step in the right
direction to restore order to the file.
I confirmed that no lines were added or removed by these changes, and
that the output of "gcc -Q --help=warnings" is unchanged both with or
without -Wall added to the command.
gcc/c-family/ChangeLog
* c.opt: Improve sorting of warning options.
---
gcc/c-family/c.opt | 488 ++++++++++++++++++++++-----------------------
1 file changed, 244 insertions(+), 244 deletions(-)
diff --git a/gcc/c-family/c.opt b/gcc/c-family/c.opt
index 314bd17004f..9c0a28092fc 100644
--- a/gcc/c-family/c.opt
+++ b/gcc/c-family/c.opt
@@ -303,6 +303,10 @@ Waddress
C ObjC C++ ObjC++ Var(warn_address) Warning LangEnabledBy(C ObjC C++ ObjC++,Wall)
Warn about suspicious uses of memory addresses.
+Waddress-of-packed-member
+C ObjC C++ ObjC++ Var(warn_address_of_packed_member) Init(1) Warning
+Warn when the address of packed member of struct or union is taken.
+
Enum
Name(warn_aligned_new_level) Type(int) UnknownError(argument %qs to %<-Waligned-new%> not recognized)
@@ -358,6 +362,10 @@ Wno-alloca-larger-than
C ObjC C++ LTO ObjC++ Alias(Walloca-larger-than=,18446744073709551615EiB,none) Warning
Disable Walloca-larger-than= warning. Equivalent to Walloca-larger-than=<SIZE_MAX> or larger.
+Warith-conversion
+C ObjC C++ ObjC++ Var(warn_arith_conv) Warning
+Warn if conversion of the result of arithmetic might change the value even though converting the operands cannot.
+
Warray-bounds=
LangEnabledBy(C ObjC C++ LTO ObjC++,Wall,1,0)
; in common.opt
@@ -374,10 +382,6 @@ Warray-parameter=
C ObjC C++ ObjC++ Joined RejectNegative UInteger Var(warn_array_parameter) IntegerRange(0, 2) LangEnabledBy(C ObjC C++ ObjC++,Wall, 2, 0) Warning
Warn about mismatched declarations of array parameters and unsafe accesses to them.
-Wzero-length-bounds
-C ObjC C++ ObjC++ Var(warn_zero_length_bounds) Warning LangEnabledBy(C ObjC C++ ObjC++,Wall)
-Warn about accesses to interior zero-length array members.
-
Wassign-intercept
ObjC ObjC++ Var(warn_assign_intercept) Warning
Warn whenever an Objective-C assignment is being intercepted by the garbage collector.
@@ -421,10 +425,6 @@ Wbool-operation
C ObjC C++ ObjC++ Var(warn_bool_op) Warning LangEnabledBy(C ObjC C++ ObjC++,Wall)
Warn about certain operations on boolean expressions.
-Wframe-address
-C ObjC C++ ObjC++ Var(warn_frame_address) Warning LangEnabledBy(C ObjC C++ ObjC++,Wall)
-Warn when __builtin_frame_address or __builtin_return_address is used unsafely.
-
Wbuiltin-declaration-mismatch
C ObjC C++ ObjC++ Var(warn_builtin_declaration_mismatch) Init(1) Warning
Warn when a built-in function is declared with the wrong signature.
@@ -534,6 +534,14 @@ Wchkp
C ObjC C++ ObjC++ Warning WarnRemoved
Removed in GCC 9. This switch has no effect.
+Wclass-conversion
+C++ ObjC++ Var(warn_class_conversion) Init(1) Warning
+Warn when a conversion function will never be called due to the type it converts to.
+
+Wclass-memaccess
+C++ ObjC++ Var(warn_class_memaccess) Warning LangEnabledBy(C++ ObjC++, Wall)
+Warn for unsafe raw memory writes to objects of class types.
+
Wclobbered
C ObjC C++ ObjC++ Var(warn_clobbered) Warning EnabledBy(Wextra)
Warn about variables that might be changed by \"longjmp\" or \"vfork\".
@@ -650,6 +658,14 @@ Wdiv-by-zero
C ObjC C++ ObjC++ Var(warn_div_by_zero) Init(1) Warning
Warn about compile-time integer division by zero.
+Wdouble-promotion
+C ObjC C++ ObjC++ Var(warn_double_promotion) Warning
+Warn about implicit conversions from \"float\" to \"double\".
+
+Wduplicate-decl-specifier
+C ObjC Var(warn_duplicate_decl_specifier) Warning LangEnabledBy(C ObjC,Wall)
+Warn when a declaration has duplicate const, volatile, restrict or _Atomic specifier.
+
Wduplicated-branches
C ObjC C++ ObjC++ Var(warn_duplicated_branches) Init(0) Warning
Warn about duplicated branches in if-else statements.
@@ -662,6 +678,10 @@ Weffc++
C++ ObjC++ Var(warn_ecpp) Warning
Warn about violations of Effective C++ style rules.
+Welaborated-enum-base
+C++ ObjC++ Var(warn_elaborated_enum_base) Warning Init(1)
+Warn if an additional enum-base is used in an elaborated-type-specifier.
+
Wempty-body
C ObjC C++ ObjC++ Var(warn_empty_body) Warning EnabledBy(Wextra)
Warn about an empty body in an if or else statement.
@@ -694,6 +714,10 @@ Wexceptions
C++ ObjC++ Var(warn_exceptions) Init(1) Warning
Warn when an exception handler is shadowed by another handler.
+Wexpansion-to-defined
+C ObjC C++ ObjC++ CPP(warn_expansion_to_defined) CppReason(CPP_W_EXPANSION_TO_DEFINED) Var(cpp_warn_expansion_to_defined) Init(0) Warning EnabledBy(Wextra || Wpedantic)
+Warn if \"defined\" is used outside #if.
+
Wextra
C ObjC C++ ObjC++ Warning
; in common.opt
@@ -702,6 +726,11 @@ Wextra-semi
C++ ObjC++ Var(warn_extra_semi) Warning
Warn about semicolon after in-class function definition.
+Wflex-array-member-not-at-end
+C C++ Var(warn_flex_array_member_not_at_end) Warning
+Warn when a structure containing a C99 flexible array member as the last
+field is not at the end of another structure.
+
Wfloat-conversion
C ObjC C++ ObjC++ Var(warn_float_conversion) Warning LangEnabledBy(C ObjC C++ ObjC++,Wconversion)
Warn for implicit type conversions that cause loss of floating point precision.
@@ -735,6 +764,11 @@ C ObjC C++ LTO ObjC++ Warning Alias(Wformat-overflow=, 1, 0) IntegerRange(0, 2)
Warn about function calls with format strings that write past the end
of the destination region. Same as -Wformat-overflow=1.
+Wformat-overflow=
+C ObjC C++ LTO ObjC++ Joined RejectNegative UInteger Var(warn_format_overflow) Warning LangEnabledBy(C ObjC C++ LTO ObjC++,Wformat=, warn_format >= 1, 0) IntegerRange(0, 2)
+Warn about function calls with format strings that write past the end
+of the destination region.
+
Wformat-security
C ObjC C++ ObjC++ Var(warn_format_security) Warning LangEnabledBy(C ObjC C++ ObjC++,Wformat=, warn_format >= 2, 0)
Warn about possible security problems with format functions.
@@ -748,6 +782,10 @@ C ObjC C++ LTO ObjC++ Warning Alias(Wformat-truncation=, 1, 0)
Warn about calls to snprintf and similar functions that truncate output.
Same as -Wformat-truncation=1.
+Wformat-truncation=
+C ObjC C++ LTO ObjC++ Joined RejectNegative UInteger Var(warn_format_trunc) Warning LangEnabledBy(C ObjC C++ LTO ObjC++,Wformat=, warn_format >= 1, 0) IntegerRange(0, 2)
+Warn about calls to snprintf and similar functions that truncate output.
+
Wformat-y2k
C ObjC C++ ObjC++ Var(warn_format_y2k) Warning LangEnabledBy(C ObjC C++ ObjC++,Wformat=,warn_format >= 2, 0)
Warn about strftime formats yielding 2-digit years.
@@ -760,19 +798,9 @@ Wformat=
C ObjC C++ ObjC++ Joined RejectNegative UInteger Var(warn_format) Warning LangEnabledBy(C ObjC C++ ObjC++,Wall, 1, 0) IntegerRange(0, 2)
Warn about printf/scanf/strftime/strfmon format string anomalies.
-Wformat-overflow=
-C ObjC C++ LTO ObjC++ Joined RejectNegative UInteger Var(warn_format_overflow) Warning LangEnabledBy(C ObjC C++ LTO ObjC++,Wformat=, warn_format >= 1, 0) IntegerRange(0, 2)
-Warn about function calls with format strings that write past the end
-of the destination region.
-
-Wformat-truncation=
-C ObjC C++ LTO ObjC++ Joined RejectNegative UInteger Var(warn_format_trunc) Warning LangEnabledBy(C ObjC C++ LTO ObjC++,Wformat=, warn_format >= 1, 0) IntegerRange(0, 2)
-Warn about calls to snprintf and similar functions that truncate output.
-
-Wflex-array-member-not-at-end
-C C++ Var(warn_flex_array_member_not_at_end) Warning
-Warn when a structure containing a C99 flexible array member as the last
-field is not at the end of another structure.
+Wframe-address
+C ObjC C++ ObjC++ Var(warn_frame_address) Warning LangEnabledBy(C ObjC C++ ObjC++,Wall)
+Warn when __builtin_frame_address or __builtin_return_address is used unsafely.
Wif-not-aligned
C ObjC C++ ObjC++ Var(warn_if_not_aligned) Init(1) Warning
@@ -786,6 +814,25 @@ Wignored-attributes
C C++ Var(warn_ignored_attributes) Init(1) Warning
Warn whenever attributes are ignored.
+Wimplicit
+C ObjC Var(warn_implicit) Warning LangEnabledBy(C ObjC,Wall)
+Warn about implicit declarations.
+
+Wimplicit-fallthrough=
+LangEnabledBy(C ObjC C++ ObjC++,Wextra,3,0)
+; in common.opt
+
+Wimplicit-function-declaration
+C ObjC Var(warn_implicit_function_declaration) Init(-1) Warning LangEnabledBy(C ObjC,Wimplicit)
+Warn about implicit function declarations.
+
+Wimplicit-int
+C ObjC Var(warn_implicit_int) Init(-1) Warning LangEnabledBy(C ObjC,Wimplicit)
+Warn when a declaration does not specify a type.
+
+Wimport
+C ObjC C++ ObjC++ Undocumented Ignore
+
Winaccessible-base
C++ ObjC++ Var(warn_inaccessible_base) Init(1) Warning
Warn when a base is inaccessible in derived due to ambiguity.
@@ -798,10 +845,6 @@ Winfinite-recursion
C ObjC C++ LTO ObjC++ Var(warn_infinite_recursion) Warning LangEnabledBy(C ObjC C++ LTO ObjC++, Wall)
Warn for infinitely recursive calls.
-Waddress-of-packed-member
-C ObjC C++ ObjC++ Var(warn_address_of_packed_member) Init(1) Warning
-Warn when the address of packed member of struct or union is taken.
-
Winit-self
C ObjC C++ ObjC++ Var(warn_init_self) Warning LangEnabledBy(C++ ObjC++,Wall)
Warn about variables which are initialized to themselves.
@@ -815,33 +858,6 @@ C++ ObjC++ Var(warn_interference_size) Warning Init(1)
Warn about nonsensical values of --param destructive-interference-size or
constructive-interference-size.
-Wimplicit
-C ObjC Var(warn_implicit) Warning LangEnabledBy(C ObjC,Wall)
-Warn about implicit declarations.
-
-Wimplicit-fallthrough=
-LangEnabledBy(C ObjC C++ ObjC++,Wextra,3,0)
-; in common.opt
-
-Wdouble-promotion
-C ObjC C++ ObjC++ Var(warn_double_promotion) Warning
-Warn about implicit conversions from \"float\" to \"double\".
-
-Wexpansion-to-defined
-C ObjC C++ ObjC++ CPP(warn_expansion_to_defined) CppReason(CPP_W_EXPANSION_TO_DEFINED) Var(cpp_warn_expansion_to_defined) Init(0) Warning EnabledBy(Wextra || Wpedantic)
-Warn if \"defined\" is used outside #if.
-
-Wimplicit-function-declaration
-C ObjC Var(warn_implicit_function_declaration) Init(-1) Warning LangEnabledBy(C ObjC,Wimplicit)
-Warn about implicit function declarations.
-
-Wimplicit-int
-C ObjC Var(warn_implicit_int) Init(-1) Warning LangEnabledBy(C ObjC,Wimplicit)
-Warn when a declaration does not specify a type.
-
-Wimport
-C ObjC C++ ObjC++ Undocumented Ignore
-
Winherited-variadic-ctor
C++ ObjC++ Var(warn_inh_var_ctor) Init(1) Warning
Warn about C++11 inheriting constructors when the base has a variadic constructor.
@@ -882,14 +898,14 @@ Wliteral-suffix
C++ ObjC++ CPP(warn_literal_suffix) CppReason(CPP_W_LITERAL_SUFFIX) Var(cpp_warn_literal_suffix) Init(1) Warning
Warn when a string or character literal is followed by a ud-suffix which does not begin with an underscore.
-Wlogical-op
-C ObjC C++ ObjC++ Var(warn_logical_op) Init(0) Warning
-Warn when a logical operator is suspiciously always evaluating to true or false.
-
Wlogical-not-parentheses
C ObjC C++ ObjC++ Var(warn_logical_not_paren) Warning LangEnabledBy(C ObjC C++ ObjC++,Wall)
Warn when logical not is used on the left hand side operand of a comparison.
+Wlogical-op
+C ObjC C++ ObjC++ Var(warn_logical_op) Init(0) Warning
+Warn when a logical operator is suspiciously always evaluating to true or false.
+
Wlong-long
C ObjC C++ ObjC++ CPP(cpp_warn_long_long) CppReason(CPP_W_LONG_LONG) Var(warn_long_long) Init(-1) Warning LangEnabledBy(C ObjC,Wc90-c99-compat)
Do not warn about using \"long long\" when -pedantic.
@@ -902,14 +918,18 @@ Wmain
LangEnabledBy(C ObjC C++ ObjC++,Wpedantic, 2, 0)
;
-Wmemset-transposed-args
-C ObjC C++ ObjC++ Var(warn_memset_transposed_args) Warning LangEnabledBy(C ObjC C++ ObjC++,Wall)
-Warn about suspicious calls to memset where the third argument is constant literal zero and the second is not.
+Wmaybe-uninitialized
+C ObjC C++ ObjC++ LTO LangEnabledBy(C ObjC C++ ObjC++ LTO,Wall)
+;
Wmemset-elt-size
C ObjC C++ ObjC++ Var(warn_memset_elt_size) Warning LangEnabledBy(C ObjC C++ ObjC++,Wall)
Warn about suspicious calls to memset where the third argument contains the number of elements not multiplied by the element size.
+Wmemset-transposed-args
+C ObjC C++ ObjC++ Var(warn_memset_transposed_args) Warning LangEnabledBy(C ObjC C++ ObjC++,Wall)
+Warn about suspicious calls to memset where the third argument is constant literal zero and the second is not.
+
Wmisleading-indentation
C C++ Common Var(warn_misleading_indentation) Warning LangEnabledBy(C C++,Wall)
Warn when the indentation of the code does not reflect the block structure.
@@ -928,6 +948,11 @@ Wmismatched-tags
C++ ObjC++ Var(warn_mismatched_tags) Warning
Warn when a class is redeclared or referenced using a mismatched class-key.
+Wmissing-attributes
+C ObjC C++ ObjC++ Var(warn_missing_attributes) Warning LangEnabledBy(C ObjC C++ ObjC++,Wall)
+Warn about declarations of entities that may be missing attributes
+that related entities have been declared with.
+
Wmissing-braces
C ObjC C++ ObjC++ Var(warn_missing_braces) Warning LangEnabledBy(C ObjC,Wall)
Warn about possibly missing braces around initializers.
@@ -940,130 +965,6 @@ Wmissing-field-initializers
C ObjC C++ ObjC++ Var(warn_missing_field_initializers) Warning EnabledBy(Wextra)
Warn about missing fields in struct initializers.
-Wmissing-requires
-C++ ObjC++ Var(warn_missing_requires) Init(1) Warning
-Warn about likely missing requires keyword.
-
-Wmissing-template-keyword
-C++ ObjC++ Var(warn_missing_template_keyword) Init(1) Warning
-Warn when the template keyword is missing after a member access token in a dependent member access expression if that member is a template.
-
-Wmultistatement-macros
-C ObjC C++ ObjC++ Var(warn_multistatement_macros) Warning LangEnabledBy(C ObjC C++ ObjC++,Wall)
-Warn about unsafe macros expanding to multiple statements used as a body of a clause such as if, else, while, switch, or for.
-
-Wmultiple-inheritance
-C++ ObjC++ Var(warn_multiple_inheritance) Warning
-Warn on direct multiple inheritance.
-
-Wnamespaces
-C++ ObjC++ Var(warn_namespaces) Warning
-Warn on namespace definition.
-
-Wnrvo
-C++ ObjC++ Var(warn_nrvo)
-Warn if the named return value optimization is not performed although it is allowed.
-
-Wpacked-not-aligned
-C ObjC C++ ObjC++ Var(warn_packed_not_aligned) Warning LangEnabledBy(C ObjC C++ ObjC++,Wall)
-Warn when fields in a struct with the packed attribute are misaligned.
-
-Wrange-loop-construct
-C++ ObjC++ Var(warn_range_loop_construct) Warning LangEnabledBy(C++ ObjC++,Wall)
-Warn when a range-based for-loop is creating unnecessary copies.
-
-Wredundant-tags
-C++ ObjC++ Var(warn_redundant_tags) Warning
-Warn when a class or enumerated type is referenced using a redundant class-key.
-
-Wsized-deallocation
-C++ ObjC++ Var(warn_sized_deallocation) Warning EnabledBy(Wextra)
-Warn about missing sized deallocation functions.
-
-Wsizeof-pointer-div
-C ObjC C++ ObjC++ Var(warn_sizeof_pointer_div) Warning LangEnabledBy(C ObjC C++ ObjC++,Wall)
-Warn about suspicious divisions of two sizeof expressions that don't work correctly with pointers.
-
-Wsizeof-array-div
-C ObjC C++ ObjC++ Var(warn_sizeof_array_div) Warning LangEnabledBy(C ObjC C++ ObjC++,Wall)
-Warn about divisions of two sizeof operators when the first one is applied
-to an array and the divisor does not equal the size of the array element.
-
-Wsizeof-pointer-memaccess
-C ObjC C++ ObjC++ Var(warn_sizeof_pointer_memaccess) Warning LangEnabledBy(C ObjC C++ ObjC++,Wall)
-Warn about suspicious length parameters to certain string functions if the argument uses sizeof.
-
-Wsizeof-array-argument
-C ObjC C++ ObjC++ Var(warn_sizeof_array_argument) Warning Init(1)
-Warn when sizeof is applied on a parameter declared as an array.
-
-Wstring-compare
-C ObjC C++ LTO ObjC++ Warning Var(warn_string_compare) Warning LangEnabledBy(C ObjC C++ ObjC++, Wextra)
-Warn about calls to strcmp and strncmp used in equality expressions that
-are necessarily true or false due to the length of one and size of the other
-argument.
-
-Wstringop-overflow
-C ObjC C++ LTO ObjC++ Warning Alias(Wstringop-overflow=, 2, 0)
-Warn about buffer overflow in string manipulation functions like memcpy
-and strcpy.
-
-Wstringop-overflow=
-C ObjC C++ LTO ObjC++ Joined RejectNegative UInteger Var(warn_stringop_overflow) Init(2) Warning LangEnabledBy(C ObjC C++ LTO ObjC++, Wall, 2, 0) IntegerRange(0, 4)
-Under the control of Object Size type, warn about buffer overflow in string
-manipulation functions like memcpy and strcpy.
-
-Wstringop-overread
-C ObjC C++ LTO ObjC++ Var(warn_stringop_overread) Init(1) Warning LangEnabledBy(C ObjC C++ LTO ObjC++, Wall)
-Warn about reading past the end of a source array in string manipulation functions like memchr and memcpy.
-
-Wstringop-truncation
-C ObjC C++ LTO ObjC++ Var(warn_stringop_truncation) Warning Init (1) LangEnabledBy(C ObjC C++ LTO ObjC++, Wall)
-Warn about truncation in string manipulation functions like strncat and strncpy.
-
-Wstrict-flex-arrays
-C C++ Var(warn_strict_flex_arrays) Warning
-Warn about inproper usages of flexible array members
-according to the level of -fstrict-flex-arrays.
-
-Wsuggest-attribute=format
-C ObjC C++ ObjC++ Var(warn_suggest_attribute_format) Warning
-Warn about functions which might be candidates for format attributes.
-
-Wsuggest-override
-C++ ObjC++ Var(warn_override) Warning
-Suggest that the override keyword be used when the declaration of a virtual
-function overrides another.
-
-Wswitch
-C ObjC C++ ObjC++ Var(warn_switch) Warning LangEnabledBy(C ObjC C++ ObjC++,Wall)
-Warn about enumerated switches, with no default, missing a case.
-
-Wswitch-default
-C ObjC C++ ObjC++ Var(warn_switch_default) Warning
-Warn about enumerated switches missing a \"default:\" statement.
-
-Wswitch-enum
-C ObjC C++ ObjC++ Var(warn_switch_enum) Warning
-Warn about all enumerated switches missing a specific case.
-
-Wswitch-bool
-C ObjC C++ ObjC++ Var(warn_switch_bool) Warning Init(1)
-Warn about switches with boolean controlling expression.
-
-Wswitch-outside-range
-C ObjC C++ ObjC++ Var(warn_switch_outside_range) Warning Init(1)
-Warn about switch values that are outside of the switch's type range.
-
-Wtemplates
-C++ ObjC++ Var(warn_templates) Warning
-Warn on primary template declaration.
-
-Wmissing-attributes
-C ObjC C++ ObjC++ Var(warn_missing_attributes) Warning LangEnabledBy(C ObjC C++ ObjC++,Wall)
-Warn about declarations of entities that may be missing attributes
-that related entities have been declared with.
-
Wmissing-format-attribute
C ObjC C++ ObjC++ Warning Alias(Wsuggest-attribute=format)
;
@@ -1080,6 +981,14 @@ Wmissing-prototypes
C ObjC Var(warn_missing_prototypes) Warning
Warn about global functions without prototypes.
+Wmissing-requires
+C++ ObjC++ Var(warn_missing_requires) Init(1) Warning
+Warn about likely missing requires keyword.
+
+Wmissing-template-keyword
+C++ ObjC++ Var(warn_missing_template_keyword) Init(1) Warning
+Warn when the template keyword is missing after a member access token in a dependent member access expression if that member is a template.
+
Wmissing-variable-declarations
C ObjC Var(warn_missing_variable_declarations) Warning
Warn about global variables without previous declarations.
@@ -1091,6 +1000,18 @@ Wmultichar
C ObjC C++ ObjC++ CPP(warn_multichar) CppReason(CPP_W_MULTICHAR) Var(cpp_warn_multichar) Init(0) Warning
Warn about use of multi-character character constants.
+Wmultiple-inheritance
+C++ ObjC++ Var(warn_multiple_inheritance) Warning
+Warn on direct multiple inheritance.
+
+Wmultistatement-macros
+C ObjC C++ ObjC++ Var(warn_multistatement_macros) Warning LangEnabledBy(C ObjC C++ ObjC++,Wall)
+Warn about unsafe macros expanding to multiple statements used as a body of a clause such as if, else, while, switch, or for.
+
+Wnamespaces
+C++ ObjC++ Var(warn_namespaces) Warning
+Warn on namespace definition.
+
Wnarrowing
C ObjC C++ ObjC++ Warning Var(warn_narrowing) Init(-1) LangEnabledBy(C++ ObjC++,Wall || Wc++11-compat)
Warn about narrowing conversions within { } that are ill-formed in C++11.
@@ -1111,14 +1032,6 @@ Wnon-template-friend
C++ ObjC++ Var(warn_nontemplate_friend) Init(1) Warning
Warn when non-templatized friend functions are declared within a template.
-Wclass-conversion
-C++ ObjC++ Var(warn_class_conversion) Init(1) Warning
-Warn when a conversion function will never be called due to the type it converts to.
-
-Wclass-memaccess
-C++ ObjC++ Var(warn_class_memaccess) Warning LangEnabledBy(C++ ObjC++, Wall)
-Warn for unsafe raw memory writes to objects of class types.
-
Wnon-virtual-dtor
C++ ObjC++ Var(warn_nonvdtor) Warning LangEnabledBy(C++ ObjC++,Weffc++)
Warn about non-virtual destructors.
@@ -1211,10 +1124,18 @@ Woverride-init-side-effects
C ObjC Var(warn_override_init_side_effects) Init(1) Warning
Warn about overriding initializers with side effects.
+Wnrvo
+C++ ObjC++ Var(warn_nrvo)
+Warn if the named return value optimization is not performed although it is allowed.
+
Wpacked-bitfield-compat
C ObjC C++ ObjC++ Var(warn_packed_bitfield_compat) Init(-1) Warning
Warn about packed bit-fields whose offset changed in GCC 4.4.
+Wpacked-not-aligned
+C ObjC C++ ObjC++ Var(warn_packed_not_aligned) Warning LangEnabledBy(C ObjC C++ ObjC++,Wall)
+Warn when fields in a struct with the packed attribute are misaligned.
+
Wparentheses
C ObjC C++ ObjC++ Var(warn_parentheses) Warning LangEnabledBy(C ObjC C++ ObjC++,Wall)
Warn about possibly missing parentheses.
@@ -1227,6 +1148,14 @@ Wpessimizing-move
C++ ObjC++ Var(warn_pessimizing_move) Warning LangEnabledBy(C++ ObjC++, Wall)
Warn about calling std::move on a local object in a return statement preventing copy elision.
+Wplacement-new
+C++ Warning Alias(Wplacement-new=, 1, 0)
+Warn for placement new expressions with undefined behavior.
+
+Wplacement-new=
+C++ Joined RejectNegative UInteger Var(warn_placement_new) Init(-1) Warning IntegerRange(0, 2)
+Warn for placement new expressions with undefined behavior.
+
Wpmf-conversions
C++ ObjC++ Var(warn_pmf2ptr) Init(1) Warning
Warn when converting the type of pointers to member functions.
@@ -1263,13 +1192,9 @@ Wprotocol
ObjC ObjC++ Var(warn_protocol) Init(1) Warning
Warn if inherited methods are unimplemented.
-Wplacement-new
-C++ Warning Alias(Wplacement-new=, 1, 0)
-Warn for placement new expressions with undefined behavior.
-
-Wplacement-new=
-C++ Joined RejectNegative UInteger Var(warn_placement_new) Init(-1) Warning IntegerRange(0, 2)
-Warn for placement new expressions with undefined behavior.
+Wrange-loop-construct
+C++ ObjC++ Var(warn_range_loop_construct) Warning LangEnabledBy(C++ ObjC++,Wall)
+Warn when a range-based for-loop is creating unnecessary copies.
Wredundant-decls
C ObjC C++ ObjC++ Var(warn_redundant_decls) Warning
@@ -1279,6 +1204,10 @@ Wredundant-move
C++ ObjC++ Var(warn_redundant_move) Warning LangEnabledBy(C++ ObjC++,Wextra)
Warn about redundant calls to std::move.
+Wredundant-tags
+C++ ObjC++ Var(warn_redundant_tags) Warning
+Warn when a class or enumerated type is referenced using a redundant class-key.
+
Wregister
C++ ObjC++ Var(warn_register) Warning
Warn about uses of register storage specifier.
@@ -1287,6 +1216,11 @@ Wreorder
C++ ObjC++ Var(warn_reorder) Warning LangEnabledBy(C++ ObjC++,Wall)
Warn when the compiler reorders code.
+Wrestrict
+C ObjC C++ ObjC++ Var(warn_restrict) Warning LangEnabledBy(C ObjC C++ ObjC++, Wall)
+Warn when an argument passed to a restrict-qualified parameter aliases with
+another argument.
+
Wreturn-mismatch
C ObjC Var(warn_return_mismatch) Warning Init(1)
Warn whenever void-returning functions return a non-void expressions, or a return expression is missing in a function not returning void.
@@ -1335,10 +1269,6 @@ Wshift-negative-value
C ObjC C++ ObjC++ Var(warn_shift_negative_value) Init(-1) Warning
Warn if left shifting a negative value.
-Warith-conversion
-C ObjC C++ ObjC++ Var(warn_arith_conv) Warning
-Warn if conversion of the result of arithmetic might change the value even though converting the operands cannot.
-
Wsign-compare
C ObjC C++ ObjC++ Var(warn_sign_compare) Warning LangEnabledBy(C++ ObjC++,Wall)
Warn about signed-unsigned comparisons.
@@ -1355,26 +1285,109 @@ Wsign-promo
C++ ObjC++ Var(warn_sign_promo) Warning
Warn when overload promotes from unsigned to signed.
-Wstrict-null-sentinel
-C++ ObjC++ Warning Var(warn_strict_null_sentinel)
-Warn about uncasted NULL used as sentinel.
+Wsized-deallocation
+C++ ObjC++ Var(warn_sized_deallocation) Warning EnabledBy(Wextra)
+Warn about missing sized deallocation functions.
-Wstrict-prototypes
-C ObjC Var(warn_strict_prototypes) Warning
-Warn about unprototyped function declarations.
+Wsizeof-array-div
+C ObjC C++ ObjC++ Var(warn_sizeof_array_div) Warning LangEnabledBy(C ObjC C++ ObjC++,Wall)
+Warn about divisions of two sizeof operators when the first one is applied
+to an array and the divisor does not equal the size of the array element.
+
+Wsizeof-array-argument
+C ObjC C++ ObjC++ Var(warn_sizeof_array_argument) Warning Init(1)
+Warn when sizeof is applied on a parameter declared as an array.
+
+Wsizeof-pointer-div
+C ObjC C++ ObjC++ Var(warn_sizeof_pointer_div) Warning LangEnabledBy(C ObjC C++ ObjC++,Wall)
+Warn about suspicious divisions of two sizeof expressions that don't work correctly with pointers.
+
+Wsizeof-pointer-memaccess
+C ObjC C++ ObjC++ Var(warn_sizeof_pointer_memaccess) Warning LangEnabledBy(C ObjC C++ ObjC++,Wall)
+Warn about suspicious length parameters to certain string functions if the argument uses sizeof.
Wstrict-aliasing=
C ObjC C++ ObjC++ LangEnabledBy(C ObjC C++ ObjC++,Wall, 3, 0) IntegerRange(0, 3)
;
+Wstrict-flex-arrays
+C C++ Var(warn_strict_flex_arrays) Warning
+Warn about inproper usages of flexible array members
+according to the level of -fstrict-flex-arrays.
+
+Wstrict-null-sentinel
+C++ ObjC++ Warning Var(warn_strict_null_sentinel)
+Warn about uncasted NULL used as sentinel.
+
Wstrict-overflow=
C ObjC C++ ObjC++ LangEnabledBy(C ObjC C++ ObjC++,Wall, 1, 0) IntegerRange(0, 5)
;
+Wstrict-prototypes
+C ObjC Var(warn_strict_prototypes) Warning
+Warn about unprototyped function declarations.
+
Wstrict-selector-match
ObjC ObjC++ Var(warn_strict_selector_match) Warning
Warn if type signatures of candidate methods do not match exactly.
+Wstring-compare
+C ObjC C++ LTO ObjC++ Warning Var(warn_string_compare) Warning LangEnabledBy(C ObjC C++ ObjC++, Wextra)
+Warn about calls to strcmp and strncmp used in equality expressions that
+are necessarily true or false due to the length of one and size of the other
+argument.
+
+Wstringop-overflow
+C ObjC C++ LTO ObjC++ Warning Alias(Wstringop-overflow=, 2, 0)
+Warn about buffer overflow in string manipulation functions like memcpy
+and strcpy.
+
+Wstringop-overflow=
+C ObjC C++ LTO ObjC++ Joined RejectNegative UInteger Var(warn_stringop_overflow) Init(2) Warning LangEnabledBy(C ObjC C++ LTO ObjC++, Wall, 2, 0) IntegerRange(0, 4)
+Under the control of Object Size type, warn about buffer overflow in string
+manipulation functions like memcpy and strcpy.
+
+Wstringop-overread
+C ObjC C++ LTO ObjC++ Var(warn_stringop_overread) Init(1) Warning LangEnabledBy(C ObjC C++ LTO ObjC++, Wall)
+Warn about reading past the end of a source array in string manipulation functions like memchr and memcpy.
+
+Wstringop-truncation
+C ObjC C++ LTO ObjC++ Var(warn_stringop_truncation) Warning Init (1) LangEnabledBy(C ObjC C++ LTO ObjC++, Wall)
+Warn about truncation in string manipulation functions like strncat and strncpy.
+
+Wsubobject-linkage
+C++ ObjC++ Var(warn_subobject_linkage) Warning Init(1)
+Warn if a class type has a base or a field whose type uses the anonymous namespace or depends on a type with no linkage.
+
+Wsuggest-attribute=format
+C ObjC C++ ObjC++ Var(warn_suggest_attribute_format) Warning
+Warn about functions which might be candidates for format attributes.
+
+Wsuggest-override
+C++ ObjC++ Var(warn_override) Warning
+Suggest that the override keyword be used when the declaration of a virtual
+function overrides another.
+
+Wswitch
+C ObjC C++ ObjC++ Var(warn_switch) Warning LangEnabledBy(C ObjC C++ ObjC++,Wall)
+Warn about enumerated switches, with no default, missing a case.
+
+Wswitch-default
+C ObjC C++ ObjC++ Var(warn_switch_default) Warning
+Warn about enumerated switches missing a \"default:\" statement.
+
+Wswitch-enum
+C ObjC C++ ObjC++ Var(warn_switch_enum) Warning
+Warn about all enumerated switches missing a specific case.
+
+Wswitch-bool
+C ObjC C++ ObjC++ Var(warn_switch_bool) Warning Init(1)
+Warn about switches with boolean controlling expression.
+
+Wswitch-outside-range
+C ObjC C++ ObjC++ Var(warn_switch_outside_range) Warning Init(1)
+Warn about switch values that are outside of the switch's type range.
+
Wsync-nand
C C++ Var(warn_sync_nand) Init(1) Warning
Warn when __sync_fetch_and_nand and __sync_nand_and_fetch built-in functions are used.
@@ -1387,6 +1400,10 @@ Wsystem-headers
C ObjC C++ ObjC++ Warning
; Documented in common.opt
+Wtemplates
+C++ ObjC++ Var(warn_templates) Warning
+Warn on primary template declaration.
+
Wtautological-compare
C ObjC C++ ObjC++ Var(warn_tautological_compare) Warning LangEnabledBy(C ObjC C++ ObjC++,Wall)
Warn if a comparison always evaluates to true or false.
@@ -1423,10 +1440,6 @@ Wuninitialized
C ObjC C++ ObjC++ LTO LangEnabledBy(C ObjC C++ ObjC++ LTO,Wall)
;
-Wmaybe-uninitialized
-C ObjC C++ ObjC++ LTO LangEnabledBy(C ObjC C++ ObjC++ LTO,Wall)
-;
-
Wunknown-pragmas
C ObjC C++ ObjC++ Warning Var(warn_unknown_pragmas) LangEnabledBy(C ObjC C++ ObjC++,Wall, 1, 0)
Warn about unrecognized pragmas.
@@ -1439,6 +1452,14 @@ Wunused
C ObjC C++ ObjC++ LangEnabledBy(C ObjC C++ ObjC++,Wall)
; documented in common.opt
+Wunused-const-variable
+C ObjC C++ ObjC++ Warning Alias(Wunused-const-variable=, 2, 0)
+Warn when a const variable is unused.
+
+Wunused-const-variable=
+C ObjC C++ ObjC++ Joined RejectNegative UInteger Var(warn_unused_const_variable) Warning LangEnabledBy(C ObjC,Wunused-variable, 1, 0) IntegerRange(0, 2)
+Warn when a const variable is unused.
+
Wunused-local-typedefs
C ObjC C++ ObjC++ Var(warn_unused_local_typedefs) Warning EnabledBy(Wunused)
Warn when typedefs locally defined in a function are not used.
@@ -1455,14 +1476,6 @@ Wunused-variable
C ObjC C++ ObjC++ LangEnabledBy(C ObjC C++ ObjC++,Wunused)
; documented in common.opt
-Wunused-const-variable
-C ObjC C++ ObjC++ Warning Alias(Wunused-const-variable=, 2, 0)
-Warn when a const variable is unused.
-
-Wunused-const-variable=
-C ObjC C++ ObjC++ Joined RejectNegative UInteger Var(warn_unused_const_variable) Warning LangEnabledBy(C ObjC,Wunused-variable, 1, 0) IntegerRange(0, 2)
-Warn when a const variable is unused.
-
; Defining this option here in addition to common.opt is necessary
; in order for the default -Wall setting of -Wuse-after-free=2 to take
; effect.
@@ -1471,6 +1484,10 @@ Wuse-after-free=
LangEnabledBy(C ObjC C++ LTO ObjC++, Wall,2,0)
; in common.opt
+Wuseless-cast
+C ObjC C++ ObjC++ Var(warn_useless_cast) Warning
+Warn about useless casts.
+
Wvariadic-macros
C ObjC C++ ObjC++ CPP(warn_variadic_macros) CppReason(CPP_W_VARIADIC_MACROS) Var(cpp_warn_variadic_macros) Init(0) Warning LangEnabledBy(C ObjC C++ ObjC++,Wpedantic || Wtraditional)
Warn about using variadic macros.
@@ -1483,6 +1500,10 @@ Wvexing-parse
C++ ObjC++ Warning Var(warn_vexing_parse) Init(1)
Warn about the most vexing parse syntactic ambiguity.
+Wvirtual-move-assign
+C++ ObjC++ Var(warn_virtual_move_assign) Warning Init(1)
+Warn if a virtual base has a non-trivial move assignment operator.
+
Wvla
C ObjC C++ ObjC++ Var(warn_vla) Init(-1) Warning
Warn if a variable length array is used.
@@ -1513,10 +1534,6 @@ Wvirtual-inheritance
C++ ObjC++ Var(warn_virtual_inheritance) Warning
Warn on direct virtual inheritance.
-Wvirtual-move-assign
-C++ ObjC++ Var(warn_virtual_move_assign) Warning Init(1)
-Warn if a virtual base has a non-trivial move assignment operator.
-
Wwrite-strings
C ObjC C++ ObjC++ Var(warn_write_strings) Warning
In C++, nonzero means warn about deprecated conversion from string literals to 'char *'. In C, similar warning, except that the conversion is of course not deprecated by the ISO C standard.
@@ -1529,26 +1546,9 @@ Wzero-as-null-pointer-constant
C++ ObjC++ Var(warn_zero_as_null_pointer_constant) Warning
Warn when a literal '0' is used as null pointer.
-Wuseless-cast
-C ObjC C++ ObjC++ Var(warn_useless_cast) Warning
-Warn about useless casts.
-
-Wsubobject-linkage
-C++ ObjC++ Var(warn_subobject_linkage) Warning Init(1)
-Warn if a class type has a base or a field whose type uses the anonymous namespace or depends on a type with no linkage.
-
-Welaborated-enum-base
-C++ ObjC++ Var(warn_elaborated_enum_base) Warning Init(1)
-Warn if an additional enum-base is used in an elaborated-type-specifier.
-
-Wduplicate-decl-specifier
-C ObjC Var(warn_duplicate_decl_specifier) Warning LangEnabledBy(C ObjC,Wall)
-Warn when a declaration has duplicate const, volatile, restrict or _Atomic specifier.
-
-Wrestrict
-C ObjC C++ ObjC++ Var(warn_restrict) Warning LangEnabledBy(C ObjC C++ ObjC++, Wall)
-Warn when an argument passed to a restrict-qualified parameter aliases with
-another argument.
+Wzero-length-bounds
+C ObjC C++ ObjC++ Var(warn_zero_length_bounds) Warning LangEnabledBy(C ObjC C++ ObjC++,Wall)
+Warn about accesses to interior zero-length array members.
ansi
C ObjC C++ ObjC++
--
2.31.1
^ permalink raw reply [flat|nested] 2+ messages in thread
* [COMMITTED] Correct lists of options enabled by -Wall and -Wextra [PR90463]
2024-01-23 0:26 [COMMITTED, obvious] Sort warning options in c-family/c.opt Sandra Loosemore
@ 2024-01-23 0:26 ` Sandra Loosemore
0 siblings, 0 replies; 2+ messages in thread
From: Sandra Loosemore @ 2024-01-23 0:26 UTC (permalink / raw)
To: gcc-patches
gcc/ChangeLog
PR c++/90463
* doc/invoke.texi (Warning Options): Correct lists of options
enabled by -Wall and -Wextra by checking against common.opt
and c-family/c.opt.
---
gcc/doc/invoke.texi | 79 ++++++++++++++++++++++++++++-----------------
1 file changed, 50 insertions(+), 29 deletions(-)
diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi
index 278c931b6a3..676e7ef03d1 100644
--- a/gcc/doc/invoke.texi
+++ b/gcc/doc/invoke.texi
@@ -6202,27 +6202,37 @@ Options} and @ref{Objective-C and Objective-C++ Dialect Options}.
@option{-Wall} turns on the following warning flags:
@gccoptlist{-Waddress
+-Waligned-new @r{(C++ and Objective-C++ only)}
-Warray-bounds=1 @r{(only with} @option{-O2}@r{)}
-Warray-compare
--Warray-parameter=2 @r{(C and Objective-C only)}
+-Warray-parameter=2
-Wbool-compare
-Wbool-operation
--Wc++11-compat -Wc++14-compat
+-Wc++11-compat -Wc++14-compat -Wc++17compat -Wc++20compat
-Wcatch-value @r{(C++ and Objective-C++ only)}
-Wchar-subscripts
+-Wclass-memaccess @r{(C++ and Objective-C++ only)}
-Wcomment
+-Wdangling-else
-Wdangling-pointer=2
+-Wdelete-non-virtual-dtor @r{(C++ and Objective-C++ only)}
-Wduplicate-decl-specifier @r{(C and Objective-C only)}
-Wenum-compare @r{(in C/ObjC; this is on by default in C++)}
-Wenum-int-mismatch @r{(C and Objective-C only)}
--Wformat
--Wformat-overflow
--Wformat-truncation
--Wint-in-bool-context
+-Wformat=1
+-Wformat-contains-nul
+-Wformat-diag
+-Wformat-extra-args
+-Wformat-overflow=1
+-Wformat-truncation=1
+-Wformat-zero-length
+-Wframe-address
-Wimplicit @r{(C and Objective-C only)}
--Wimplicit-int @r{(C and Objective-C only)}
-Wimplicit-function-declaration @r{(C and Objective-C only)}
--Winit-self @r{(only for C++)}
+-Wimplicit-int @r{(C and Objective-C only)}
+-Winfinite-recursion
+-Winit-self @r{(C++ and Objective-C++ only)}
+-Wint-in-bool-context
-Wlogical-not-parentheses
-Wmain @r{(only for C/ObjC and unless} @option{-ffreestanding}@r{)}
-Wmaybe-uninitialized
@@ -6230,24 +6240,26 @@ Options} and @ref{Objective-C and Objective-C++ Dialect Options}.
-Wmemset-transposed-args
-Wmisleading-indentation @r{(only for C/C++)}
-Wmismatched-dealloc
--Wmismatched-new-delete @r{(only for C/C++)}
+-Wmismatched-new-delete @r{(C++ and Objective-C++ only)}
-Wmissing-attributes
-Wmissing-braces @r{(only for C/ObjC)}
-Wmultistatement-macros
--Wnarrowing @r{(only for C++)}
+-Wnarrowing @r{(C++ and Objective-C++ only)}
-Wnonnull
-Wnonnull-compare
--Wopenmp-simd
+-Wopenmp-simd @r{(C and C++ only)}
+-Woverloaded-virtual=1 @r{(C++ and Objective-C++ only)}
+-Wpacked-not-aligned
-Wparentheses
--Wpessimizing-move @r{(only for C++)}
--Wpointer-sign
--Wrange-loop-construct @r{(only for C++)}
--Wreorder
+-Wpessimizing-move @r{(C++ and Objective-C++ only)}
+-Wpointer-sign @r{(only for C/ObjC)}
+-Wrange-loop-construct @r{(C++ and Objective-C++ only)}
+-Wreorder @r{(C++ and Objective-C++ only)}
-Wrestrict
-Wreturn-type
--Wself-move @r{(only for C++)}
+-Wself-move @r{(C++ and Objective-C++ only)}
-Wsequence-point
--Wsign-compare @r{(only in C++)}
+-Wsign-compare @r{(C++ and Objective-C++ only)}
-Wsizeof-array-div
-Wsizeof-pointer-div
-Wsizeof-pointer-memaccess
@@ -6258,12 +6270,16 @@ Options} and @ref{Objective-C and Objective-C++ Dialect Options}.
-Wtrigraphs
-Wuninitialized
-Wunknown-pragmas
+-Wunused
+-Wunused-but-set-variable
+-Wunused-const-variable=1 @r{(only for C/ObjC)}
-Wunused-function
-Wunused-label
+-Wunused-local-typedefs
-Wunused-value
-Wunused-variable
-Wuse-after-free=2
--Wvla-parameter @r{(C and Objective-C only)}
+-Wvla-parameter
-Wvolatile-register-var
-Wzero-length-bounds}
@@ -6283,27 +6299,32 @@ This enables some extra warning flags that are not enabled by
@option{-Wall}. (This option used to be called @option{-W}. The older
name is still supported, but the newer name is more descriptive.)
-@gccoptlist{-Wclobbered
+@gccoptlist{-Wabsolute-value @r{(only for C/ObjC)}
+-Walloc-size
+-Wcalloc-transposed-args
-Wcast-function-type
--Wdeprecated-copy @r{(C++ only)}
+-Wclobbered
+-Wdeprecated-copy @r{(C++ and Objective-C++ only)}
-Wempty-body
--Wenum-conversion @r{(C only)}
--Wignored-qualifiers
+-Wenum-conversion @r{(only for C/ObjC)}
+-Wexpansion-to-defined
+-Wignored-qualifiers @r{(only for C/C++)}
-Wimplicit-fallthrough=3
+-Wmaybe-uninitialized
-Wmissing-field-initializers
--Wmissing-parameter-type @r{(C only)}
--Wold-style-declaration @r{(C only)}
--Woverride-init
--Wsign-compare @r{(C only)}
+-Wmissing-parameter-type @r{(C/ObjC only)}
+-Wold-style-declaration @r{(C/ObjC only)}
+-Woverride-init @r{(C/ObjC only)}
+-Wredundant-move @r{(C++ and Objective-C++ only)}
+-Wshift-negative-value @r{(in C++11 to C++17 and in C99 and newer)}
+-Wsign-compare @r{(C++ and Objective-C++ only)}
+-Wsized-deallocation @r{(C++ and Objective-C++ only)}
-Wstring-compare
--Wredundant-move @r{(only for C++)}
-Wtype-limits
-Wuninitialized
--Wshift-negative-value @r{(in C++11 to C++17 and in C99 and newer)}
-Wunused-parameter @r{(only with} @option{-Wunused} @r{or} @option{-Wall}@r{)}
-Wunused-but-set-parameter @r{(only with} @option{-Wunused} @r{or} @option{-Wall}@r{)}}
-
The option @option{-Wextra} also prints warning messages for the
following cases:
--
2.31.1
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2024-01-23 0:27 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-01-23 0:26 [COMMITTED, obvious] Sort warning options in c-family/c.opt Sandra Loosemore
2024-01-23 0:26 ` [COMMITTED] Correct lists of options enabled by -Wall and -Wextra [PR90463] Sandra Loosemore
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).