This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


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

Looking at the code, that's one location where I think the warning
is pretty nice; while it might not flag in the code, I think the code
itself could be clearer if we used two different variable names.
What's your take on this? Do you think it would make sense? And
would you be able to make that change; as far as I can tell, if
I were to attempt the change myself, I would probably change the name
of the first one to something like save_inferior_ptid, or something
like that.

Thanks!
-- 
Joel


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]