From: Simon Marchi Date: Thu, 16 May 2024 20:29:47 +0000 (-0400) Subject: gdb: bool-ify a few functions in objfiles.{c,h} X-Git-Tag: binutils-2_43~117 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=cc7541ce5e1c317c7b185b005f0c048c997b2b58;p=thirdparty%2Fbinutils-gdb.git gdb: bool-ify a few functions in objfiles.{c,h} Change return types to bool, and make a few stylistic adjustments. Change-Id: I784c3c33af0394a77c25064b06eb3e128e69222f Approved-By: Tom Tromey Reviewed-By: Thiago Jung Bauermann --- diff --git a/gdb/objfiles.c b/gdb/objfiles.c index f51baab8d2c..25129b2fb31 100644 --- a/gdb/objfiles.c +++ b/gdb/objfiles.c @@ -731,56 +731,49 @@ objfile_rebase (struct objfile *objfile, CORE_ADDR slide) if (changed) breakpoint_re_set (); } - -/* Return non-zero if OBJFILE has full symbols. */ -int -objfile_has_full_symbols (struct objfile *objfile) +/* See objfiles.h. */ + +bool +objfile_has_full_symbols (objfile *objfile) { - return objfile->compunit_symtabs != NULL; + return objfile->compunit_symtabs != nullptr; } -/* Return non-zero if OBJFILE has full or partial symbols, either directly - or through a separate debug file. */ +/* See objfiles.h. */ -int -objfile_has_symbols (struct objfile *objfile) +bool +objfile_has_symbols (objfile *objfile) { for (::objfile *o : objfile->separate_debug_objfiles ()) if (o->has_partial_symbols () || objfile_has_full_symbols (o)) - return 1; - return 0; -} + return true; + return false; +} -/* Many places in gdb want to test just to see if we have any partial - symbols available. This function returns zero if none are currently - available, nonzero otherwise. */ +/* See objfiles.h. */ -int -have_partial_symbols (void) +bool +have_partial_symbols () { for (objfile *ofp : current_program_space->objfiles ()) - { - if (ofp->has_partial_symbols ()) - return 1; - } - return 0; + if (ofp->has_partial_symbols ()) + return true; + + return false; } -/* Many places in gdb want to test just to see if we have any full - symbols available. This function returns zero if none are currently - available, nonzero otherwise. */ +/* See objfiles.h. */ -int -have_full_symbols (void) +bool +have_full_symbols () { for (objfile *ofp : current_program_space->objfiles ()) - { - if (objfile_has_full_symbols (ofp)) - return 1; - } - return 0; + if (objfile_has_full_symbols (ofp)) + return true; + + return false; } @@ -799,22 +792,16 @@ objfile_purge_solibs (program_space *pspace) } } +/* See objfiles.h. */ -/* Many places in gdb want to test just to see if we have any minimal - symbols available. This function returns zero if none are currently - available, nonzero otherwise. */ - -int -have_minimal_symbols (void) +bool +have_minimal_symbols () { for (objfile *ofp : current_program_space->objfiles ()) - { - if (ofp->per_bfd->minimal_symbol_count > 0) - { - return 1; - } - } - return 0; + if (ofp->per_bfd->minimal_symbol_count > 0) + return true; + + return false; } /* Qsort comparison function. */ diff --git a/gdb/objfiles.h b/gdb/objfiles.h index 73d1e991e84..5cf73315a9b 100644 --- a/gdb/objfiles.h +++ b/gdb/objfiles.h @@ -923,13 +923,23 @@ extern void free_objfile_separate_debug (struct objfile *); extern void objfile_relocate (struct objfile *, const section_offsets &); extern void objfile_rebase (struct objfile *, CORE_ADDR); -extern int objfile_has_full_symbols (struct objfile *objfile); +/* Return true if OBJFILE has full symbols. */ -extern int objfile_has_symbols (struct objfile *objfile); +extern bool objfile_has_full_symbols (objfile *objfile); -extern int have_partial_symbols (void); +/* Return true if OBJFILE has full or partial symbols, either directly + or through a separate debug file. */ -extern int have_full_symbols (void); +extern bool objfile_has_symbols (objfile *objfile); + +/* Return true if any objfile of the current program space has partial + symbols. */ + +extern bool have_partial_symbols (); + +/* Return true if any objfile of the current program space has full symbols. */ + +extern bool have_full_symbols (); extern void objfile_set_sym_fns (struct objfile *objfile, const struct sym_fns *sf); @@ -956,7 +966,10 @@ extern void objfile_purge_solibs (program_space *pspace); /* Functions for dealing with the minimal symbol table, really a misc address<->symbol mapping for things we don't have debug symbols for. */ -extern int have_minimal_symbols (void); +/* Return true if any objfile of the current program space has minimal + symbols. */ + +extern bool have_minimal_symbols (); extern struct obj_section *find_pc_section (CORE_ADDR pc);