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

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=7327fa1a19ae43f1b8b6f220b1e05671659777fd

commit 7327fa1a19ae43f1b8b6f220b1e05671659777fd
Author: Tom Tromey <[email protected]>
Date:   Tue Mar 10 08:02:05 2026 -0600

    Return bool from ada-lang.c:find_struct_field
    
    This changes ada-lang.c:find_struct_field to return bool.
    
    Approved-By: Simon Marchi <[email protected]>

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

diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c
index 73c4b86fbd8..674baedc3a9 100644
--- a/gdb/ada-lang.c
+++ b/gdb/ada-lang.c
@@ -166,8 +166,8 @@ static struct value *val_atr (struct type *, LONGEST);
 static struct value *ada_search_struct_field (const char *, struct value *, int,
 					      struct type *);
 
-static int find_struct_field (const char *, struct type *, int,
-			      struct type **, int *, int *, int *, LONGEST *);
+static bool find_struct_field (const char *, struct type *, int,
+			       struct type **, int *, int *, int *, LONGEST *);
 
 static int ada_resolve_function (std::vector<struct block_symbol> &,
 				 struct value **, int, const char *,
@@ -6953,9 +6953,9 @@ ada_value_primitive_field (struct value *arg1, int offset, int fieldno,
    guaranty anything, and pick the one that's easiest for us
    to program.
 
-   Returns 1 if found, 0 otherwise.  */
+   Returns true if found, false otherwise.  */
 
-static int
+static bool
 find_struct_field (const char *name, struct type *type, int offset,
 		   struct type **field_type_p,
 		   int *byte_offset_p, int *bit_offset_p, int *bit_size_p,
@@ -7018,14 +7018,14 @@ find_struct_field (const char *name, struct type *type, int offset,
 	    *bit_offset_p = bit_pos % 8;
 	  if (bit_size_p != NULL)
 	    *bit_size_p = bit_size;
-	  return 1;
+	  return true;
 	}
       else if (ada_is_wrapper_field (type, i))
 	{
 	  if (find_struct_field (name, type->field (i).type (), fld_offset,
 				 field_type_p, byte_offset_p, bit_offset_p,
 				 bit_size_p, index_p))
-	    return 1;
+	    return true;
 	}
       else if (ada_is_variant_part (type, i))
 	{
@@ -7042,7 +7042,7 @@ find_struct_field (const char *name, struct type *type, int offset,
 				     + field_type->field (j).loc_bitpos () / 8,
 				     field_type_p, byte_offset_p,
 				     bit_offset_p, bit_size_p, index_p))
-		return 1;
+		return true;
 	    }
 	}
       else if (index_p != NULL)
@@ -7065,10 +7065,10 @@ find_struct_field (const char *name, struct type *type, int offset,
       if (find_struct_field (name, type->field (parent_offset).type (),
 			     fld_offset, field_type_p, byte_offset_p,
 			     bit_offset_p, bit_size_p, index_p))
-	return 1;
+	return true;
     }
 
-  return 0;
+  return false;
 }
 
 /* Number of user-visible fields in record type TYPE.  */
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.