[binutils-gdb] Return bool from valid_task_id

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=969c57240e14cb84060c7256208d31fc7d38ec83

commit 969c57240e14cb84060c7256208d31fc7d38ec83
Author: Tom Tromey <[email protected]>
Date:   Tue Mar 10 08:15:24 2026 -0600

    Return bool from valid_task_id
    
    This changes valid_task_id to return bool and updates some callers.
    
    Approved-By: Simon Marchi <[email protected]>

Diff:
---
 gdb/ada-lang.h             | 2 +-
 gdb/ada-tasks.c            | 4 ++--
 gdb/guile/scm-breakpoint.c | 2 +-
 gdb/python/py-breakpoint.c | 2 +-
 4 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/gdb/ada-lang.h b/gdb/ada-lang.h
index 80200d5b3f5..cd2fce73d61 100644
--- a/gdb/ada-lang.h
+++ b/gdb/ada-lang.h
@@ -366,7 +366,7 @@ extern std::vector<ada_exc_info> ada_exceptions_list (const char *regexp);
 
 /* Tasking-related: ada-tasks.c */
 
-extern int valid_task_id (int);
+extern bool valid_task_id (int);
 
 extern struct ada_task_info *ada_get_task_info_from_ptid (ptid_t ptid);
 
diff --git a/gdb/ada-tasks.c b/gdb/ada-tasks.c
index 0e124e1a2a2..bae54e86bf6 100644
--- a/gdb/ada-tasks.c
+++ b/gdb/ada-tasks.c
@@ -354,9 +354,9 @@ get_task_number_from_id (CORE_ADDR task_id, struct inferior *inf)
   return 0;
 }
 
-/* Return non-zero if TASK_NUM is a valid task number.  */
+/* Return true if TASK_NUM is a valid task number.  */
 
-int
+bool
 valid_task_id (int task_num)
 {
   struct ada_tasks_inferior_data *data;
diff --git a/gdb/guile/scm-breakpoint.c b/gdb/guile/scm-breakpoint.c
index c64c1748646..62256ee53bf 100644
--- a/gdb/guile/scm-breakpoint.c
+++ b/gdb/guile/scm-breakpoint.c
@@ -815,13 +815,13 @@ gdbscm_set_breakpoint_task_x (SCM self, SCM newvalue)
   breakpoint_smob *bp_smob
     = bpscm_get_valid_breakpoint_smob_arg_unsafe (self, SCM_ARG1, FUNC_NAME);
   long id;
-  int valid_id = 0;
 
   if (scm_is_signed_integer (newvalue, LONG_MIN, LONG_MAX))
     {
       id = scm_to_long (newvalue);
 
       gdbscm_gdb_exception exc {};
+      bool valid_id = false;
       try
 	{
 	  valid_id = valid_task_id (id);
diff --git a/gdb/python/py-breakpoint.c b/gdb/python/py-breakpoint.c
index 408d4b9d857..c5d3d7e2d7e 100644
--- a/gdb/python/py-breakpoint.c
+++ b/gdb/python/py-breakpoint.c
@@ -371,7 +371,6 @@ bppy_set_task (PyObject *self, PyObject *newvalue, void *closure)
 {
   gdbpy_breakpoint_object *self_bp = (gdbpy_breakpoint_object *) self;
   long id;
-  int valid_id = 0;
 
   BPPY_SET_REQUIRE_VALID (self_bp);
 
@@ -386,6 +385,7 @@ bppy_set_task (PyObject *self, PyObject *newvalue, void *closure)
       if (! gdb_py_int_as_long (newvalue, &id))
 	return -1;
 
+      bool valid_id = false;
       try
 	{
 	  valid_id = valid_task_id (id);
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.