[binutils-gdb] Return bool from ada_prefer_type
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=bb3f4829d86fd9b1427b4eb69ee0225c7e471a85 commit bb3f4829d86fd9b1427b4eb69ee0225c7e471a85 Author: Tom Tromey <[email protected]> Date: Tue Mar 10 08:03:43 2026 -0600 Return bool from ada_prefer_type This changes ada_prefer_type to return bool. Approved-By: Simon Marchi <[email protected]> Diff: --- gdb/ada-lang.c | 24 ++++++++++++------------ gdb/ada-lang.h | 2 +- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c index 674baedc3a9..0e885a4d1f3 100644 --- a/gdb/ada-lang.c +++ b/gdb/ada-lang.c @@ -7493,27 +7493,27 @@ ada_is_renaming_symbol (struct symbol *name_sym) /* Because of GNAT encoding conventions, several GDB symbols may match a given type name. If the type denoted by TYPE0 is to be preferred to - that of TYPE1 for purposes of type printing, return non-zero; - otherwise return 0. */ + that of TYPE1 for purposes of type printing, return true; + otherwise return false. */ -int +bool ada_prefer_type (struct type *type0, struct type *type1) { if (type1 == NULL) - return 1; + return true; else if (type0 == NULL) - return 0; + return false; else if (type1->code () == TYPE_CODE_VOID) - return 1; + return true; else if (type0->code () == TYPE_CODE_VOID) - return 0; + return false; else if (type1->name () == NULL && type0->name () != NULL) - return 1; + return true; else if (ada_is_constrained_packed_array_type (type0)) - return 1; + return true; else if (ada_is_array_descriptor_type (type0) && !ada_is_array_descriptor_type (type1)) - return 1; + return true; else { const char *type0_name = type0->name (); @@ -7521,9 +7521,9 @@ ada_prefer_type (struct type *type0, struct type *type1) if (type0_name != NULL && strstr (type0_name, "___XR") != NULL && (type1_name == NULL || strstr (type1_name, "___XR") == NULL)) - return 1; + return true; } - return 0; + return false; } /* The name of TYPE, which is its TYPE_NAME. Null if TYPE is diff --git a/gdb/ada-lang.h b/gdb/ada-lang.h index e3412c82728..80200d5b3f5 100644 --- a/gdb/ada-lang.h +++ b/gdb/ada-lang.h @@ -306,7 +306,7 @@ extern struct type *ada_find_parallel_type (struct type *, extern bool get_int_var_value (const char *, LONGEST &value); -extern int ada_prefer_type (struct type *, struct type *); +extern bool ada_prefer_type (struct type *, struct type *); extern struct type *ada_get_base_type (struct type *);