Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [PATCH 20/348] Fix -Wsahdow warnings
@ 2011-11-22 13:03 Andrey Smirnov
  2011-11-22 18:07 ` Tom Tromey
  2011-11-23 16:39 ` [PATCH 20/348] Fix -Wsahdow warnings Mark Kettenis
  0 siblings, 2 replies; 8+ messages in thread
From: Andrey Smirnov @ 2011-11-22 13:03 UTC (permalink / raw)
  To: gdb-patches

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Fix -Wshadow warnings --]
[-- Type: text/x-diff, Size: 1506 bytes --]

From 34aaf4f75c58e9a453184a8df62d7b871afd2e54 Mon Sep 17 00:00:00 2001
From: Andrey Smirnov <andrew.smirnov@gmail.com>
Date: Tue, 22 Nov 2011 17:29:45 +0700
Subject: [PATCH 20/39] Fix -Wshadow warnings.

* amd64-tdep.c (amd64_push_dummy_call): Fix -Wshadow
warnings.
---
 gdb/ChangeLog    |    5 +++++
 gdb/amd64-tdep.c |    5 +++--
 2 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 645743b..4daf760 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,10 @@
 2011-11-22  Andrey Smirnov <andrew.smirnov@gmail.com>
 
+	* amd64-tdep.c (amd64_push_dummy_call): Fix -Wshadow
+	warnings.
+
+2011-11-22  Andrey Smirnov <andrew.smirnov@gmail.com>
+
 	* amd64-tdep.c (amd64_get_unused_input_int_reg): Fix -Wshadow
 	warnings.
 
diff --git a/gdb/amd64-tdep.c b/gdb/amd64-tdep.c
index 29101a4..095a34f 100644
--- a/gdb/amd64-tdep.c
+++ b/gdb/amd64-tdep.c
@@ -878,10 +878,11 @@ amd64_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
   /* Pass "hidden" argument".  */
   if (struct_return)
     {
-      struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
       /* The "hidden" argument is passed throught the first argument
          register.  */
-      const int arg_regnum = tdep->call_dummy_integer_regs[0];
+
+      const int arg_regnum =
+        gdbarch_tdep (gdbarch)->call_dummy_integer_regs[0];
 
       store_unsigned_integer (buf, 8, byte_order, struct_addr);
       regcache_cooked_write (regcache, arg_regnum, buf);
-- 
1.7.5.4


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 20/348] Fix -Wsahdow warnings
  2011-11-22 13:03 [PATCH 20/348] Fix -Wsahdow warnings Andrey Smirnov
@ 2011-11-22 18:07 ` Tom Tromey
  2011-11-28 15:17   ` [PATCH 020/238] [misc.] amd64-tdep.: -Wshadow fix Andrey Smirnov
  2011-11-23 16:39 ` [PATCH 20/348] Fix -Wsahdow warnings Mark Kettenis
  1 sibling, 1 reply; 8+ messages in thread
From: Tom Tromey @ 2011-11-22 18:07 UTC (permalink / raw)
  To: Andrey Smirnov; +Cc: gdb-patches

>>>>> "Andrey" == Andrey Smirnov <andrew.smirnov@gmail.com> writes:

Andrey> * amd64-tdep.c (amd64_push_dummy_call): Fix -Wshadow
Andrey> warnings.
Andrey> -      struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
Andrey>        /* The "hidden" argument is passed throught the first argument
Andrey>           register.  */
Andrey> -      const int arg_regnum = tdep->call_dummy_integer_regs[0];
Andrey> +
Andrey> +      const int arg_regnum =
Andrey> +        gdbarch_tdep (gdbarch)->call_dummy_integer_regs[0];

Here you can just remove 'tdep' and use the outer one.
It has the same value.
That is, no change to arg_regnum's initialization is needed.

Tom


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 20/348] Fix -Wsahdow warnings
  2011-11-22 13:03 [PATCH 20/348] Fix -Wsahdow warnings Andrey Smirnov
  2011-11-22 18:07 ` Tom Tromey
