Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [PATCH] remote-sim.c: Fix arg variables conflicts
@ 2017-08-05 17:11 Simon Marchi
  2017-08-07  9:52 ` Yao Qi
  0 siblings, 1 reply; 3+ messages in thread
From: Simon Marchi @ 2017-08-05 17:11 UTC (permalink / raw)
  To: gdb-patches; +Cc: tom, Simon Marchi

The recent change introducing gdb_argv introduced some build failures in
remote-sim.c.

  /home/emaisin/src/binutils-gdb/gdb/remote-sim.c: In function 'void gdbsim_load(target_ops*, const char*, int)':
  /home/emaisin/src/binutils-gdb/gdb/remote-sim.c:573:22: error: conflicting declaration 'gdb_argv argv'
     gdb_argv argv (args);
                        ^
  /home/emaisin/src/binutils-gdb/gdb/remote-sim.c:565:10: note: previous declaration as 'char** argv'
     char **argv;
            ^~~~
  /home/emaisin/src/binutils-gdb/gdb/remote-sim.c: In function 'void gdbsim_open(const char*, int)':
  /home/emaisin/src/binutils-gdb/gdb/remote-sim.c:730:25: error: declaration of 'gdb_argv args' shadows a parameter
     gdb_argv args (arg_buf);

In gdbsim_load, the new gdb_argv object conflicts with old char **argv
variable.  I think the old variable should be removed.

In gdbsim_open, the new gdb_argv object conflicts with the args
parameter.  This patch renames it to argv.

Built-tested for a mips host.

gdb/ChangeLog:

	* remote-sim.c (gdbsim_load): Remove char **argv local variable.
	(gdbsim_open): Rename gdb_argv args object to argv.
---
 gdb/remote-sim.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/gdb/remote-sim.c b/gdb/remote-sim.c
index 75b1f56..ca824d7 100644
--- a/gdb/remote-sim.c
+++ b/gdb/remote-sim.c
@@ -562,7 +562,6 @@ gdbsim_kill (struct target_ops *ops)
 static void
 gdbsim_load (struct target_ops *self, const char *args, int fromtty)
 {
-  char **argv;
   const char *prog;
   struct sim_inferior_data *sim_data
     = get_sim_inferior_data (current_inferior (), SIM_INSTANCE_NEEDED);
@@ -727,8 +726,8 @@ gdbsim_open (const char *args, int from_tty)
       strcat (arg_buf, args);
     }
 
-  gdb_argv args (arg_buf);
-  sim_argv = args.get ();
+  gdb_argv argv (arg_buf);
+  sim_argv = argv.get ();
 
   init_callbacks ();
   gdbsim_desc = sim_open (SIM_OPEN_DEBUG, &gdb_callback, exec_bfd, sim_argv);
@@ -739,7 +738,7 @@ gdbsim_open (const char *args, int from_tty)
       error (_("unable to create simulator instance"));
     }
 
-  args.release ();
+  argv.release ();
 
   /* Reset the pid numberings for this batch of sim instances.  */
   next_pid = INITIAL_PID;
-- 
2.7.4


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

* Re: [PATCH] remote-sim.c: Fix arg variables conflicts
  2017-08-05 17:11 [PATCH] remote-sim.c: Fix arg variables conflicts Simon Marchi
@ 2017-08-07  9:52 ` Yao Qi
  2017-08-07 10:14   ` Simon Marchi
  0 siblings, 1 reply; 3+ messages in thread
From: Yao Qi @ 2017-08-07  9:52 UTC (permalink / raw)
  To: Simon Marchi; +Cc: gdb-patches, tom

Simon Marchi <simon.marchi@ericsson.com> writes:

> gdb/ChangeLog:
>
> 	* remote-sim.c (gdbsim_load): Remove char **argv local variable.
> 	(gdbsim_open): Rename gdb_argv args object to argv.

It breaks the arm-none-eabi build too.  Patch is good to me.

-- 
Yao (齐尧)


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

* Re: [PATCH] remote-sim.c: Fix arg variables conflicts
  2017-08-07  9:52 ` Yao Qi
@ 2017-08-07 10:14   ` Simon Marchi
  0 siblings, 0 replies; 3+ messages in thread
From: Simon Marchi @ 2017-08-07 10:14 UTC (permalink / raw)
  To: Yao Qi; +Cc: Simon Marchi, gdb-patches, tom

On 2017-08-07 11:52, Yao Qi wrote:
> Simon Marchi <simon.marchi@ericsson.com> writes:
> 
>> gdb/ChangeLog:
>> 
>> 	* remote-sim.c (gdbsim_load): Remove char **argv local variable.
>> 	(gdbsim_open): Rename gdb_argv args object to argv.
> 
> It breaks the arm-none-eabi build too.  Patch is good to me.

Thanks, I pushed it.


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

end of thread, other threads:[~2017-08-07 10:14 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-08-05 17:11 [PATCH] remote-sim.c: Fix arg variables conflicts Simon Marchi
2017-08-07  9:52 ` Yao Qi
2017-08-07 10:14   ` Simon Marchi

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