]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
Return bool from ada_prefer_type
authorTom Tromey <tromey@adacore.com>
Tue, 10 Mar 2026 14:03:43 +0000 (08:03 -0600)
committerTom Tromey <tromey@adacore.com>
Wed, 11 Mar 2026 14:26:45 +0000 (08:26 -0600)
This changes ada_prefer_type to return bool.

Approved-By: Simon Marchi <simon.marchi@efficios.com>
gdb/ada-lang.c
gdb/ada-lang.h

index 674baedc3a977ef4a68f4fc195d38f7c6a29c1c9..0e885a4d1f3c7657bd82c1f371fc5a1dc2234ee0 100644 (file)
@@ -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
index e3412c82728917d3e8dc8b32ce4fc3817b5a9df9..80200d5b3f55ea24291b8c88d135c9b75e2993f3 100644 (file)
@@ -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 *);