]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
gdb: bool-ify a few functions in objfiles.{c,h}
authorSimon Marchi <simon.marchi@polymtl.ca>
Thu, 16 May 2024 20:29:47 +0000 (16:29 -0400)
committerSimon Marchi <simon.marchi@efficios.com>
Mon, 15 Jul 2024 18:34:12 +0000 (14:34 -0400)
Change return types to bool, and make a few stylistic adjustments.

Change-Id: I784c3c33af0394a77c25064b06eb3e128e69222f
Approved-By: Tom Tromey <tom@tromey.com>
Reviewed-By: Thiago Jung Bauermann <thiago.bauermann@linaro.org>
gdb/objfiles.c
gdb/objfiles.h

index f51baab8d2ccedfdc1a34cc03e10c387551f1f77..25129b2fb31e84ac5688f1fb163bd1a615c71159 100644 (file)
@@ -731,56 +731,49 @@ objfile_rebase (struct objfile *objfile, CORE_ADDR slide)
   if (changed)
     breakpoint_re_set ();
 }
-\f
-/* 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.  */
index 73d1e991e842ceef6c2c2934ee8475d850cf92f8..5cf73315a9b279fa5673fa8296be38412837611a 100644 (file)
@@ -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);