diff options
author | Tom Tromey <tom@tromey.com> | 2017-04-06 20:27:10 -0600 |
---|---|---|
committer | Tom Tromey <tom@tromey.com> | 2017-04-12 11:16:17 -0600 |
commit | c83dd8672698bcdf48d27e267e481230075f5900 (patch) | |
tree | 3a32b27c8908e22f0698bf29661b1aa4aa2a3b47 /gdb/symfile.c | |
parent | 0e8621a0bec2d0840b853c4104614f345f0569ca (diff) | |
download | fsf-binutils-gdb-c83dd8672698bcdf48d27e267e481230075f5900.zip fsf-binutils-gdb-c83dd8672698bcdf48d27e267e481230075f5900.tar.gz fsf-binutils-gdb-c83dd8672698bcdf48d27e267e481230075f5900.tar.bz2 |
Change increment_reading_symtab to return a scoped_restore
This changes increment_reading_symtab to return a scoped_restore, then
fixes up the users.
gdb/ChangeLog
2017-04-12 Tom Tromey <tom@tromey.com>
* symfile.h (increment_reading_symtab): Update type.
* symfile.c (decrement_reading_symtab): Remove.
(increment_reading_symtab): Return a scoped_restore_tmpl<int>.
* psymtab.c (psymtab_to_symtab): Update.
* dwarf2read.c (dw2_instantiate_symtab): Update.
Diffstat (limited to 'gdb/symfile.c')
-rw-r--r-- | gdb/symfile.c | 17 |
1 files changed, 4 insertions, 13 deletions
diff --git a/gdb/symfile.c b/gdb/symfile.c index 750039d..7810f2c 100644 --- a/gdb/symfile.c +++ b/gdb/symfile.c @@ -91,8 +91,6 @@ static void add_symbol_file_command (char *, int); static const struct sym_fns *find_sym_fns (bfd *); -static void decrement_reading_symtab (void *); - static void overlay_invalidate_all (void); static void overlay_auto_command (char *, int); @@ -193,22 +191,15 @@ print_symbol_loading_p (int from_tty, int exec, int full) int currently_reading_symtab = 0; -static void -decrement_reading_symtab (void *dummy) -{ - currently_reading_symtab--; - gdb_assert (currently_reading_symtab >= 0); -} - /* Increment currently_reading_symtab and return a cleanup that can be used to decrement it. */ -struct cleanup * +scoped_restore_tmpl<int> increment_reading_symtab (void) { - ++currently_reading_symtab; - gdb_assert (currently_reading_symtab > 0); - return make_cleanup (decrement_reading_symtab, NULL); + gdb_assert (currently_reading_symtab >= 0); + return make_scoped_restore (¤tly_reading_symtab, + currently_reading_symtab + 1); } /* Remember the lowest-addressed loadable section we've seen. |