[RFA,09/13] Pass the correct argument to the observer in reread_symbols

Message ID 20180712205208.32646-10-tom@tromey.com
State Superseded
Headers show
Series
  • Add -Wunused-variable
Related show

Commit Message

Tom Tromey July 12, 2018, 8:52 p.m.
This is actually a patch I found via another route.  Joel had asked me
to write a test, but I still have not found the time to do this.
Meanwhile, -Wunused-variable also found this error.

2018-07-12  Tom Tromey  <tom@tromey.com>

	* symfile.c (reread_symbols): Notify iter, not objfile.
---
 gdb/ChangeLog | 4 ++++
 gdb/symfile.c | 2 +-
 2 files changed, 5 insertions(+), 1 deletion(-)

-- 
2.13.6

Comments

Simon Marchi July 13, 2018, 2:49 a.m. | #1
On 2018-07-12 04:52 PM, Tom Tromey wrote:
> This is actually a patch I found via another route.  Joel had asked me

> to write a test, but I still have not found the time to do this.

> Meanwhile, -Wunused-variable also found this error.


Heh, this is also a case of variables that should be declared in the
narrowest scope possible.

Simon
Simon Marchi July 14, 2018, 1:25 a.m. | #2
On 2018-07-12 10:49 PM, Simon Marchi wrote:
> On 2018-07-12 04:52 PM, Tom Tromey wrote:

>> This is actually a patch I found via another route.  Joel had asked me

>> to write a test, but I still have not found the time to do this.

>> Meanwhile, -Wunused-variable also found this error.

> 

> Heh, this is also a case of variables that should be declared in the

> narrowest scope possible.

> 

> Simon


It wasn't clear, but this LGTM.

Simon

Patch

diff --git a/gdb/symfile.c b/gdb/symfile.c
index 48eca5cc0ea..29cd48572d0 100644
--- a/gdb/symfile.c
+++ b/gdb/symfile.c
@@ -2608,7 +2608,7 @@  reread_symbols (void)
 	 gdb::observers::new_objfile.notify (NULL) has been called by
 	 clear_symtab_users above.  Notify the new files now.  */
       for (auto iter : new_objfiles)
-	gdb::observers::new_objfile.notify (objfile);
+	gdb::observers::new_objfile.notify (iter);
 
       /* At least one objfile has changed, so we can consider that
          the executable we're debugging has changed too.  */