Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [ob] rename local variable in break_command_really.
@ 2009-06-11 18:57 Pedro Alves
  2009-06-11 20:37 ` Tom Tromey
  0 siblings, 1 reply; 2+ messages in thread
From: Pedro Alves @ 2009-06-11 18:57 UTC (permalink / raw)
  To: gdb-patches

I was doing some local debug changes to break_command_really, that
were introducing a usage of the ALL_BREAKPOINTS macro, and
mysteriously, the result was failing to compile.  Turns out this
function declares a variable named breakpoint_chain, which is the
same name of the global ALL_BREAKPOINTS references...

I've checked this in to hopefully avoid such headaches to
someone else (maybe me!) in the future.

-- 
Pedro Alves

2009-06-11  Pedro Alves  <pedro@codesourcery.com>

	* breakpoint.c (break_command_really): Rename local variable
	breakpoint_chain to bkpt_chain.

---
 gdb/breakpoint.c |   19 +++++++++----------
 1 file changed, 9 insertions(+), 10 deletions(-)

Index: src/gdb/breakpoint.c
===================================================================
--- src.orig/gdb/breakpoint.c	2009-06-11 19:45:08.000000000 +0100
+++ src/gdb/breakpoint.c	2009-06-11 19:47:13.000000000 +0100
@@ -5688,7 +5688,7 @@ break_command_really (char *arg, char *c
   char *addr_start = arg;
   char **addr_string;
   struct cleanup *old_chain;
-  struct cleanup *breakpoint_chain = NULL;
+  struct cleanup *bkpt_chain = NULL;
   struct captured_parse_breakpoint_args parse_args;
   int i;
   int pending = 0;
@@ -5766,12 +5766,11 @@ break_command_really (char *arg, char *c
   /* ----------------------------- SNIP -----------------------------
      Anything added to the cleanup chain beyond this point is assumed
      to be part of a breakpoint.  If the breakpoint create succeeds
-     then the memory is not reclaimed. */
-  breakpoint_chain = make_cleanup (null_cleanup, 0);
+     then the memory is not reclaimed.  */
+  bkpt_chain = make_cleanup (null_cleanup, 0);
 
   /* Mark the contents of the addr_string for cleanup.  These go on
-     the breakpoint_chain and only occure if the breakpoint create
-     fails. */
+     the bkpt_chain and only occur if the breakpoint create fails.  */
   for (i = 0; i < sals.nelts; i++)
     {
       if (addr_string[i] != NULL)
@@ -5843,13 +5842,13 @@ break_command_really (char *arg, char *c
   if (sals.nelts > 1)
     warning (_("Multiple breakpoints were set.\n"
 	       "Use the \"delete\" command to delete unwanted breakpoints."));
-  /* That's it. Discard the cleanups for data inserted into the
-     breakpoint. */
-  discard_cleanups (breakpoint_chain);
-  /* But cleanup everything else. */
+  /* That's it.  Discard the cleanups for data inserted into the
+     breakpoint.  */
+  discard_cleanups (bkpt_chain);
+  /* But cleanup everything else.  */
   do_cleanups (old_chain);
 
-  /* error call may happen here - have BREAKPOINT_CHAIN already discarded.  */
+  /* error call may happen here - have BKPT_CHAIN already discarded.  */
   update_global_location_list (1);
 }
 


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

* Re: [ob] rename local variable in break_command_really.
  2009-06-11 18:57 [ob] rename local variable in break_command_really Pedro Alves
@ 2009-06-11 20:37 ` Tom Tromey
  0 siblings, 0 replies; 2+ messages in thread
From: Tom Tromey @ 2009-06-11 20:37 UTC (permalink / raw)
  To: Pedro Alves; +Cc: gdb-patches

>>>>> "Pedro" == Pedro Alves <pedro@codesourcery.com> writes:

Pedro> I was doing some local debug changes to break_command_really, that
Pedro> were introducing a usage of the ALL_BREAKPOINTS macro, and
Pedro> mysteriously, the result was failing to compile.  Turns out this
Pedro> function declares a variable named breakpoint_chain, which is the
Pedro> same name of the global ALL_BREAKPOINTS references...

Pedro> I've checked this in to hopefully avoid such headaches to
Pedro> someone else (maybe me!) in the future.

Out of curiosity I tried a build with -Wshadow.  That gives more than
500 errors.  Unfortunately a lot of them (IMO) are somewhat bogus :(,
e.g., a warn about a local named "index" clashing with the global
function of the same name.

We do seem to have an uncommonly large number of local declarations
shadowing other locals though, e.g.:

../../src/gdb/osdata.c:331: error: declaration of ‘old_chain’ shadows a previous local
../../src/gdb/osdata.c:286: error: shadowed declaration is here

Tom


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

end of thread, other threads:[~2009-06-11 20:37 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-06-11 18:57 [ob] rename local variable in break_command_really Pedro Alves
2009-06-11 20:37 ` Tom Tromey

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