gdb/mi: remove warning about mi1
[binutils-gdb.git] / gdb / f-lang.c
index 2da50b27267a765f67510c1f9d6cc16d5ef02ab9..fc0614e576170967f1396455ec4d6d3750a04aa4 100644 (file)
@@ -101,6 +101,16 @@ f_language::get_encoding (struct type *type)
   return encoding;
 }
 
+/* See language.h.  */
+
+struct value *
+f_language::value_string (struct gdbarch *gdbarch,
+                         const char *ptr, ssize_t len) const
+{
+  struct type *type = language_string_char_type (this, gdbarch);
+  return ::value_string (ptr, len, type);
+}
+
 /* A helper function for the "bound" intrinsics that checks that TYPE
    is an array.  LBOUND_P is true for lower bound; this is used for
    the error message, if any.  */
@@ -137,7 +147,7 @@ fortran_bounds_all_dims (bool lbound_p,
                                builtin_f_type (gdbarch)->builtin_integer,
                                1, ndimensions);
   struct type *elm_type = builtin_f_type (gdbarch)->builtin_integer;
-  struct type *result_type = create_array_type (nullptr, elm_type, range);
+  struct type *result_type = create_array_type (alloc, elm_type, range);
   struct value *result = value::allocate (result_type);
 
   /* Walk the array dimensions backwards due to the way the array will be
@@ -261,8 +271,8 @@ public:
   {
     if (inner_p)
       {
-       gdb_assert (m_mark == nullptr);
-       m_mark = value_mark ();
+       gdb_assert (!m_mark.has_value ());
+       m_mark.emplace ();
       }
   }
 
@@ -272,9 +282,8 @@ public:
   {
     if (inner_p)
       {
-       gdb_assert (m_mark != nullptr);
-       value_free_to_mark (m_mark);
-       m_mark = nullptr;
+       gdb_assert (m_mark.has_value ());
+       m_mark.reset ();
       }
   }
 
@@ -295,9 +304,9 @@ protected:
      written.  */
   LONGEST m_dest_offset;
 
-  /* Set with a call to VALUE_MARK, and then reset after calling
-     VALUE_FREE_TO_MARK.  */
-  struct value *m_mark = nullptr;
+  /* Set and reset to handle removing intermediate values from the
+     value chain.  */
+  gdb::optional<scoped_value_mark> m_mark;
 };
 
 /* A class used by FORTRAN_VALUE_SUBARRAY when repacking Fortran array
@@ -721,7 +730,7 @@ fortran_array_shape (struct gdbarch *gdbarch, const language_defn *lang,
                                builtin_type (gdbarch)->builtin_int,
                                1, ndimensions);
   struct type *elm_type = builtin_f_type (gdbarch)->builtin_integer;
-  struct type *result_type = create_array_type (nullptr, elm_type, range);
+  struct type *result_type = create_array_type (alloc, elm_type, range);
   struct value *result = value::allocate (result_type);
   LONGEST elm_len = elm_type->length ();
 
@@ -1402,7 +1411,7 @@ fortran_undetermined::value_subarray (value *array,
                                         &p_low, &p_high, 0, &p_stride,
                                         true);
       array_slice_type
-       = create_array_type (nullptr, array_slice_type, new_range);
+       = create_array_type (alloc, array_slice_type, new_range);
     }
 
   if (fortran_array_slicing_debug)
@@ -1439,7 +1448,7 @@ fortran_undetermined::value_subarray (value *array,
                                             &p_low, &p_high, 0, &p_stride,
                                             true);
          repacked_array_type
-           = create_array_type (nullptr, repacked_array_type, new_range);
+           = create_array_type (alloc, repacked_array_type, new_range);
        }
 
       /* Now copy the elements from the original ARRAY into the packed
@@ -1923,7 +1932,7 @@ fortran_prepare_argument (struct expression *exp,
 
   bool is_artificial = ((arg_num >= func_type->num_fields ())
                        ? true
-                       : TYPE_FIELD_ARTIFICIAL (func_type, arg_num));
+                       : func_type->field (arg_num).is_artificial ());
 
   /* If this is an artificial argument, then either, this is an argument
      beyond the end of the known arguments, or possibly, there are no known