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
This commit is contained in:
Manuel López-Ibáñez 2008-08-08 23:15:31 +00:00
parent d40c9e3333
commit e73f7547c5
13 changed files with 92 additions and 49 deletions

View file

@ -1,17 +1,35 @@
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>
* doc/invoke.texi: Add cpu_type power7.
* config.in (HAVE_AS_VSX): New.
* config.gcc: Add cpu_type power7.
* configure.ac (HAVE_AS_VSX): Check for assembler support of the
VSX instructions.
* configure: Regenerate.
* config/rs6000/rs6000.c (rs6000_override_options): Alias power7 to
power5.
* config/rs6000/rs6000.h (ASM_CPU_POWER7_SPEC): Define.
(ASM_CPU_SPEC): Pass %(asm_cpu_power7) for -mcpu=power7.
(EXTRA_SPECS): Add asm_cpu_power7 spec string.
* doc/invoke.texi: Add cpu_type power7.
* config.in (HAVE_AS_VSX): New.
* config.gcc: Add cpu_type power7.
* configure.ac (HAVE_AS_VSX): Check for assembler support of the
VSX instructions.
* configure: Regenerate.
* config/rs6000/rs6000.c (rs6000_override_options): Alias power7 to
power5.
* config/rs6000/rs6000.h (ASM_CPU_POWER7_SPEC): Define.
(ASM_CPU_SPEC): Pass %(asm_cpu_power7) for -mcpu=power7.
(EXTRA_SPECS): Add asm_cpu_power7 spec string.
2008-08-08 Dorit Nuzman <dorit@il.ibm.com>
* tree-vect-transform.c (vectorizable_conversion): Pass the integral

View file

@ -376,7 +376,7 @@ c_common_handle_option (size_t scode, const char *arg, int value)
break;
case OPT_Wall:
set_Wunused (value);
warn_unused = value;
set_Wformat (value);
set_Wimplicit (value);
warn_char_subscripts = value;

View file

@ -210,27 +210,27 @@ Common Var(warn_notreached) Warning
Warn about code that will never be executed
Wunused
Common Warning
Common Var(warn_unused) Init(0) Warning
Enable all -Wunused- warnings
Wunused-function
Common Var(warn_unused_function) Warning
Common Var(warn_unused_function) Init(-1) Warning
Warn when a function is unused
Wunused-label
Common Var(warn_unused_label) Warning
Common Var(warn_unused_label) Init(-1) Warning
Warn when a label is unused
Wunused-parameter
Common Var(warn_unused_parameter) Warning
Common Var(warn_unused_parameter) Init(-1) Warning
Warn when a function parameter is unused
Wunused-value
Common Var(warn_unused_value) Warning
Common Var(warn_unused_value) Init(-1) Warning
Warn when an expression value is unused
Wunused-variable
Common Var(warn_unused_variable) Warning
Common Var(warn_unused_variable) Init(-1) Warning
Warn when a variable is unused
Wcoverage-mismatch

View file

@ -115,12 +115,6 @@ extern int optimize_size;
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.
The external way to set the default level is to use
-Wstrict-aliasing=level.

View file

@ -1,3 +1,8 @@
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>
* gfortran.h (gfc_finalizer): Replaced member `procedure' by two

View file

@ -376,7 +376,7 @@ set_Wall (int setting)
gfc_option.warn_intrinsics_std = setting;
gfc_option.warn_character_truncation = setting;
set_Wunused (setting);
warn_unused = setting;
warn_return_type = setting;
warn_switch = setting;

View file

@ -1,3 +1,9 @@
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>
* gcj.texi: Update copyright years. Do not list GPL as

View file

@ -221,7 +221,7 @@ java_handle_option (size_t scode, const char *arg, int value)
flag_wall = value;
/* When -Wall given, enable -Wunused. We do this because the C
compiler does it, and people expect it. */
set_Wunused (value);
warn_unused = value;
break;
case OPT_fenable_assertions_:

View file

@ -63,9 +63,6 @@ HOST_WIDE_INT larger_than_size;
bool warn_frame_larger_than;
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
flags.h for the definitions of the different possible types of
debugging information. */
@ -1667,7 +1664,7 @@ common_handle_option (size_t scode, const char *arg, int value,
break;
case OPT_Wunused:
set_Wunused (value);
warn_unused = value;
break;
case OPT_aux_info:
@ -2037,7 +2034,6 @@ static void
set_Wextra (int setting)
{
extra_warnings = setting;
warn_unused_parameter = (setting && maybe_warn_unused_parameter);
/* We save the value of warn_uninitialized, since if they put
-Wuninitialized on the command line, we need to generate a
@ -2048,23 +2044,6 @@ set_Wextra (int setting)
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,
when no level is specified (i.e., when -Wstrict-aliasing, and not
-Wstrict-aliasing=level was given).

View file

@ -1,3 +1,9 @@
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>
PR c++/35985

View file

@ -0,0 +1,11 @@
/* 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);
}

View file

@ -0,0 +1,11 @@
/* 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);
}

View file

@ -1644,6 +1644,19 @@ process_options (void)
This can happen with incorrect pre-processed input. */
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
initialization based on the command line options. This hook also
sets the original filename if appropriate (e.g. foo.i -> foo.c)