[binutils-gdb] Use bool in ada_type_of_array

Tom Tromey via Gdb-cvs <[email protected]> Thu, 16 Jul 2026 19:15:54 +0000 (GMT)
Newsgroups gmane.comp.gdb.cvs
Message-ID <[email protected]>
https://sourceware.org/git/gitweb.cgi?p=3Dbinutils-gdb.git;h=3Da9b7bbb1729d=
5ac6d3623bfe56a54d8b9936f160

commit a9b7bbb1729d5ac6d3623bfe56a54d8b9936f160
Author: Tom Tromey <[email protected]>
Date:   Tue Jun 30 09:12:42 2026 -0600

    Use bool in ada_type_of_array
   =20
    I found yet another spot in ada-lang.c where a bool is more
    appropriate than an int.
   =20
    Approved-By: Simon Marchi <[email protected]>

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 726ee9ae23e..85b08af8c06 100644
--- a/gdb/ada-lang.c
+++ b/gdb/ada-lang.c
@@ -2136,14 +2136,14 @@ ada_is_array_descriptor_type (struct type *type)
=20
 /* If ARR has a record type in the form of a standard GNAT array descripto=
r,
    (fat pointer) returns the type of the array data described---specifical=
ly,
-   a pointer-to-array type.  If BOUNDS is non-zero, the bounds data are fi=
lled
+   a pointer-to-array type.  If BOUNDS is true, the bounds data are filled
    in from the descriptor; otherwise, they are left unspecified.  If
    the ARR denotes a null array descriptor and BOUNDS is non-zero,
    returns NULL.  The result is simply the type of ARR if ARR is not
    a descriptor.  */
=20
 static struct type *
-ada_type_of_array (struct value *arr, int bounds)
+ada_type_of_array (struct value *arr, bool bounds)
 {
   if (ada_is_constrained_packed_array_type (arr->type ()))
     return decode_constrained_packed_array_type (arr->type ());
@@ -2231,7 +2231,7 @@ ada_coerce_to_simple_array_ptr (struct value *arr)
 {
   if (ada_is_array_descriptor_type (arr->type ()))
     {
-      struct type *arrType =3D ada_type_of_array (arr, 1);
+      struct type *arrType =3D ada_type_of_array (arr, true);
=20
       if (arrType =3D=3D NULL)
 	return NULL;
@@ -10268,7 +10268,7 @@ ada_ternop_slice_operation::evaluate (struct type *=
expect_type,
   if (noside =3D=3D EVAL_AVOID_SIDE_EFFECTS
       && ada_is_array_descriptor_type (ada_check_typedef
 				       (array->type ())))
-    return empty_array (ada_type_of_array (array, 0), low_bound,
+    return empty_array (ada_type_of_array (array, false), low_bound,
 			high_bound);
=20
   array =3D ada_coerce_to_simple_array_ptr (array);
@@ -11047,7 +11047,7 @@ ada_unop_ind_operation::evaluate (struct type *expe=
ct_type,
 	     "dereference" a thick pointer here -- that will end up
 	     giving us an array with (1 .. 0) for bounds, which is
 	     less clear than (<>).  */
-	  struct type *arrType =3D ada_type_of_array (arg1, 0);
+	  struct type *arrType =3D ada_type_of_array (arg1, false);
=20
 	  if (arrType =3D=3D NULL)
 	    error (_("Attempt to dereference null array pointer."));