[binutils-gdb] Return bool from ada_scan_number

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


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

commit 9c29609d2c44ddacee8d9a4f96fa93e63511bb54
Author: Tom Tromey <tromey@adacore.com>
Date:   Tue Mar 10 08:00:49 2026 -0600

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

Diff:
---
 gdb/ada-lang.c | 8 ++++----
 gdb/ada-lang.h | 2 +-
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c
index 2023989e49c..73c4b86fbd8 100644
--- a/gdb/ada-lang.c
+++ b/gdb/ada-lang.c
@@ -6768,18 +6768,18 @@ ada_variant_discrim_name (struct type *type0)
 /* Scan STR for a subtype-encoded number, beginning at position K.
    Put the position of the character just past the number scanned in
    *NEW_K, if NEW_K!=NULL.  Put the scanned number in *R, if R!=NULL.
-   Return 1 if there was a valid number at the given position, and 0
+   Return true if there was a valid number at the given position, and false
    otherwise.  A "subtype-encoded" number consists of the absolute value
    in decimal, followed by the letter 'm' to indicate a negative number.
    Assumes 0m does not occur.  */
 
-int
+bool
 ada_scan_number (const char str[], int k, LONGEST * R, int *new_k)
 {
   ULONGEST RU;
 
   if (!c_isdigit (str[k]))
-    return 0;
+    return false;
 
   /* Do it the hard way so as not to make any assumption about
      the relationship of unsigned long (%lu scan format code) and
@@ -6808,7 +6808,7 @@ ada_scan_number (const char str[], int k, LONGEST * R, int *new_k)
 
   if (new_k != NULL)
     *new_k = k;
-  return 1;
+  return true;
 }
 
 /* Assuming that TYPE is a variant part wrapper type (a VARIANTS field),
diff --git a/gdb/ada-lang.h b/gdb/ada-lang.h
index dbd943cb5ee..e3412c82728 100644
--- a/gdb/ada-lang.h
+++ b/gdb/ada-lang.h
@@ -230,7 +230,7 @@ extern block_symbol ada_lookup_encoded_symbol
 
 extern bound_minimal_symbol ada_lookup_simple_minsym (const char *, objfile *);
 
-extern int ada_scan_number (const char *, int, LONGEST *, int *);
+extern bool ada_scan_number (const char *, int, LONGEST *, int *);
 
 extern struct value *ada_value_primitive_field (struct value *arg1,
 						int offset,


More information about the Gdb-cvs mailing list