diff mbox series

Add -Wshadow=local

Message ID VI1PR03MB452844747084AF9A7FDA90F8E49F0@VI1PR03MB4528.eurprd03.prod.outlook.com
State New
Headers show
Series Add -Wshadow=local | expand

Commit Message

Bernd Edlinger Oct. 3, 2019, 3:17 p.m. UTC
Hi,

this adds -Wshadow=local to the GCC build rules.

It is to be applied after all other patches in this series
including the trivial ones are applied.

Bootstrapped and reg-tested on x86_64-pc-linux-gnu.
Is it OK for trunk?


Thanks
Bernd.

Comments

Richard Biener Oct. 4, 2019, 10:43 a.m. UTC | #1
On Thu, Oct 3, 2019 at 5:17 PM Bernd Edlinger <bernd.edlinger@hotmail.de> wrote:
>
> Hi,
>
> this adds -Wshadow=local to the GCC build rules.
>
> It is to be applied after all other patches in this series
> including the trivial ones are applied.
>
> Bootstrapped and reg-tested on x86_64-pc-linux-gnu.
> Is it OK for trunk?

The -Wshadow=local hunk is obviously OK but there's
a hunk in the patch adding -Wextra as well...?!

Richard.

>
>
> Thanks
> Bernd.
>
Bernd Edlinger Oct. 4, 2019, 11:21 a.m. UTC | #2
On 10/4/19 12:43 PM, Richard Biener wrote:
> On Thu, Oct 3, 2019 at 5:17 PM Bernd Edlinger <bernd.edlinger@hotmail.de> wrote:
>>
>> Hi,
>>
>> this adds -Wshadow=local to the GCC build rules.
>>
>> It is to be applied after all other patches in this series
>> including the trivial ones are applied.
>>
>> Bootstrapped and reg-tested on x86_64-pc-linux-gnu.
>> Is it OK for trunk?
> 
> The -Wshadow=local hunk is obviously OK but there's
> a hunk in the patch adding -Wextra as well...?!
> 

Yes, that replaces -W with -Wextra, I couldn't resist
to doing that when I was already there, since

gcc -v --help
prints:
-W   This switch is deprecated; use -Wextra instead

So the change log says that as well:

>         * configure.ac (ACX_PROG_CXX_WARNING_OPTS): Use -Wextra instead of -W.
>         Add -Wshadow=local.

Would you like me to split that patch for the -Wextra?


Bernd.
Richard Biener Oct. 4, 2019, 12:25 p.m. UTC | #3
On Fri, Oct 4, 2019 at 1:21 PM Bernd Edlinger <bernd.edlinger@hotmail.de> wrote:
>
> On 10/4/19 12:43 PM, Richard Biener wrote:
> > On Thu, Oct 3, 2019 at 5:17 PM Bernd Edlinger <bernd.edlinger@hotmail.de> wrote:
> >>
> >> Hi,
> >>
> >> this adds -Wshadow=local to the GCC build rules.
> >>
> >> It is to be applied after all other patches in this series
> >> including the trivial ones are applied.
> >>
> >> Bootstrapped and reg-tested on x86_64-pc-linux-gnu.
> >> Is it OK for trunk?
> >
> > The -Wshadow=local hunk is obviously OK but there's
> > a hunk in the patch adding -Wextra as well...?!
> >
>
> Yes, that replaces -W with -Wextra, I couldn't resist
> to doing that when I was already there, since
>
> gcc -v --help
> prints:
> -W   This switch is deprecated; use -Wextra instead
>
> So the change log says that as well:
>
> >         * configure.ac (ACX_PROG_CXX_WARNING_OPTS): Use -Wextra instead of -W.
> >         Add -Wshadow=local.
>
> Would you like me to split that patch for the -Wextra?

Oh, no need - just didin't look at the ChangeLog...

Richard.

>
> Bernd.
diff mbox series

Patch

2019-10-03  Bernd Edlinger  <bernd.edlinger@hotmail.de>

	* configure.ac (ACX_PROG_CXX_WARNING_OPTS): Use -Wextra instead of -W.
	Add -Wshadow=local.
	* configure: Regenerated.

Index: gcc/configure
===================================================================
--- gcc/configure	(revision 276484)
+++ gcc/configure	(working copy)
@@ -6751,7 +6751,7 @@  ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
 
 loose_warn=
 save_CXXFLAGS="$CXXFLAGS"
-for real_option in -W -Wall -Wno-narrowing -Wwrite-strings -Wcast-qual -Wno-error=format-diag $wf_opt; do
+for real_option in -Wall -Wextra -Wno-narrowing -Wwrite-strings -Wcast-qual -Wno-error=format-diag $wf_opt; do
   # Do the check with the no- prefix removed since gcc silently
   # accepts any -Wno-* option on purpose
   case $real_option in
@@ -6866,7 +6866,7 @@  ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
 
 strict_warn=
 save_CXXFLAGS="$CXXFLAGS"
-for real_option in -Wmissing-format-attribute -Woverloaded-virtual; do
+for real_option in -Wshadow=local -Wmissing-format-attribute -Woverloaded-virtual; do
   # Do the check with the no- prefix removed since gcc silently
   # accepts any -Wno-* option on purpose
   case $real_option in
Index: gcc/configure.ac
===================================================================
--- gcc/configure.ac	(revision 276484)
+++ gcc/configure.ac	(working copy)
@@ -482,7 +482,7 @@  AC_ARG_ENABLE(build-format-warnings,
 AS_IF([test $enable_build_format_warnings = no],
       [wf_opt=-Wno-format],[wf_opt=])
 ACX_PROG_CXX_WARNING_OPTS(
-	m4_quote(m4_do([-W -Wall -Wno-narrowing -Wwrite-strings ],
+	m4_quote(m4_do([-Wall -Wextra -Wno-narrowing -Wwrite-strings ],
 		       [-Wcast-qual -Wno-error=format-diag $wf_opt])),
 		       [loose_warn])
 ACX_PROG_CC_WARNING_OPTS(
@@ -489,7 +489,7 @@  ACX_PROG_CC_WARNING_OPTS(
 	m4_quote(m4_do([-Wstrict-prototypes -Wmissing-prototypes ],
 	 	       [-Wno-error=format-diag])), [c_loose_warn])
 ACX_PROG_CXX_WARNING_OPTS(
-	m4_quote(m4_do([-Wmissing-format-attribute ],
+	m4_quote(m4_do([-Wshadow=local -Wmissing-format-attribute ],
 		       [-Woverloaded-virtual])), [strict_warn])
 ACX_PROG_CC_WARNING_OPTS(
 	m4_quote(m4_do([-Wold-style-definition -Wc++-compat])), [c_strict_warn])