[binutils-gdb] Return bool from iterate_over_objfiles_in_search_order callbacks

Tom Tromey via Gdb-cvs <[email protected]>
Newsgroups gmane.comp.gdb.cvs
Message-ID <[email protected]>
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=79518ad27149cf0ae95883a7fbde6b3f4c8b0df1

commit 79518ad27149cf0ae95883a7fbde6b3f4c8b0df1
Author: Tom Tromey <[email protected]>
Date:   Tue Mar 3 10:50:39 2026 -0700

    Return bool from iterate_over_objfiles_in_search_order callbacks
    
    I noticed that many callbacks passed to
    iterate_over_objfiles_in_search_order were still returning 0/1 rather
    than false/true.
    
    Approved-By: Simon Marchi <[email protected]>

Diff:
---
 gdb/ada-lang.c          |  4 ++--
 gdb/cp-support.c        |  2 +-
 gdb/elfread.c           |  6 +++---
 gdb/python/py-objfile.c | 20 ++++++++++----------
 gdb/symtab.c            |  4 ++--
 5 files changed, 18 insertions(+), 18 deletions(-)

diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c
index a0a005be55e..ef3417059b7 100644
--- a/gdb/ada-lang.c
+++ b/gdb/ada-lang.c
@@ -4969,11 +4969,11 @@ ada_lookup_simple_minsym (const char *name, struct objfile *objfile)
 	       {
 		 result.minsym = msymbol;
 		 result.objfile = obj;
-		 return 1;
+		 return true;
 	       }
 	   }
 
-	 return 0;
+	 return false;
        }, objfile);
 
   return result;
diff --git a/gdb/cp-support.c b/gdb/cp-support.c
index f094e4bb4c8..5dfb2a78505 100644
--- a/gdb/cp-support.c
+++ b/gdb/cp-support.c
@@ -1501,7 +1501,7 @@ add_symbol_overload_list_qualified (const char *func_name,
 		      SEARCH_GLOBAL_BLOCK | SEARCH_STATIC_BLOCK,
 		      SEARCH_FUNCTION_DOMAIN);
 
-	 return 0;
+	 return false;
        }, current_objfile);
 }
 
diff --git a/gdb/elfread.c b/gdb/elfread.c
index 74cf56083b2..8924bb6ba24 100644
--- a/gdb/elfread.c
+++ b/gdb/elfread.c
@@ -770,11 +770,11 @@ elf_gnu_ifunc_resolve_by_cache (const char *name, CORE_ADDR *addr_p)
 	 elf_gnu_ifunc_cache *cache
 	   = elf_objfile_gnu_ifunc_cache_data.get (objfile);
 	 if (cache == nullptr)
-	   return 0;
+	   return false;
 
 	 auto it = cache->find (name);
 	 if (it == cache->end ())
-	   return 0;
+	   return false;
 
 	 if (addr_p != nullptr)
 	   *addr_p = it->second;
@@ -783,7 +783,7 @@ elf_gnu_ifunc_resolve_by_cache (const char *name, CORE_ADDR *addr_p)
 	   (func, "cache hit for \"%s\" -> %s in objfile %s", name,
 	    paddress (objfile->arch (), it->second), objfile_name (objfile));
 	 found = 1;
-	 return 1;
+	 return true;
        }, nullptr);
 
   if (!found)
diff --git a/gdb/python/py-objfile.c b/gdb/python/py-objfile.c
index daf1b44747c..ea043356971 100644
--- a/gdb/python/py-objfile.c
+++ b/gdb/python/py-objfile.c
@@ -609,21 +609,21 @@ gdbpy_lookup_objfile (PyObject *self, PyObject *args, PyObject *kw)
 	 {
 	   /* Don't return separate debug files.  */
 	   if (obj->separate_debug_objfile_backlink != nullptr)
-	     return 0;
+	     return false;
 
 	   bfd *obfd = obj->obfd.get ();
 	   if (obfd == nullptr)
-	     return 0;
+	     return false;
 
 	   const bfd_build_id *obfd_build_id = build_id_bfd_get (obfd);
 	   if (obfd_build_id == nullptr)
-	     return 0;
+	     return false;
 
 	   if (!objfpy_build_id_matches (obfd_build_id, name))
-	     return 0;
+	     return false;
 
 	   objfile = obj;
-	   return 1;
+	   return true;
 	 }, gdbpy_current_objfile);
   else
     current_program_space->iterate_over_objfiles_in_search_order
@@ -631,26 +631,26 @@ gdbpy_lookup_objfile (PyObject *self, PyObject *args, PyObject *kw)
 	 {
 	   /* Don't return separate debug files.  */
 	   if (obj->separate_debug_objfile_backlink != nullptr)
-	     return 0;
+	     return false;
 
 	   if ((obj->flags & OBJF_NOT_FILENAME) != 0)
-	     return 0;
+	     return false;
 
 	   const char *filename = objfile_filename (obj);
 	   if (filename != NULL
 	       && compare_filenames_for_search (filename, name))
 	     {
 	       objfile = obj;
-	       return 1;
+	       return true;
 	     }
 
 	   if (compare_filenames_for_search (obj->original_name, name))
 	     {
 	       objfile = obj;
-	       return 1;
+	       return true;
 	     }
 
-	   return 0;
+	   return false;
 	 }, gdbpy_current_objfile);
 
   if (objfile != NULL)
diff --git a/gdb/symtab.c b/gdb/symtab.c
index 6f5b998566e..51a049836b0 100644
--- a/gdb/symtab.c
+++ b/gdb/symtab.c
@@ -6427,10 +6427,10 @@ find_main_name (void)
 	 if (symbol_found_p)
 	   {
 	     set_main_name (pspace, "main", lang);
-	     return 1;
+	     return true;
 	   }
 
-	 return 0;
+	 return false;
        }, nullptr);
 
   if (symbol_found_p)
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.