From: Tom Tromey <tromey@adacore.com>
To: gdb-patches@sourceware.org
Cc: Tom Tromey <tromey@adacore.com>
Subject: [PATCH] Use bool in ada_type_of_array
Date: Tue, 30 Jun 2026 09:13:16 -0600 [thread overview]
Message-ID: <20260630151316.882186-1-tromey@adacore.com> (raw)
I found yet another spot in ada-lang.c where a bool is more
appropriate than an int.
---
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 35ebd924021..8c85eb9a5e0 100644
--- a/gdb/ada-lang.c
+++ b/gdb/ada-lang.c
@@ -2136,14 +2136,14 @@ ada_is_array_descriptor_type (struct type *type)
/* If ARR has a record type in the form of a standard GNAT array descriptor,
(fat pointer) returns the type of the array data described---specifically,
- a pointer-to-array type. If BOUNDS is non-zero, the bounds data are filled
+ 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. */
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 = ada_type_of_array (arr, 1);
+ struct type *arrType = ada_type_of_array (arr, true);
if (arrType == NULL)
return NULL;
@@ -10268,7 +10268,7 @@ ada_ternop_slice_operation::evaluate (struct type *expect_type,
if (noside == 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);
array = ada_coerce_to_simple_array_ptr (array);
@@ -11047,7 +11047,7 @@ ada_unop_ind_operation::evaluate (struct type *expect_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 = ada_type_of_array (arg1, 0);
+ struct type *arrType = ada_type_of_array (arg1, false);
if (arrType == NULL)
error (_("Attempt to dereference null array pointer."));
base-commit: 12743d8290311a090ba115978d72351a2b321ce0
--
2.54.0
next reply other threads:[~2026-06-30 15:13 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-30 15:13 Tom Tromey [this message]
2026-07-03 12:54 ` Simon Marchi
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260630151316.882186-1-tromey@adacore.com \
--to=tromey@adacore.com \
--cc=gdb-patches@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox