re PR c/53063 (encode group options in the .opt files)
2012-10-20 Manuel López-Ibáñez <manu@gcc.gnu.org> PR c/53063 PR c/40989 c-family/ * 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. gcc/ * opts.c (finish_options): Remove explicit handling from here. From-SVN: r192635
This commit is contained in:
parent
f6df08e637
commit
4a0ae68e1c
@ -1,3 +1,9 @@
|
||||
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>
|
||||
|
||||
|
@ -1,3 +1,16 @@
|
||||
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.
|
||||
|
@ -361,32 +361,14 @@ c_common_handle_option (size_t scode, const char *arg, int value,
|
||||
|
||||
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
|
||||
@ -400,19 +382,10 @@ c_common_handle_option (size_t scode, const char *arg, int value,
|
||||
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:
|
||||
@ -431,10 +404,6 @@ c_common_handle_option (size_t scode, const char *arg, int value,
|
||||
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;
|
||||
@ -451,20 +420,6 @@ c_common_handle_option (size_t scode, const char *arg, int value,
|
||||
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;
|
||||
@ -734,8 +689,6 @@ c_common_handle_option (size_t scode, const char *arg, int value,
|
||||
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)
|
||||
@ -924,18 +877,6 @@ c_common_post_options (const char **pfilename)
|
||||
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. */
|
||||
@ -951,12 +892,6 @@ c_common_post_options (const char **pfilename)
|
||||
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. */
|
||||
@ -987,12 +922,6 @@ c_common_post_options (const char **pfilename)
|
||||
"-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;
|
||||
|
@ -261,7 +261,7 @@ Wpsabi
|
||||
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
|
||||
@ -297,7 +297,7 @@ C ObjC C++ ObjC++ Var(warn_cast_qual) Warning
|
||||
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
|
||||
@ -320,10 +320,6 @@ Wconversion-null
|
||||
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
|
||||
@ -412,7 +408,7 @@ C ObjC C++ ObjC++ Var(warn_init_self) Warning LangEnabledBy(C++ ObjC++,Wall)
|
||||
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
|
||||
@ -420,11 +416,11 @@ C ObjC C++ ObjC++ Var(warn_double_promotion) Warning
|
||||
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
|
||||
@ -475,7 +471,7 @@ C ObjC C++ ObjC++ Var(warn_missing_field_initializers) Warning EnabledBy(Wextra)
|
||||
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
|
||||
@ -506,9 +502,13 @@ C ObjC C++ ObjC++ 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
|
||||
@ -562,7 +562,7 @@ C ObjC C++ ObjC++ Var(warn_packed_bitfield_compat) Init(-1) Warning
|
||||
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
|
||||
@ -577,6 +577,14 @@ Wpointer-arith
|
||||
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
|
||||
@ -602,7 +610,7 @@ C++ ObjC++ Var(warn_reorder) Warning LangEnabledBy(C++ ObjC++,Wall)
|
||||
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
|
||||
@ -610,13 +618,21 @@ ObjC ObjC++ Var(warn_selector) Warning
|
||||
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
|
||||
@ -673,6 +689,14 @@ Wundef
|
||||
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
|
||||
@ -681,6 +705,10 @@ Wunsuffixed-float-constants
|
||||
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
|
||||
@ -706,17 +734,13 @@ C ObjC C++ ObjC++ Var(warn_vla) Init(-1) Warning
|
||||
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
|
||||
|
@ -829,10 +829,6 @@ finish_options (struct gcc_options *opts, struct gcc_options *opts_set,
|
||||
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
|
||||
|
Loading…
Reference in New Issue
Block a user