[binutils-gdb] Return bool from ada-lang.c:scan_discrim_bound

Tom Tromey tromey@sourceware.org
Wed Mar 11 14:29:53 GMT 2026


https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=46794044742f01579cf8a192a42843490f520957

commit 46794044742f01579cf8a192a42843490f520957
Author: Tom Tromey <tromey@adacore.com>
Date:   Tue Mar 10 08:25:47 2026 -0600

    Return bool from ada-lang.c:scan_discrim_bound
    
    This changes ada-lang.c:scan_discrim_bound to return bool.
    
    Approved-By: Simon Marchi <simon.marchi@efficios.com>

Diff:
---
 gdb/ada-lang.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c
index 4b04a722f91..908b33d9c72 100644
--- a/gdb/ada-lang.c
+++ b/gdb/ada-lang.c
@@ -11442,10 +11442,10 @@ ada_is_system_address_type (struct type *type)
 /* Scan STR beginning at position K for a discriminant name, and
    return the value of that discriminant field of DVAL in *PX.  If
    PNEW_K is not null, put the position of the character beyond the
-   name scanned in *PNEW_K.  Return 1 if successful; return 0 and do
+   name scanned in *PNEW_K.  Return true if successful; return false and do
    not alter *PX and *PNEW_K if unsuccessful.  */
 
-static int
+static bool
 scan_discrim_bound (const char *str, int k, struct value *dval, LONGEST * px,
 		    int *pnew_k)
 {
@@ -11454,7 +11454,7 @@ scan_discrim_bound (const char *str, int k, struct value *dval, LONGEST * px,
   struct value *bound_val;
 
   if (dval == NULL || str == NULL || str[k] == '\0')
-    return 0;
+    return false;
 
   pstart = str + k;
   pend = strstr (pstart, "__");
@@ -11475,12 +11475,12 @@ scan_discrim_bound (const char *str, int k, struct value *dval, LONGEST * px,
 
   bound_val = ada_search_struct_field (bound, dval, 0, dval->type ());
   if (bound_val == NULL)
-    return 0;
+    return false;
 
   *px = value_as_long (bound_val);
   if (pnew_k != NULL)
     *pnew_k = k;
-  return 1;
+  return true;
 }
 
 /* Value of variable named NAME.  Only exact matches are considered.


More information about the Gdb-cvs mailing list