@ 2011-11-23 16:39 ` Mark Kettenis
  2011-11-23 16:56   ` Tom Tromey
  2011-11-24  3:19   ` Andrey Smirnov
  1 sibling, 2 replies; 8+ messages in thread
From: Mark Kettenis @ 2011-11-23 16:39 UTC (permalink / raw)
  To: andrew.smirnov; +Cc: gdb-patches

> From: Andrey Smirnov <andrew.smirnov@gmail.com>
> Date: Tue, 22 Nov 2011 20:02:56 +0700
> 
> From: Andrey Smirnov <andrew.smirnov@gmail.com>
> Date: Tue, 22 Nov 2011 17:29:45 +0700
> 
> * amd64-tdep.c (amd64_push_dummy_call): Fix -Wshadow
> warnings.

That's a stupid change.  Please simply remove the 2nd tdep declaration
in that function and leave the rest of the code as is.

> diff --git a/gdb/amd64-tdep.c b/gdb/amd64-tdep.c
> index 29101a4..095a34f 100644
> --- a/gdb/amd64-tdep.c
> +++ b/gdb/amd64-tdep.c
> @@ -878,10 +878,11 @@ amd64_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
>    /* Pass "hidden" argument".  */
>    if (struct_return)
>      {
> -      struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
>        /* The "hidden" argument is passed throught the first argument
>           register.  */
> -      const int arg_regnum = tdep->call_dummy_integer_regs[0];
> +
> +      const int arg_regnum =
> +        gdbarch_tdep (gdbarch)->call_dummy_integer_regs[0];
>  
>        store_unsigned_integer (buf, 8, byte_order, struct_addr);
>        regcache_cooked_write (regcache, arg_regnum, buf);
> -- 
> 1.7.5.4
> 
> 


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 20/348] Fix -Wsahdow warnings
  2011-11-23 16:39 ` [PATCH 20/348] Fix -Wsahdow warnings Mark Kettenis
@ 2011-11-23 16:56   ` Tom Tromey
  2011-11-23 17:08     ` Mark Kettenis
  2011-11-24  3:19   ` Andrey Smirnov
  1 sibling, 1 reply; 8+ messages in thread
From: Tom Tromey @ 2011-11-23 16:56 UTC (permalink / raw)
  To: Mark Kettenis; +Cc: andrew.smirnov, gdb-patches

>>>>> "Mark" == Mark Kettenis <mark.kettenis@xs4all.nl> writes:

Mark> That's a stupid change.

Please be more polite.

Tom


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 20/348] Fix -Wsahdow warnings
  2011-11-23 16:56   ` Tom Tromey
@ 2011-11-23 17:08     ` Mark Kettenis
  0 siblings, 0 replies; 8+ messages in thread
From: Mark Kettenis @ 2011-11-23 17:08 UTC (permalink / raw)
  To: tromey; +Cc: andrew.smirnov, gdb-patches

> From: Tom Tromey <tromey@redhat.com>
> Date: Wed, 23 Nov 2011 09:56:12 -0700
> 
> Mark> That's a stupid change.
> 
> Please be more polite.

Sorry, I was a bit annoyed by the mere idea of reviewing 350
apparently largely automatically generated diffs.


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 20/348] Fix -Wsahdow warnings
  2011-11-23 16:39 ` [PATCH 20/348] Fix -Wsahdow warnings Mark Kettenis
  2011-11-23 16:56   ` Tom Tromey
@ 2011-11-24  3:19   ` Andrey Smirnov
  1 sibling, 0 replies; 8+ messages in thread
From: Andrey Smirnov @ 2011-11-24  3:19 UTC (permalink / raw)
  To: Mark Kettenis; +Cc: gdb-patches

On Wed, Nov 23, 2011 at 11:39 PM, Mark Kettenis <mark.kettenis@xs4all.nl> wrote:
>> From: Andrey Smirnov <andrew.smirnov@gmail.com>
>> Date: Tue, 22 Nov 2011 20:02:56 +0700
>>
>> From: Andrey Smirnov <andrew.smirnov@gmail.com>
>> Date: Tue, 22 Nov 2011 17:29:45 +0700
>>
>> * amd64-tdep.c (amd64_push_dummy_call): Fix -Wshadow
>> warnings.
>
> That's a stupid change.  Please simply remove the 2nd tdep declaration
> in that function and leave the rest of the code as is.
>

That may very well be, but changing it that way allowed me, a person without
solid knowledge of the codebase, to be sure I didn't introduce any
side effects since changing it the way you propose would rewrite the
value of `tdep'. That was my reasoning for doing it. Was it
invalid?

Andrey Smirnov

P.S. I'll change it.


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH 020/238] [misc.] amd64-tdep.: -Wshadow fix
  2011-11-22 18:07 ` Tom Tromey
@ 2011-11-28 15:17   ` Andrey Smirnov
  2011-11-28 16:17     ` Mark Kettenis
  0 siblings, 1 reply; 8+ messages in thread
