re PR c/53063 (encode group options in the .opt files)

c-family/
2012-11-07  Manuel López-Ibáñez  <manu@gcc.gnu.org>

	PR c/53063
	* c.opt(Warray-bounds,Wdelete-non-virtual-dtor,Wenum-compare,
	Wmain,Woverlength-strings, Wunknown-pragmas,Wunused-macros):
	Use LangEnabledBy.
	(Wswitch,Wswitch-default,Wswitch-enum): Likewise. Move here from
	common.opt.
	(Wvariadic-macros): Init(1).
	* c-opts.c (c_common_handle_option): Do not handle them
	explicitly.
	(c_common_post_options): Likewise.
	(sanitize_cpp_opts): warn_unused_macros is now
	cpp_warn_unused_macros.
	(push_command_line_include): Likewise.
	* c-common.c (warn_unknown_pragmas): Do not define.
	* c-common.h (warn_unknown_pragmas): Do not declare.
gcc/
2012-11-07  Manuel López-Ibáñez  <manu@gcc.gnu.org>

	PR c/53063
	* common.opt (Wswitch,Wswitch-default,Wswitch-enum): Move to c.opt.
fortran/
2012-11-07  Manuel López-Ibáñez  <manu@gcc.gnu.org>

	PR c/53063
	* options.c (set_Wall): Do not set warn_switch here.

