re PR c/28875 ("-Wextra -Wno-unused-parameter -Wall" doesn't work as expected)

2008-08-08  Manuel Lopez-Ibanez  <manu@gcc.gnu.org>

	PR 28875
	* flags.h (set_Wunused): Delete
	* toplev.c (process_options): Handle Wunused flags here.
	* opts.c (maybe_warn_unused_parameter): Delete.
	(common_handle_option): Replace set_Wunused by warn_unused.
	(set_Wextra): Do not handle Wunused-parameter here.
	(set_Wunused): Delete.
	* c-opts.c (c_common_handle_option): Replace set_Wunused by
	warn_unused.
	* common.opt (Wunused): Add Var and Init.
	(Wunused-function): Likewise.
	(Wunused-label): Likewise.
	(Wunused-parameter): Likewise.
	(Wunused-value): Likewise.
	(Wunused-variable): Likewise.
fortran/
	* options.c (set_Wall): Replace set_Wunused by warn_unused.
java/	
	* lang.c (java_handle_option): Replace set_Wunused with
	warn_unused.
testsuite/
	* gcc.dg/unused-6-no.c: New.
	* gcc.dg/unused-6-WallWextra.c: New.

From-SVN: r138890
parent d40c9e33
2008-08-08 Manuel Lopez-Ibanez <manu@gcc.gnu.org>
PR 28875
* flags.h (set_Wunused): Delete
* toplev.c (process_options): Handle Wunused flags here.
* opts.c (maybe_warn_unused_parameter): Delete.
(common_handle_option): Replace set_Wunused by warn_unused.
(set_Wextra): Do not handle Wunused-parameter here.
(set_Wunused): Delete.
* c-opts.c (c_common_handle_option): Replace set_Wunused by
warn_unused.
* common.opt (Wunused): Add Var and Init.
(Wunused-function): Likewise.
(Wunused-label): Likewise.
(Wunused-parameter): Likewise.
(Wunused-value): Likewise.
(Wunused-variable): Likewise.
2008-08-08 Peter Bergner <bergner@vnet.ibm.com> 2008-08-08 Peter Bergner <bergner@vnet.ibm.com>
* doc/invoke.texi: Add cpu_type power7. * doc/invoke.texi: Add cpu_type power7.
* config.in (HAVE_AS_VSX): New. * config.in (HAVE_AS_VSX): New.
* config.gcc: Add cpu_type power7. * config.gcc: Add cpu_type power7.
* configure.ac (HAVE_AS_VSX): Check for assembler support of the * configure.ac (HAVE_AS_VSX): Check for assembler support of the
VSX instructions. VSX instructions.
* configure: Regenerate. * configure: Regenerate.
* config/rs6000/rs6000.c (rs6000_override_options): Alias power7 to * config/rs6000/rs6000.c (rs6000_override_options): Alias power7 to
power5. power5.
* config/rs6000/rs6000.h (ASM_CPU_POWER7_SPEC): Define. * config/rs6000/rs6000.h (ASM_CPU_POWER7_SPEC): Define.
(ASM_CPU_SPEC): Pass %(asm_cpu_power7) for -mcpu=power7. (ASM_CPU_SPEC): Pass %(asm_cpu_power7) for -mcpu=power7.
(EXTRA_SPECS): Add asm_cpu_power7 spec string. (EXTRA_SPECS): Add asm_cpu_power7 spec string.
2008-08-08 Dorit Nuzman <dorit@il.ibm.com> 2008-08-08 Dorit Nuzman <dorit@il.ibm.com>
* tree-vect-transform.c (vectorizable_conversion): Pass the integral * tree-vect-transform.c (vectorizable_conversion): Pass the integral
......
...@@ -376,7 +376,7 @@ c_common_handle_option (size_t scode, const char *arg, int value) ...@@ -376,7 +376,7 @@ c_common_handle_option (size_t scode, const char *arg, int value)
break; break;
case OPT_Wall: case OPT_Wall:
set_Wunused (value); warn_unused = value;
set_Wformat (value); set_Wformat (value);
set_Wimplicit (value); set_Wimplicit (value);
warn_char_subscripts = value; warn_char_subscripts = value;
......
...@@ -210,27 +210,27 @@ Common Var(warn_notreached) Warning ...@@ -210,27 +210,27 @@ Common Var(warn_notreached) Warning
Warn about code that will never be executed Warn about code that will never be executed
Wunused Wunused
Common Warning Common Var(warn_unused) Init(0) Warning
Enable all -Wunused- warnings Enable all -Wunused- warnings
Wunused-function Wunused-function
Common Var(warn_unused_function) Warning Common Var(warn_unused_function) Init(-1) Warning
Warn when a function is unused Warn when a function is unused
Wunused-label Wunused-label
Common Var(warn_unused_label) Warning Common Var(warn_unused_label) Init(-1) Warning
Warn when a label is unused Warn when a label is unused
Wunused-parameter Wunused-parameter
Common Var(warn_unused_parameter) Warning Common Var(warn_unused_parameter) Init(-1) Warning
Warn when a function parameter is unused Warn when a function parameter is unused
Wunused-value Wunused-value
Common Var(warn_unused_value) Warning Common Var(warn_unused_value) Init(-1) Warning
Warn when an expression value is unused Warn when an expression value is unused
Wunused-variable Wunused-variable
Common Var(warn_unused_variable) Warning Common Var(warn_unused_variable) Init(-1) Warning
Warn when a variable is unused Warn when a variable is unused
Wcoverage-mismatch Wcoverage-mismatch
......
...@@ -115,12 +115,6 @@ extern int optimize_size; ...@@ -115,12 +115,6 @@ extern int optimize_size;
extern bool extra_warnings; extern bool extra_warnings;
/* Nonzero to warn about unused variables, functions et.al. Use
set_Wunused() to update the -Wunused-* flags that correspond to the
-Wunused option. */
extern void set_Wunused (int setting);
/* Used to set the level of -Wstrict-aliasing, when no level is specified. /* Used to set the level of -Wstrict-aliasing, when no level is specified.
The external way to set the default level is to use The external way to set the default level is to use
-Wstrict-aliasing=level. -Wstrict-aliasing=level.
......
2008-08-08 Manuel Lopez-Ibanez <manu@gcc.gnu.org>
PR 28875
* options.c (set_Wall): Replace set_Wunused by warn_unused.
2008-08-08 Daniel Kraft <d@domob.eu> 2008-08-08 Daniel Kraft <d@domob.eu>
* gfortran.h (gfc_finalizer): Replaced member `procedure' by two * gfortran.h (gfc_finalizer): Replaced member `procedure' by two
......
...@@ -376,7 +376,7 @@ set_Wall (int setting) ...@@ -376,7 +376,7 @@ set_Wall (int setting)
gfc_option.warn_intrinsics_std = setting; gfc_option.warn_intrinsics_std = setting;
gfc_option.warn_character_truncation = setting; gfc_option.warn_character_truncation = setting;
set_Wunused (setting); warn_unused = setting;
warn_return_type = setting; warn_return_type = setting;
warn_switch = setting; warn_switch = setting;
......
2008-08-08 Manuel Lopez-Ibanez <manu@gcc.gnu.org>
PR 28875
* lang.c (java_handle_option): Replace set_Wunused with
warn_unused.
2008-07-30 Ralf Wildenhues <Ralf.Wildenhues@gmx.de> 2008-07-30 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
* gcj.texi: Update copyright years. Do not list GPL as * gcj.texi: Update copyright years. Do not list GPL as
......
...@@ -221,7 +221,7 @@ java_handle_option (size_t scode, const char *arg, int value) ...@@ -221,7 +221,7 @@ java_handle_option (size_t scode, const char *arg, int value)
flag_wall = value; flag_wall = value;
/* When -Wall given, enable -Wunused. We do this because the C /* When -Wall given, enable -Wunused. We do this because the C
compiler does it, and people expect it. */ compiler does it, and people expect it. */
set_Wunused (value); warn_unused = value;
break; break;
case OPT_fenable_assertions_: case OPT_fenable_assertions_:
......
...@@ -63,9 +63,6 @@ HOST_WIDE_INT larger_than_size; ...@@ -63,9 +63,6 @@ HOST_WIDE_INT larger_than_size;
bool warn_frame_larger_than; bool warn_frame_larger_than;
HOST_WIDE_INT frame_larger_than_size; HOST_WIDE_INT frame_larger_than_size;
/* Hack for cooperation between set_Wunused and set_Wextra. */
static bool maybe_warn_unused_parameter;
/* Type(s) of debugging information we are producing (if any). See /* Type(s) of debugging information we are producing (if any). See
flags.h for the definitions of the different possible types of flags.h for the definitions of the different possible types of
debugging information. */ debugging information. */
...@@ -1667,7 +1664,7 @@ common_handle_option (size_t scode, const char *arg, int value, ...@@ -1667,7 +1664,7 @@ common_handle_option (size_t scode, const char *arg, int value,
break; break;
case OPT_Wunused: case OPT_Wunused:
set_Wunused (value); warn_unused = value;
break; break;
case OPT_aux_info: case OPT_aux_info:
...@@ -2037,7 +2034,6 @@ static void ...@@ -2037,7 +2034,6 @@ static void
set_Wextra (int setting) set_Wextra (int setting)
{ {
extra_warnings = setting; extra_warnings = setting;
warn_unused_parameter = (setting && maybe_warn_unused_parameter);
/* We save the value of warn_uninitialized, since if they put /* We save the value of warn_uninitialized, since if they put
-Wuninitialized on the command line, we need to generate a -Wuninitialized on the command line, we need to generate a
...@@ -2048,23 +2044,6 @@ set_Wextra (int setting) ...@@ -2048,23 +2044,6 @@ set_Wextra (int setting)
warn_uninitialized = 2; warn_uninitialized = 2;
} }
/* Initialize unused warning flags. */
void
set_Wunused (int setting)
{
warn_unused_function = setting;
warn_unused_label = setting;
/* Unused function parameter warnings are reported when either
``-Wextra -Wunused'' or ``-Wunused-parameter'' is specified.
Thus, if -Wextra has already been seen, set warn_unused_parameter;
otherwise set maybe_warn_extra_parameter, which will be picked up
by set_Wextra. */
maybe_warn_unused_parameter = setting;
warn_unused_parameter = (setting && extra_warnings);
warn_unused_variable = setting;
warn_unused_value = setting;
}
/* Used to set the level of strict aliasing warnings, /* Used to set the level of strict aliasing warnings,
when no level is specified (i.e., when -Wstrict-aliasing, and not when no level is specified (i.e., when -Wstrict-aliasing, and not
-Wstrict-aliasing=level was given). -Wstrict-aliasing=level was given).
......
2008-08-08 Manuel Lopez-Ibanez <manu@gcc.gnu.org>
PR 28875
* gcc.dg/unused-6-no.c: New.
* gcc.dg/unused-6-WallWextra.c: New.
2008-08-08 Volker Reichelt <v.reichelt@netcologne.de> 2008-08-08 Volker Reichelt <v.reichelt@netcologne.de>
PR c++/35985 PR c++/35985
......
/* PR 28875 */
/* { dg-do compile } */
/* { dg-options "-O3 -Wextra -Wall" } */
static int t(int i) /* { dg-warning "unused parameter" "unused parameter warning" } */
{
return 0;
}
int tt()
{
return t(0);
}
/* PR 28875 */
/* { dg-do compile } */
/* { dg-options "-O3 -Wextra -Wno-unused-parameter -Wall" } */
static int t(int i) /* { dg-bogus "unused parameter" "unused parameter warning" } */
{
return 0;
}
int tt()
{
return t(0);
}
...@@ -1644,6 +1644,19 @@ process_options (void) ...@@ -1644,6 +1644,19 @@ process_options (void)
This can happen with incorrect pre-processed input. */ This can happen with incorrect pre-processed input. */
debug_hooks = &do_nothing_debug_hooks; debug_hooks = &do_nothing_debug_hooks;
/* This replaces set_Wunused. */
if (warn_unused_function == -1)
warn_unused_function = warn_unused;
if (warn_unused_label == -1)
warn_unused_label = warn_unused;
/* Wunused-parameter is enabled if both -Wunused -Wextra are enabled. */
if (warn_unused_parameter == -1)
warn_unused_parameter = (warn_unused && extra_warnings);
if (warn_unused_variable == -1)
warn_unused_variable = warn_unused;
if (warn_unused_value == -1)
warn_unused_value = warn_unused;
/* Allow the front end to perform consistency checks and do further /* Allow the front end to perform consistency checks and do further
initialization based on the command line options. This hook also initialization based on the command line options. This hook also
sets the original filename if appropriate (e.g. foo.i -> foo.c) sets the original filename if appropriate (e.g. foo.i -> foo.c)
......
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