[gdb/build] Fix -Werror=bool-compare warning in update_static_array_size
[binutils-gdb.git] / gdb / gdbtypes.c
index 2f92887b3cfcd81c554ac0fa10f9de7c1cc95ce0..b822a369a1634fcb921dcfb64a19858241c56c1c 100644 (file)
@@ -1119,14 +1119,9 @@ get_discrete_bounds (struct type *type, LONGEST *lowp, LONGEST *highp)
     }
 }
 
-/* Assuming TYPE is a simple, non-empty array type, compute its upper
-   and lower bound.  Save the low bound into LOW_BOUND if not NULL.
-   Save the high bound into HIGH_BOUND if not NULL.
-
-   Return 1 if the operation was successful.  Return zero otherwise,
-   in which case the values of LOW_BOUND and HIGH_BOUNDS are unmodified.  */
+/* See gdbtypes.h  */
 
-int
+bool
 get_array_bounds (struct type *type, LONGEST *low_bound, LONGEST *high_bound)
 {
   struct type *index = type->index_type ();
@@ -1135,11 +1130,11 @@ get_array_bounds (struct type *type, LONGEST *low_bound, LONGEST *high_bound)
   int res;
 
   if (index == NULL)
-    return 0;
+    return false;
 
   res = get_discrete_bounds (index, &low, &high);
   if (res == -1)
-    return 0;
+    return false;
 
   if (low_bound)
     *low_bound = low;
@@ -1147,7 +1142,7 @@ get_array_bounds (struct type *type, LONGEST *low_bound, LONGEST *high_bound)
   if (high_bound)
     *high_bound = high;
 
-  return 1;
+  return true;
 }
 
 /* Assuming that TYPE is a discrete type and VAL is a valid integer
@@ -1252,7 +1247,7 @@ update_static_array_size (struct type *type)
       if (element_type->code () == TYPE_CODE_ARRAY
          && TYPE_LENGTH (element_type) != 0
          && TYPE_FIELD_BITSIZE (element_type, 0) != 0
-         && get_array_bounds (element_type, &low_bound, &high_bound) >= 0
+         && get_array_bounds (element_type, &low_bound, &high_bound)
          && high_bound >= low_bound)
        TYPE_FIELD_BITSIZE (type, 0)
          = ((high_bound - low_bound + 1)