From-SVN: r193302
parent 3f46d6a5
2012-11-07 Manuel López-Ibáñez <manu@gcc.gnu.org>
PR c/53063
* common.opt (Wswitch,Wswitch-default,Wswitch-enum): Move to c.opt.
2012-11-07 Yufeng Zhang <yufeng.zhang@arm.com> 2012-11-07 Yufeng Zhang <yufeng.zhang@arm.com>
* config/aarch64/aarch64.c (aarch64_expand_prologue): add the missing * config/aarch64/aarch64.c (aarch64_expand_prologue): add the missing
2012-11-07 Manuel López-Ibáñez <manu@gcc.gnu.org> 2012-11-07 Manuel López-Ibáñez <manu@gcc.gnu.org>
PR c/53063
* c.opt(Warray-bounds,Wdelete-non-virtual-dtor,Wenum-compare,
Wmain,Woverlength-strings, Wunknown-pragmas,Wunused-macros):
Use LangEnabledBy.
(Wswitch,Wswitch-default,Wswitch-enum): Likewise. Move here from
common.opt.
(Wvariadic-macros): Init(1).
* c-opts.c (c_common_handle_option): Do not handle them
explicitly.
(c_common_post_options): Likewise.
(sanitize_cpp_opts): warn_unused_macros is now
cpp_warn_unused_macros.
(push_command_line_include): Likewise.
* c-common.c (warn_unknown_pragmas): Do not define.
* c-common.h (warn_unknown_pragmas): Do not declare.
2012-11-07 Manuel López-Ibáñez <manu@gcc.gnu.org>
PR c/51294 PR c/51294
* c-common.c (conversion_warning): Handle conditional expressions. * c-common.c (conversion_warning): Handle conditional expressions.
......
...@@ -193,10 +193,6 @@ const char *pch_file; ...@@ -193,10 +193,6 @@ const char *pch_file;
user's namespace. */ user's namespace. */
int flag_iso; int flag_iso;
/* Warn about #pragma directives that are not recognized. */
int warn_unknown_pragmas; /* Tri state variable. */
/* Warn about format/argument anomalies in calls to formatted I/O functions /* Warn about format/argument anomalies in calls to formatted I/O functions
(*printf, *scanf, strftime, strfmon, etc.). */ (*printf, *scanf, strftime, strfmon, etc.). */
......
...@@ -585,10 +585,6 @@ extern const char *pch_file; ...@@ -585,10 +585,6 @@ extern const char *pch_file;
extern int flag_iso; extern int flag_iso;
/* Warn about #pragma directives that are not recognized. */
extern int warn_unknown_pragmas; /* Tri state variable. */
/* Warn about format/argument anomalies in calls to formatted I/O functions /* Warn about format/argument anomalies in calls to formatted I/O functions
(*printf, *scanf, strftime, strfmon, etc.). */ (*printf, *scanf, strftime, strfmon, etc.). */
......
...@@ -96,12 +96,6 @@ static bool std_cxx_inc = true; ...@@ -96,12 +96,6 @@ static bool std_cxx_inc = true;
/* If the quote chain has been split by -I-. */ /* If the quote chain has been split by -I-. */
static bool quote_chain_split; static bool quote_chain_split;
/* If -Wunused-macros. */
static bool warn_unused_macros;
/* If -Wvariadic-macros. */
static bool warn_variadic_macros = true;
/* Number of deferred options. */ /* Number of deferred options. */
static size_t deferred_count; static size_t deferred_count;
...@@ -365,26 +359,6 @@ c_common_handle_option (size_t scode, const char *arg, int value, ...@@ -365,26 +359,6 @@ c_common_handle_option (size_t scode, const char *arg, int value,
case OPT_Wall: case OPT_Wall:
/* ??? Don't add new options here. Use LangEnabledBy in c.opt. */ /* ??? Don't add new options here. Use LangEnabledBy in c.opt. */
set_Wformat (value); set_Wformat (value);
warn_switch = value;
warn_array_bounds = value;
/* Only warn about unknown pragmas that are not in system
headers. */
warn_unknown_pragmas = value;
if (!c_dialect_cxx ())
{
/* We set this to 2 here, but 1 in -Wmain, so -ffreestanding
can turn it off only if it's not explicit. */
if (warn_main == -1)
warn_main = (value ? 2 : 0);
/* In C, -Wall and -Wc++-compat turns on -Wenum-compare,
which we do here. In C++ it is on by default, which is
done in c_common_post_options. */
if (warn_enum_compare == -1)
warn_enum_compare = value;
}
cpp_opts->warn_trigraphs = value; cpp_opts->warn_trigraphs = value;
cpp_opts->warn_comments = value; cpp_opts->warn_comments = value;
...@@ -400,10 +374,6 @@ c_common_handle_option (size_t scode, const char *arg, int value, ...@@ -400,10 +374,6 @@ c_common_handle_option (size_t scode, const char *arg, int value,
break; break;
case OPT_Wc___compat: case OPT_Wc___compat:
/* Because -Wenum-compare is the default in C++, -Wc++-compat
implies -Wenum-compare. */
if (warn_enum_compare == -1 && value)
warn_enum_compare = value;
cpp_opts->warn_cxx_operator_names = value; cpp_opts->warn_cxx_operator_names = value;
break; break;
...@@ -480,22 +450,10 @@ c_common_handle_option (size_t scode, const char *arg, int value, ...@@ -480,22 +450,10 @@ c_common_handle_option (size_t scode, const char *arg, int value,
case OPT_Wunknown_pragmas: case OPT_Wunknown_pragmas:
/* Set to greater than 1, so that even unknown pragmas in /* Set to greater than 1, so that even unknown pragmas in
system headers will be warned about. */ system headers will be warned about. */
/* ??? There is no way to handle this automatically for now. */
warn_unknown_pragmas = value * 2; warn_unknown_pragmas = value * 2;
break; break;
case OPT_Wunused_macros:
warn_unused_macros = value;
break;
case OPT_Wvariadic_macros:
warn_variadic_macros = value;
break;
case OPT_Weffc__:
if (value)
warn_nonvdtor = true;
break;
case OPT_ansi: case OPT_ansi:
if (!c_dialect_cxx ()) if (!c_dialect_cxx ())
set_std_c89 (false, true); set_std_c89 (false, true);
...@@ -692,10 +650,6 @@ c_common_handle_option (size_t scode, const char *arg, int value, ...@@ -692,10 +650,6 @@ c_common_handle_option (size_t scode, const char *arg, int value,
case OPT_Wpedantic: case OPT_Wpedantic:
cpp_opts->cpp_pedantic = 1; cpp_opts->cpp_pedantic = 1;
cpp_opts->warn_endif_labels = 1; cpp_opts->warn_endif_labels = 1;
if (warn_overlength_strings == -1)
warn_overlength_strings = 1;
if (warn_main == -1)
warn_main = 2;
break; break;
case OPT_print_objc_runtime_info: case OPT_print_objc_runtime_info:
...@@ -883,21 +837,21 @@ c_common_post_options (const char **pfilename) ...@@ -883,21 +837,21 @@ c_common_post_options (const char **pfilename)
/* -Woverlength-strings is off by default, but is enabled by -Wpedantic. /* -Woverlength-strings is off by default, but is enabled by -Wpedantic.
It is never enabled in C++, as the minimum limit is not normative It is never enabled in C++, as the minimum limit is not normative
in that standard. */ in that standard. */
if (warn_overlength_strings == -1 || c_dialect_cxx ()) if (c_dialect_cxx ())
warn_overlength_strings = 0; warn_overlength_strings = 0;
/* Wmain is enabled by default in C++ but not in C. */ /* Wmain is enabled by default in C++ but not in C. */
/* Wmain is disabled by default for -ffreestanding (!flag_hosted), /* Wmain is disabled by default for -ffreestanding (!flag_hosted),
even if -Wall was given (warn_main will be 2 if set by -Wall, 1 even if -Wall or -Wpedantic was given (warn_main will be 2 if set
if set by -Wmain). */ by -Wall, 1 if set by -Wmain). */
if (warn_main == -1) if (warn_main == -1)
warn_main = (c_dialect_cxx () && flag_hosted) ? 1 : 0; warn_main = (c_dialect_cxx () && flag_hosted) ? 1 : 0;
else if (warn_main == 2) else if (warn_main == 2)
warn_main = flag_hosted ? 1 : 0; warn_main = flag_hosted ? 1 : 0;
/* In C, -Wall and -Wc++-compat enable -Wenum-compare, which we do /* In C, -Wall and -Wc++-compat enable -Wenum-compare; if it has not
in c_common_handle_option; if it has not yet been set, it is yet been set, it is disabled by default. In C++, it is enabled
disabled by default. In C++, it is enabled by default. */ by default. */
if (warn_enum_compare == -1) if (warn_enum_compare == -1)
warn_enum_compare = c_dialect_cxx () ? 1 : 0; warn_enum_compare = c_dialect_cxx () ? 1 : 0;
...@@ -1228,7 +1182,7 @@ sanitize_cpp_opts (void) ...@@ -1228,7 +1182,7 @@ sanitize_cpp_opts (void)
/* Similarly with -Wno-variadic-macros. No check for c99 here, since /* Similarly with -Wno-variadic-macros. No check for c99 here, since
this also turns off warnings about GCCs extension. */ this also turns off warnings about GCCs extension. */
cpp_opts->warn_variadic_macros cpp_opts->warn_variadic_macros
= warn_variadic_macros && (pedantic || warn_traditional); = cpp_warn_variadic_macros && (pedantic || warn_traditional);
/* If we're generating preprocessor output, emit current directory /* If we're generating preprocessor output, emit current directory
if explicitly requested or if debugging information is enabled. if explicitly requested or if debugging information is enabled.
...@@ -1239,7 +1193,7 @@ sanitize_cpp_opts (void) ...@@ -1239,7 +1193,7 @@ sanitize_cpp_opts (void)
if (cpp_opts->directives_only) if (cpp_opts->directives_only)
{ {
if (warn_unused_macros) if (cpp_warn_unused_macros)
error ("-fdirectives-only is incompatible with -Wunused_macros"); error ("-fdirectives-only is incompatible with -Wunused_macros");
if (cpp_opts->traditional) if (cpp_opts->traditional)
error ("-fdirectives-only is incompatible with -traditional"); error ("-fdirectives-only is incompatible with -traditional");
...@@ -1382,7 +1336,7 @@ push_command_line_include (void) ...@@ -1382,7 +1336,7 @@ push_command_line_include (void)
{ {
include_cursor++; include_cursor++;
/* -Wunused-macros should only warn about macros defined hereafter. */ /* -Wunused-macros should only warn about macros defined hereafter. */
cpp_opts->warn_unused_macros = warn_unused_macros; cpp_opts->warn_unused_macros = cpp_warn_unused_macros;
/* Restore the line map from <command line>. */ /* Restore the line map from <command line>. */
if (!cpp_opts->preprocessed) if (!cpp_opts->preprocessed)
cpp_change_file (parse_in, LC_RENAME, this_input_filename); cpp_change_file (parse_in, LC_RENAME, this_input_filename);
......
...@@ -268,6 +268,10 @@ Wall ...@@ -268,6 +268,10 @@ Wall
C ObjC C++ ObjC++ Warning C ObjC C++ ObjC++ Warning
Enable most warning messages Enable most warning messages
Warray-bounds
LangEnabledBy(C ObjC C++ ObjC++,Wall)
; in common.opt
Wassign-intercept Wassign-intercept
ObjC ObjC++ Var(warn_assign_intercept) Warning ObjC ObjC++ Var(warn_assign_intercept) Warning
Warn whenever an Objective-C assignment is being intercepted by the garbage collector Warn whenever an Objective-C assignment is being intercepted by the garbage collector
...@@ -332,6 +336,10 @@ Wdelete-non-virtual-dtor ...@@ -332,6 +336,10 @@ Wdelete-non-virtual-dtor
C++ ObjC++ Var(warn_delnonvdtor) Warning LangEnabledBy(C++ ObjC++,Wall) C++ ObjC++ Var(warn_delnonvdtor) Warning LangEnabledBy(C++ ObjC++,Wall)
Warn about deleting polymorphic objects with non-virtual destructors Warn about deleting polymorphic objects with non-virtual destructors
Wdelete-non-virtual-dtor
LangEnabledBy(C++ ObjC++,Weffc++)
;
Wdeprecated Wdeprecated
C C++ ObjC ObjC++ Var(warn_deprecated) Init(1) Warning C C++ ObjC ObjC++ Var(warn_deprecated) Init(1) Warning
Warn if a deprecated compiler feature, class, method, or field is used Warn if a deprecated compiler feature, class, method, or field is used
...@@ -353,9 +361,13 @@ C ObjC C++ ObjC++ Warning ...@@ -353,9 +361,13 @@ C ObjC C++ ObjC++ Warning
Warn about stray tokens after #elif and #endif Warn about stray tokens after #elif and #endif
Wenum-compare Wenum-compare
C ObjC C++ ObjC++ Var(warn_enum_compare) Init(-1) Warning C ObjC C++ ObjC++ Var(warn_enum_compare) Init(-1) Warning LangEnabledBy(C ObjC,Wall)
Warn about comparison of different enum types Warn about comparison of different enum types
Wenum-compare
LangEnabledBy(C ObjC,Wc++-compat)
;
Werror Werror
C ObjC C++ ObjC++ C ObjC C++ ObjC++
; Documented in common.opt ; Documented in common.opt
...@@ -459,9 +471,13 @@ C ObjC C++ ObjC++ Var(warn_long_long) Init(-1) Warning ...@@ -459,9 +471,13 @@ C ObjC C++ ObjC++ Var(warn_long_long) Init(-1) Warning
Do not warn about using \"long long\" when -pedantic Do not warn about using \"long long\" when -pedantic
Wmain Wmain
C ObjC C++ ObjC++ Var(warn_main) Init(-1) Warning C ObjC C++ ObjC++ Var(warn_main) Init(-1) Warning LangEnabledBy(C ObjC,Wall, 2, 0)
Warn about suspicious declarations of \"main\" Warn about suspicious declarations of \"main\"
Wmain
LangEnabledBy(C ObjC C++ ObjC++,Wpedantic, 2, 0)
;
Wmissing-braces Wmissing-braces
C ObjC C++ ObjC++ Var(warn_missing_braces) Warning LangEnabledBy(C ObjC,Wall) C ObjC C++ ObjC++ Var(warn_missing_braces) Warning LangEnabledBy(C ObjC,Wall)
Warn about possibly missing braces around initializers Warn about possibly missing braces around initializers
...@@ -481,6 +497,18 @@ Wsuggest-attribute=format ...@@ -481,6 +497,18 @@ Wsuggest-attribute=format
C ObjC C++ ObjC++ Var(warn_suggest_attribute_format) Warning C ObjC C++ ObjC++ Var(warn_suggest_attribute_format) Warning
Warn about functions which might be candidates for format attributes Warn about functions which might be candidates for format attributes
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
Wmissing-format-attribute Wmissing-format-attribute
C ObjC C++ ObjC++ Alias(Wsuggest-attribute=format) C ObjC C++ ObjC++ Alias(Wsuggest-attribute=format)
; ;
...@@ -550,7 +578,7 @@ C ObjC Var(warn_old_style_definition) Warning ...@@ -550,7 +578,7 @@ C ObjC Var(warn_old_style_definition) Warning
Warn if an old-style parameter definition is used Warn if an old-style parameter definition is used
Woverlength-strings Woverlength-strings
C ObjC C++ ObjC++ Var(warn_overlength_strings) Init(-1) Warning C ObjC C++ ObjC++ Var(warn_overlength_strings) Warning LangEnabledBy(C ObjC C++ ObjC++,Wpedantic)
Warn if a string is longer than the maximum portable length specified by the standard Warn if a string is longer than the maximum portable length specified by the standard
Woverloaded-virtual Woverloaded-virtual
...@@ -706,7 +734,7 @@ C ObjC C++ ObjC++ LangEnabledBy(C ObjC C++ ObjC++,Wall) ...@@ -706,7 +734,7 @@ C ObjC C++ ObjC++ LangEnabledBy(C ObjC C++ ObjC++,Wall)
; ;
Wunknown-pragmas Wunknown-pragmas
C ObjC C++ ObjC++ Warning C ObjC C++ ObjC++ Warning Var(warn_unknown_pragmas) LangEnabledBy(C ObjC C++ ObjC++,Wall, 1, 0)
Warn about unrecognized pragmas Warn about unrecognized pragmas
Wunsuffixed-float-constants Wunsuffixed-float-constants
...@@ -722,7 +750,7 @@ C ObjC C++ ObjC++ Var(warn_unused_local_typedefs) Warning EnabledBy(Wunused) ...@@ -722,7 +750,7 @@ C ObjC C++ ObjC++ Var(warn_unused_local_typedefs) Warning EnabledBy(Wunused)
Warn when typedefs locally defined in a function are not used Warn when typedefs locally defined in a function are not used
Wunused-macros Wunused-macros
C ObjC C++ ObjC++ Warning C ObjC C++ ObjC++ Var(cpp_warn_unused_macros) Warning
Warn about macros defined in the main file that are not used Warn about macros defined in the main file that are not used
Wunused-result Wunused-result
...@@ -730,8 +758,8 @@ C ObjC C++ ObjC++ Var(warn_unused_result) Init(1) Warning ...@@ -730,8 +758,8 @@ C ObjC C++ ObjC++ Var(warn_unused_result) Init(1) Warning
Warn if a caller of a function, marked with attribute warn_unused_result, does not use its return value Warn if a caller of a function, marked with attribute warn_unused_result, does not use its return value
Wvariadic-macros Wvariadic-macros
C ObjC C++ ObjC++ Warning C ObjC C++ ObjC++ Var(cpp_warn_variadic_macros) Init(1) Warning
Do not warn about using variadic macros when -pedantic Warn about using variadic macros
Wvarargs Wvarargs
C ObjC C++ ObjC++ Warning Var(warn_varargs) Init(1) C ObjC C++ ObjC++ Warning Var(warn_varargs) Init(1)
......
...@@ -632,18 +632,6 @@ Wsuggest-attribute=noreturn ...@@ -632,18 +632,6 @@ Wsuggest-attribute=noreturn
Common Var(warn_suggest_attribute_noreturn) Warning Common Var(warn_suggest_attribute_noreturn) Warning
Warn about functions which might be candidates for __attribute__((noreturn)) Warn about functions which might be candidates for __attribute__((noreturn))
Wswitch
Common Var(warn_switch) Warning
Warn about enumerated switches, with no default, missing a case
Wswitch-default
Common Var(warn_switch_default) Warning
Warn about enumerated switches missing a \"default:\" statement
Wswitch-enum
Common Var(warn_switch_enum) Warning
Warn about all enumerated switches missing a specific case
Wsystem-headers Wsystem-headers
Common Var(warn_system_headers) Warning Common Var(warn_system_headers) Warning
Do not suppress warnings from system headers Do not suppress warnings from system headers
......
2012-11-07 Manuel López-Ibáñez <manu@gcc.gnu.org>
PR c/53063
* options.c (set_Wall): Do not set warn_switch here.
2012-11-06 Janus Weil <janus@gcc.gnu.org> 2012-11-06 Janus Weil <janus@gcc.gnu.org>
PR fortran/54917 PR fortran/54917
......
...@@ -478,7 +478,6 @@ set_Wall (int setting) ...@@ -478,7 +478,6 @@ set_Wall (int setting)
gfc_option.warn_target_lifetime = setting; gfc_option.warn_target_lifetime = setting;
warn_return_type = setting; warn_return_type = setting;
warn_switch = setting;
warn_uninitialized = setting; warn_uninitialized = setting;
warn_maybe_uninitialized = setting; warn_maybe_uninitialized = setting;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment