[7/8] Shadowing fix in gdbscm_frame_read_var

Message ID 20180923040814.27941-8-tom@tromey.com
State New, archived
Headers

Commit Message

Tom Tromey Sept. 23, 2018, 4:08 a.m. UTC
  -Wshadow=local pointed out that the shadowing in gdbscm_frame_read_var
means that the ultimate call to read_var_value will always be passed
block==NULL.  The fix is to remove the outer declaration.

gdb/ChangeLog
2018-09-22  Tom Tromey  <tom@tromey.com>

	* guile/scm-frame.c (gdbscm_frame_read_var): Remove inner
	declaration of "block".
---
 gdb/ChangeLog         | 5 +++++
 gdb/guile/scm-frame.c | 1 -
 2 files changed, 5 insertions(+), 1 deletion(-)
  

Comments

Simon Marchi Oct. 3, 2018, 4:12 p.m. UTC | #1
On 2018-09-23 12:08 AM, Tom Tromey wrote:
> -Wshadow=local pointed out that the shadowing in gdbscm_frame_read_var

> means that the ultimate call to read_var_value will always be passed

> block==NULL.  The fix is to remove the outer declaration.


s/outer/inner/ ?

The code LGTM.

Simon
  
Tom Tromey Oct. 4, 2018, 12:43 p.m. UTC | #2
>>>>> "Simon" == Simon Marchi <simon.marchi@ericsson.com> writes:

Simon> On 2018-09-23 12:08 AM, Tom Tromey wrote:
>> -Wshadow=local pointed out that the shadowing in gdbscm_frame_read_var
>> means that the ultimate call to read_var_value will always be passed
>> block==NULL.  The fix is to remove the outer declaration.

Simon> s/outer/inner/ ?

Yes, thanks.  I've updated the commit message.

Tom
  

Patch

diff --git a/gdb/guile/scm-frame.c b/gdb/guile/scm-frame.c
index 3d27907e19..5a056de332 100644
--- a/gdb/guile/scm-frame.c
+++ b/gdb/guile/scm-frame.c
@@ -878,7 +878,6 @@  gdbscm_frame_read_var (SCM self, SCM symbol_scm, SCM rest)
     }
   else if (scm_is_string (symbol_scm))
     {
-      const struct block *block = NULL;
       struct gdb_exception except = exception_none;
 
       if (! SCM_UNBNDP (block_scm))