From fae2120ba0a6fd9288af24b359bf0e3ab3556cdb Mon Sep 17 00:00:00 2001 From: Tom Tromey Date: Sat, 20 Mar 2021 17:23:40 -0600 Subject: [PATCH] Change objfile::has_partial_symbols to return bool This changes objfile::has_partial_symbols and quick_symbol_functions::has_symbols to return bool. gdb/ChangeLog 2021-03-20 Tom Tromey * objfiles.h (struct objfile) : Return bool. * symfile.h (struct quick_symbol_functions) : Return bool. * symfile-debug.c (debug_qf_has_symbols): Return bool. * psymtab.c (psym_has_symbols): Return bool. * objfiles.c (objfile::has_partial_symbols): Return bool. * dwarf2/read.c (dw2_has_symbols): Return bool. --- gdb/ChangeLog | 10 ++++++++++ gdb/dwarf2/read.c | 4 ++-- gdb/objfiles.c | 6 +++--- gdb/objfiles.h | 2 +- gdb/psymtab.c | 2 +- gdb/symfile-debug.c | 4 ++-- gdb/symfile.h | 2 +- 7 files changed, 20 insertions(+), 10 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 20f7b56d4f8..8d2b32d10de 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,13 @@ +2021-03-20 Tom Tromey + + * objfiles.h (struct objfile) : Return bool. + * symfile.h (struct quick_symbol_functions) : Return + bool. + * symfile-debug.c (debug_qf_has_symbols): Return bool. + * psymtab.c (psym_has_symbols): Return bool. + * objfiles.c (objfile::has_partial_symbols): Return bool. + * dwarf2/read.c (dw2_has_symbols): Return bool. + 2021-03-20 Tom Tromey * symfile.c (read_symbols): Update. diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c index dd2abd39b0f..744b6bca248 100644 --- a/gdb/dwarf2/read.c +++ b/gdb/dwarf2/read.c @@ -4872,10 +4872,10 @@ dw2_map_symbol_filenames (struct objfile *objfile, symbol_filename_ftype *fun, }); } -static int +static bool dw2_has_symbols (struct objfile *objfile) { - return 1; + return true; } const struct quick_symbol_functions dwarf2_gdb_index_functions = diff --git a/gdb/objfiles.c b/gdb/objfiles.c index 53ca66d17e6..746f7d1f296 100644 --- a/gdb/objfiles.c +++ b/gdb/objfiles.c @@ -812,11 +812,11 @@ objfile_rebase (struct objfile *objfile, CORE_ADDR slide) /* See objfiles.h. */ -int +bool objfile::has_partial_symbols () { if (!sf) - return 0; + return false; /* If we have not read psymbols, but we have a function capable of reading them, then that is an indication that they are in fact available. Without @@ -824,7 +824,7 @@ objfile::has_partial_symbols () not be present in this objfile. */ if ((flags & OBJF_PSYMTABS_READ) == 0 && sf->sym_read_psymbols != NULL) - return 1; + return true; return sf->qf->has_symbols (this); } diff --git a/gdb/objfiles.h b/gdb/objfiles.h index 0568e16ae4c..f961bdc0116 100644 --- a/gdb/objfiles.h +++ b/gdb/objfiles.h @@ -550,7 +550,7 @@ public: /* Return true if OBJFILE has partial symbols. */ - int has_partial_symbols (); + bool has_partial_symbols (); /* The object file's original name as specified by the user, made absolute, and tilde-expanded. However, it is not canonicalized diff --git a/gdb/psymtab.c b/gdb/psymtab.c index 7f41c010e39..94b5acdea54 100644 --- a/gdb/psymtab.c +++ b/gdb/psymtab.c @@ -1334,7 +1334,7 @@ psym_expand_symtabs_matching /* Psymtab version of has_symbols. See its definition in the definition of quick_symbol_functions in symfile.h. */ -static int +static bool psym_has_symbols (struct objfile *objfile) { return objfile->partial_symtabs->psymtabs != NULL; diff --git a/gdb/symfile-debug.c b/gdb/symfile-debug.c index 2929af81c37..7c022ae341d 100644 --- a/gdb/symfile-debug.c +++ b/gdb/symfile-debug.c @@ -70,12 +70,12 @@ debug_symtab_name (struct symtab *symtab) /* Debugging version of struct quick_symbol_functions. */ -static int +static bool debug_qf_has_symbols (struct objfile *objfile) { const struct debug_sym_fns_data *debug_data = symfile_debug_objfile_data_key.get (objfile); - int retval; + bool retval; retval = debug_data->real_sf->qf->has_symbols (objfile); diff --git a/gdb/symfile.h b/gdb/symfile.h index da49911c5cf..76b6d4bcc78 100644 --- a/gdb/symfile.h +++ b/gdb/symfile.h @@ -150,7 +150,7 @@ struct quick_symbol_functions { /* Return true if this objfile has any "partial" symbols available. */ - int (*has_symbols) (struct objfile *objfile); + bool (*has_symbols) (struct objfile *objfile); /* Return the symbol table for the "last" file appearing in OBJFILE. */ -- 2.30.2