gnulib: define the path to gnulib's parent dir
[binutils-gdb.git] / gdb / f-array-walker.h
index 417f9f079805bd9b50e1be7409f3d34df9bf6234..49a32be7530f69cd421668456fb8c52ad15067b6 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (C) 2020 Free Software Foundation, Inc.
+/* Copyright (C) 2020-2021 Free Software Foundation, Inc.
 
    This file is part of GDB.
 
@@ -42,7 +42,7 @@ public:
 
     /* Get the range, and extract the bounds.  */
     struct type *range_type = type->index_type ();
-    if (get_discrete_bounds (range_type, &m_lowerbound, &m_upperbound) < 0)
+    if (!get_discrete_bounds (range_type, &m_lowerbound, &m_upperbound))
       error ("unable to read array bounds");
 
     /* Figure out the stride for this array.  */
@@ -52,8 +52,8 @@ public:
       m_stride = type_length_units (elt_type);
     else
       {
-       struct gdbarch *arch = get_type_arch (elt_type);
-       int unit_size = gdbarch_addressable_memory_unit_size (arch);
+       int unit_size
+         = gdbarch_addressable_memory_unit_size (elt_type->arch ());
        m_stride /= (unit_size * 8);
       }
   };
@@ -198,7 +198,7 @@ private:
     /* Extract the range, and get lower and upper bounds.  */
     struct type *range_type = check_typedef (type)->index_type ();
     LONGEST lowerbound, upperbound;
-    if (get_discrete_bounds (range_type, &lowerbound, &upperbound) < 0)
+    if (!get_discrete_bounds (range_type, &lowerbound, &upperbound))
       error ("failed to get range bounds");
 
     /* CALC is used to calculate the offsets for each element in this