From: Andrey Smirnov @ 2011-11-28 15:17 UTC (permalink / raw)
  To: gdb-patches; +Cc: tromey

Cause:
        It is a ALBW type of clash, the first declaration of the
        variable is at the beginning of the function.

To ChangeLog:
	* amd64-tdep.c (amd64_push_dummy_call): Remove nested
        definition of `tdep'(-Wshadow).
---
 gdb/ChangeLog    |    5 +++++
 gdb/amd64-tdep.c |    1 -
 2 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 6dbac0d..6e1121d 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,10 @@
 2011-11-22  Andrey Smirnov <andrew.smirnov@gmail.com>
 
+	* amd64-tdep.c (amd64_push_dummy_call): Fix -Wshadow
+	warnings.
+
+2011-11-22  Andrey Smirnov <andrew.smirnov@gmail.com>
+
 	* amd64-tdep.c (amd64_get_unused_input_int_reg): Fix -Wshadow
 	warnings.
 
diff --git a/gdb/amd64-tdep.c b/gdb/amd64-tdep.c
index 29101a4..987f80d 100644
--- a/gdb/amd64-tdep.c
+++ b/gdb/amd64-tdep.c
@@ -878,7 +878,6 @@ amd64_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
   /* Pass "hidden" argument".  */
   if (struct_return)
     {
-      struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
       /* The "hidden" argument is passed throught the first argument
          register.  */
       const int arg_regnum = tdep->call_dummy_integer_regs[0];
-- 
1.7.5.4


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 020/238] [misc.] amd64-tdep.: -Wshadow fix
  2011-11-28 15:17   ` [PATCH 020/238] [misc.] amd64-tdep.: -Wshadow fix Andrey Smirnov
@ 2011-11-28 16:17     ` Mark Kettenis
  0 siblings, 0 replies; 8+ messages in thread
From: Mark Kettenis @ 2011-11-28 16:17 UTC (permalink / raw)
  To: andrew.smirnov; +Cc: gdb-patches, tromey

> From: Andrey Smirnov <andrew.smirnov@gmail.com>
> Date: Mon, 28 Nov 2011 22:16:36 +0700
> 
> Cause:
>         It is a ALBW type of clash, the first declaration of the
>         variable is at the beginning of the function.
> 
> To ChangeLog:
> 	* amd64-tdep.c (amd64_push_dummy_call): Remove nested
>         definition of `tdep'(-Wshadow).

ok kettenis@

> ---
>  gdb/ChangeLog    |    5 +++++
>  gdb/amd64-tdep.c |    1 -
>  2 files changed, 5 insertions(+), 1 deletions(-)
> 
> diff --git a/gdb/ChangeLog b/gdb/ChangeLog
> index 6dbac0d..6e1121d 100644
> --- a/gdb/ChangeLog
> +++ b/gdb/ChangeLog
> @@ -1,5 +1,10 @@
>  2011-11-22  Andrey Smirnov <andrew.smirnov@gmail.com>
>  
> +	* amd64-tdep.c (amd64_push_dummy_call): Fix -Wshadow
> +	warnings.
> +
> +2011-11-22  Andrey Smirnov <andrew.smirnov@gmail.com>
> +
>  	* amd64-tdep.c (amd64_get_unused_input_int_reg): Fix -Wshadow
>  	warnings.
>  
> diff --git a/gdb/amd64-tdep.c b/gdb/amd64-tdep.c
> index 29101a4..987f80d 100644
> --- a/gdb/amd64-tdep.c
> +++ b/gdb/amd64-tdep.c
> @@ -878,7 +878,6 @@ amd64_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
>    /* Pass "hidden" argument".  */
>    if (struct_return)
>      {
> -      struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
>        /* The "hidden" argument is passed throught the first argument
>           register.  */
>        const int arg_regnum = tdep->call_dummy_integer_regs[0];
> -- 
> 1.7.5.4
> 
> 


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2011-11-28 16:17 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-11-22 13:03 [PATCH 20/348] Fix -Wsahdow warnings Andrey Smirnov
2011-11-22 18:07 ` Tom Tromey
2011-11-28 15:17   ` [PATCH 020/238] [misc.] amd64-tdep.: -Wshadow fix Andrey Smirnov
2011-11-28 16:17     ` Mark Kettenis
2011-11-23 16:39 ` [PATCH 20/348] Fix -Wsahdow warnings Mark Kettenis
2011-11-23 16:56   ` Tom Tromey
2011-11-23 17:08     ` Mark Kettenis
2011-11-24  3:19   ` Andrey Smirnov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox