Patchwork [SPAM] Re: [PATCH 0/8] Add -Wshadow=local

login
register
mail settings
Submitter Tom Tromey
Date Oct. 5, 2018, 1:37 p.m.
Message ID <878t3cfra5.fsf@tromey.com>
Download mbox | patch
Permalink /patch/29657/
State New
Headers show

Comments

Tom Tromey - Oct. 5, 2018, 1:37 p.m.
>>>>> "Rainer" == Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE> writes:

Rainer> this patch series broke the Solaris builds:

Rainer> ../../binutils-gdb/gdb/sol-thread.c: In member function ‘virtual ptid_t sol_thread_target::wait(ptid_t, target_waitstatus*, int)’:
Rainer> ../../binutils-gdb/gdb/sol-thread.c:443:14: error: declaration of ‘save_ptid’ shadows a previous local [-Werror=shadow=compatible-local]
Rainer>        ptid_t save_ptid = ptid;
Rainer>               ^~~~~~~~~
Rainer> ../../binutils-gdb/gdb/sol-thread.c:432:10: note: shadowed declaration is here
Rainer>    ptid_t save_ptid;
Rainer>           ^~~~~~~~~

Thanks for the report.

If you can try the appended, that would be nice.  If not, I will check
it in, since it looks reasonably obviously correct.

Normally I would ask the buildbot to try it but I get:

    bapiya. buildbot try -b Solaris11-amd64-m64

    === ERROR: You probably have an invalid builder in the list of Try Builders ===
    === Please, double-check the list of available builders at ===
    === <https://sourceware.org/gdb/wiki/BuildBot#Configuration_file_for_.22buildbot_try.22> ===

... which seems incorrect to me.

Tom

commit 10554739e0b88e3332e7e63f1bf36d1e7a25442f
Author: Tom Tromey <tom@tromey.com>
Date:   Fri Oct 5 07:28:16 2018 -0600

    Fix -Wshadow=local warning in sol_thread_target::wait
    
    Rainer pointed out that -Wshadow=local broke the Solaris build.
    This fixes it.
    
    gdb/ChangeLog
    2018-10-05  Tom Tromey  <tom@tromey.com>
    
            * sol-thread.c (sol_thread_target::wait): Rename inner
            "save_ptid".
Rainer Orth - Oct. 5, 2018, 3:57 p.m.
Hi Tom,

>>>>>> "Rainer" == Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE> writes:
>
> Rainer> this patch series broke the Solaris builds:
>
> Rainer> ../../binutils-gdb/gdb/sol-thread.c: In member function ‘virtual ptid_t sol_thread_target::wait(ptid_t, target_waitstatus*, int)’:
> Rainer> ../../binutils-gdb/gdb/sol-thread.c:443:14: error: declaration of ‘save_ptid’ shadows a previous local [-Werror=shadow=compatible-local]
> Rainer>        ptid_t save_ptid = ptid;
> Rainer>               ^~~~~~~~~
> Rainer> ../../binutils-gdb/gdb/sol-thread.c:432:10: note: shadowed declaration is here
> Rainer>    ptid_t save_ptid;
> Rainer>           ^~~~~~~~~
>
> Thanks for the report.
>
> If you can try the appended, that would be nice.  If not, I will check
> it in, since it looks reasonably obviously correct.

I just tested the patch on amd64-pc-solaris2.11 (-m64 only): nothing
more than the usual testsuite variations due to racy tests.  Thanks.

> Normally I would ask the buildbot to try it but I get:
>
>     bapiya. buildbot try -b Solaris11-amd64-m64
>
>     === ERROR: You probably have an invalid builder in the list of Try Builders ===
>     === Please, double-check the list of available builders at ===
>     === <https://sourceware.org/gdb/wiki/BuildBot#Configuration_file_for_.22buildbot_try.22> ===
>
> ... which seems incorrect to me.

This is weird indeed: I've changed nothing on the buildslaves, am pretty
certain that I saw runs of the Try scheduler from you before, and this
must be a buildmaster error anyway.

	Rainer

Patch

diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 912bdecfb2..a533ffdba2 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,8 @@ 
+2018-10-05  Tom Tromey  <tom@tromey.com>
+
+	* sol-thread.c (sol_thread_target::wait): Rename inner
+	"save_ptid".
+
 2018-10-04  Tom Tromey  <tom@tromey.com>
 
 	* configure: Rebuild.
diff --git a/gdb/sol-thread.c b/gdb/sol-thread.c
index 5cdc9a8c1e..682302a40b 100644
--- a/gdb/sol-thread.c
+++ b/gdb/sol-thread.c
@@ -440,14 +440,14 @@  sol_thread_target::wait (ptid_t ptid, struct target_waitstatus *ourstatus,
 
   if (ptid.pid () != -1)
     {
-      ptid_t save_ptid = ptid;
+      ptid_t ptid_for_warning = ptid;
 
       ptid = thread_to_lwp (ptid, -2);
       if (ptid.pid () == -2)		/* Inactive thread.  */
 	error (_("This version of Solaris can't start inactive threads."));
       if (info_verbose && ptid.pid () == -1)
 	warning (_("Specified thread %ld seems to have terminated"),
-		 save_ptid.tid ());
+		 ptid_for_warning.tid ());
     }
 
   rtnval = beneath ()->wait (ptid, ourstatus, options);