+2012-10-20 Manuel López-Ibáñez <manu@gcc.gnu.org>
+
+ PR c/53063
+ PR c/40989
+ * opts.c (finish_options): Remove explicit handling from here.
+
2012-10-20 Joern Rennecke <joern.rennecke@embecosm.com>
Richard Sandiford <rdsandiford@googlemail.com>
+2012-10-20 Manuel López-Ibáñez <manu@gcc.gnu.org>
+
+ PR c/53063
+ PR c/40989
+ * c.opt (Waddress,Wchar-subscripts,Wsign-conversion,Wimplicit,
+ Wimplicit-function-declaration,Wimplicit-int,Wsizeof-pointer-memaccess,
+ Wnarrowing,Wparentheses,Wpointer-sign,Wreturn-type,Wsequence-point,
+ Wsign-compare,Wuninitialized,Wmaybe-uninitialized,Wunused,
+ Wvolatile-register-var): Add LangEnabledBy or EnabledBy.
+ * c-opts.c (c_common_handle_option): Remove explicit handling from
+ here.
+ (c_common_post_options): Likewise.
+
2012-10-18 Eric Botcazou <ebotcazou@adacore.com>
* c-ada-spec.c (LOCATION_COL): Delete.
case OPT_Wall:
/* ??? Don't add new options here. Use LangEnabledBy in c.opt. */
- handle_generated_option (&global_options, &global_options_set,
- OPT_Wunused, NULL, value,
- c_family_lang_mask, kind, loc,
- handlers, global_dc);
set_Wformat (value);
- handle_generated_option (&global_options, &global_options_set,
- OPT_Wimplicit, NULL, value,
- c_family_lang_mask, kind, loc,
- handlers, global_dc);
- warn_char_subscripts = value;
- warn_parentheses = value;
- warn_return_type = value;
- warn_sequence_point = value; /* Was C only. */
warn_switch = value;
- warn_sizeof_pointer_memaccess = value;
- warn_address = value;
warn_array_bounds = value;
- warn_volatile_register_var = value;
/* Only warn about unknown pragmas that are not in system
headers. */
warn_unknown_pragmas = value;
- warn_uninitialized = value;
- warn_maybe_uninitialized = value;
-
if (!c_dialect_cxx ())
{
/* We set this to 2 here, but 1 in -Wmain, so -ffreestanding
if (warn_enum_compare == -1)
warn_enum_compare = value;
}
- else
- {
- /* C++-specific warnings. */
- warn_sign_compare = value;
- warn_narrowing = value;
- }
cpp_opts->warn_trigraphs = value;
cpp_opts->warn_comments = value;
cpp_opts->warn_num_sign_change = value;
-
- if (warn_pointer_sign == -1)
- warn_pointer_sign = value;
break;
case OPT_Wbuiltin_macro_redefined:
cpp_opts->warn_cxx_operator_names = value;
break;
- case OPT_Wc__0x_compat:
- warn_narrowing = value;
- break;
-
case OPT_Wdeprecated:
cpp_opts->cpp_warn_deprecated = value;
break;
set_Wformat (atoi (arg));
break;
- case OPT_Wimplicit:
- gcc_assert (value == 0 || value == 1);
- if (warn_implicit_int == -1)
- handle_generated_option (&global_options, &global_options_set,
- OPT_Wimplicit_int, NULL, value,
- c_family_lang_mask, kind, loc, handlers,
- global_dc);
- if (warn_implicit_function_declaration == -1)
- handle_generated_option (&global_options, &global_options_set,
- OPT_Wimplicit_function_declaration, NULL,
- value, c_family_lang_mask, kind, loc,
- handlers, global_dc);
- break;
-
case OPT_Winvalid_pch:
cpp_opts->warn_invalid_pch = value;
break;
case OPT_Wpedantic:
cpp_opts->cpp_pedantic = 1;
cpp_opts->warn_endif_labels = 1;
- if (warn_pointer_sign == -1)
- warn_pointer_sign = 1;
if (warn_overlength_strings == -1)
warn_overlength_strings = 1;
if (warn_main == -1)
if (flag_objc_exceptions && !flag_objc_sjlj_exceptions)
flag_exceptions = 1;
- /* -Wextra implies the following flags
- unless explicitly overridden. */
-
- /* Wsign-compare is also enabled by -Wall in C++. */
- if (warn_sign_compare == -1)
- warn_sign_compare = extra_warnings;
-
- /* -Wpointer-sign is disabled by default, but it is enabled if any
- of -Wall or -Wpedantic are given. */
- if (warn_pointer_sign == -1)
- warn_pointer_sign = 0;
-
/* -Woverlength-strings is off by default, but is enabled by -Wpedantic.
It is never enabled in C++, as the minimum limit is not normative
in that standard. */
else if (warn_main == 2)
warn_main = flag_hosted ? 1 : 0;
- /* In C, -Wconversion enables -Wsign-conversion (unless disabled
- through -Wno-sign-conversion). While in C++,
- -Wsign-conversion needs to be requested explicitly. */
- if (warn_sign_conversion == -1)
- warn_sign_conversion = (c_dialect_cxx ()) ? 0 : warn_conversion;
-
/* In C, -Wall and -Wc++-compat enable -Wenum-compare, which we do
in c_common_handle_option; if it has not yet been set, it is
disabled by default. In C++, it is enabled by default. */
"-Wformat-security ignored without -Wformat");
}
- if (warn_implicit == -1)
- warn_implicit = 0;
-
- if (warn_implicit_int == -1)
- warn_implicit_int = 0;
-
/* -Wimplicit-function-declaration is enabled by default for C99. */
if (warn_implicit_function_declaration == -1)
warn_implicit_function_declaration = flag_isoc99;
C ObjC C++ ObjC++ LTO Var(warn_psabi) Init(1) Undocumented
Waddress
-C ObjC C++ ObjC++ Var(warn_address) Warning
+C ObjC C++ ObjC++ Var(warn_address) Warning LangEnabledBy(C ObjC C++ ObjC++,Wall)
Warn about suspicious uses of memory addresses
Wall
Warn about casts which discard qualifiers
Wchar-subscripts
-C ObjC C++ ObjC++ Var(warn_char_subscripts) Warning
+C ObjC C++ ObjC++ Var(warn_char_subscripts) Warning LangEnabledBy(C ObjC C++ ObjC++,Wall)
Warn about subscripts whose type is \"char\"
Wclobbered
C++ ObjC++ Var(warn_conversion_null) Init(1) Warning
Warn for converting NULL from/to a non-pointer type
-Wsign-conversion
-C ObjC C++ ObjC++ Var(warn_sign_conversion) Init(-1)
-Warn for implicit type conversions between signed and unsigned integers
-
Wctor-dtor-privacy
C++ ObjC++ Var(warn_ctor_dtor_privacy) Warning
Warn when all constructors and destructors are private
Warn about variables which are initialized to themselves
Wimplicit
-C ObjC Var(warn_implicit) Init(-1) Warning
+C ObjC Var(warn_implicit) Warning LangEnabledBy(C ObjC,Wall)
Warn about implicit declarations
Wdouble-promotion
Warn about implicit conversions from \"float\" to \"double\"
Wimplicit-function-declaration
-C ObjC Var(warn_implicit_function_declaration) Init(-1) Warning
+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
+C ObjC Var(warn_implicit_int) Warning LangEnabledBy(C ObjC,Wimplicit)
Warn when a declaration does not specify a type
Wimport
Warn about missing fields in struct initializers
Wsizeof-pointer-memaccess
-C ObjC C++ ObjC++ Var(warn_sizeof_pointer_memaccess) Warning
+C ObjC C++ ObjC++ Var(warn_sizeof_pointer_memaccess) Warning LangEnabledBy(C ObjC C++ ObjC++,Wall)
Wsuggest-attribute=format
C ObjC C++ ObjC++ Var(warn_suggest_attribute_format) Warning
Warn about use of multi-character character constants
Wnarrowing
-C ObjC C++ ObjC++ Warning Var(warn_narrowing) Init(-1)
+C ObjC C++ ObjC++ Warning Var(warn_narrowing) Init(-1) LangEnabledBy(C++ ObjC++,Wall)
Warn about narrowing conversions within { } that are ill-formed in C++11
+Wnarrowing
+C ObjC C++ ObjC++ LangEnabledBy(C++ ObjC++,Wc++0x-compat)
+;
+
Wnested-externs
C ObjC Var(warn_nested_externs) Warning
Warn about \"extern\" declarations not at file scope
Warn about packed bit-fields whose offset changed in GCC 4.4
Wparentheses
-C ObjC C++ ObjC++ Var(warn_parentheses) Warning
+C ObjC C++ ObjC++ Var(warn_parentheses) Warning LangEnabledBy(C ObjC C++ ObjC++,Wall)
Warn about possibly missing parentheses
Wpedantic
C ObjC C++ ObjC++ Var(warn_pointer_arith) Warning
Warn about function pointer arithmetic
+Wpointer-sign
+C ObjC Var(warn_pointer_sign) Warning LangEnabledBy(C ObjC,Wall)
+Warn when a pointer differs in signedness in an assignment
+
+Wpointer-sign
+C ObjC LangEnabledBy(C ObjC,Wpedantic)
+;
+
Wpointer-to-int-cast
C ObjC Var(warn_pointer_to_int_cast) Init(1) Warning
Warn when a pointer is cast to an integer of a different size
Warn when the compiler reorders code
Wreturn-type
-C ObjC C++ ObjC++ Var(warn_return_type) Warning
+C ObjC C++ ObjC++ Var(warn_return_type) Warning LangEnabledBy(C ObjC C++ ObjC++,Wall)
Warn whenever a function's return type defaults to \"int\" (C), or about inconsistent return types (C++)
Wselector
Warn if a selector has multiple methods
Wsequence-point
-C ObjC C++ ObjC++ Var(warn_sequence_point) Warning
+C ObjC C++ ObjC++ Var(warn_sequence_point) Warning LangEnabledBy(C ObjC C++ ObjC++,Wall)
Warn about possible violations of sequence point rules
Wsign-compare
-C ObjC C++ ObjC++ Var(warn_sign_compare) Init(-1) Warning
+C ObjC C++ ObjC++ Var(warn_sign_compare) Warning LangEnabledBy(C++ ObjC++,Wall)
Warn about signed-unsigned comparisons
+Wsign-compare
+C ObjC C++ ObjC++ EnabledBy(Wextra)
+;
+
+Wsign-conversion
+C ObjC C++ ObjC++ Var(warn_sign_conversion) LangEnabledBy(C ObjC,Wconversion)
+Warn for implicit type conversions between signed and unsigned integers
+
Wsign-promo
C++ ObjC++ Var(warn_sign_promo) Warning
Warn when overload promotes from unsigned to signed
C ObjC C++ ObjC++ Warning
Warn if an undefined macro is used in an #if directive
+Wuninitialized
+C ObjC C++ ObjC++ LangEnabledBy(C ObjC C++ ObjC++,Wall)
+;
+
+Wmaybe-uninitialized
+C ObjC C++ ObjC++ LangEnabledBy(C ObjC C++ ObjC++,Wall)
+;
+
Wunknown-pragmas
C ObjC C++ ObjC++ Warning
Warn about unrecognized pragmas
C ObjC Var(warn_unsuffixed_float_constants) Warning
Warn about unsuffixed float constants
+Wunused
+C ObjC C++ ObjC++ LangEnabledBy(C ObjC C++ ObjC++,Wall)
+; documented in common.opt
+
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
Warn if a variable length array is used
Wvolatile-register-var
-C ObjC C++ ObjC++ Var(warn_volatile_register_var) Warning
+C ObjC C++ ObjC++ Var(warn_volatile_register_var) Warning LangEnabledBy(C ObjC C++ ObjC++,Wall)
Warn when a register variable is declared volatile
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.
-Wpointer-sign
-C ObjC Var(warn_pointer_sign) Init(-1) Warning
-Warn when a pointer differs in signedness in an assignment
-
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
maybe_set_param_value (PARAM_MAX_STORES_TO_SINK, 0,
opts->x_param_values, opts_set->x_param_values);
- /* This replaces set_Wunused. */
- /* Wunused-local-typedefs is enabled by -Wunused or -Wall. */
- if (opts->x_warn_unused_local_typedefs == -1)
- opts->x_warn_unused_local_typedefs = opts->x_warn_unused;
}
#define LEFT_COLUMN 27