[gdb] Fix s390x -m31 build
[deliverable/binutils-gdb.git] / gdb / ui-out.c
index 1900965923f8b7f62afae8c6718c7ee399d6fed0..6851fd29c6ab24ce4db54fa3ca8e2a46d1b2efce 100644 (file)
@@ -1,6 +1,6 @@
 /* Output generating routines for GDB.
 
-   Copyright (C) 1999-2017 Free Software Foundation, Inc.
+   Copyright (C) 1999-2019 Free Software Foundation, Inc.
 
    Contributed by Cygnus Solutions.
    Written by Fernando Nasser for Cygnus.
@@ -28,7 +28,8 @@
 #include <vector>
 #include <memory>
 #include <string>
-#include <memory>
+
+namespace {
 
 /* A header of a ui_out_table.  */
 
@@ -91,6 +92,8 @@ class ui_out_hdr
   std::string m_header;
 };
 
+} // namespace
+
 /* A level of nesting (either a list or a tuple) in a ui_out output.  */
 
 class ui_out_level
@@ -396,22 +399,6 @@ ui_out::table_end ()
   m_table_up = nullptr;
 }
 
-static void
-do_cleanup_table_end (void *data)
-{
-  ui_out *uiout = (ui_out *) data;
-
-  uiout->table_end ();
-}
-
-struct cleanup *
-make_cleanup_ui_out_table_begin_end (ui_out *uiout, int nr_cols, int nr_rows,
-                                    const char *tblid)
-{
-  uiout->table_begin (nr_cols, nr_rows, tblid);
-  return make_cleanup (do_cleanup_table_end, uiout);
-}
-
 void
 ui_out::begin (ui_out_type type, const char *id)
 {
@@ -450,50 +437,6 @@ ui_out::end (ui_out_type type)
   do_end (type);
 }
 
-struct ui_out_end_cleanup_data
-{
-  struct ui_out *uiout;
-  enum ui_out_type type;
-};
-
-static void
-do_cleanup_end (void *data)
-{
-  struct ui_out_end_cleanup_data *end_cleanup_data
-    = (struct ui_out_end_cleanup_data *) data;
-
-  end_cleanup_data->uiout->end (end_cleanup_data->type);
-  xfree (end_cleanup_data);
-}
-
-static struct cleanup *
-make_cleanup_ui_out_end (struct ui_out *uiout,
-                        enum ui_out_type type)
-{
-  struct ui_out_end_cleanup_data *end_cleanup_data;
-
-  end_cleanup_data = XNEW (struct ui_out_end_cleanup_data);
-  end_cleanup_data->uiout = uiout;
-  end_cleanup_data->type = type;
-  return make_cleanup (do_cleanup_end, end_cleanup_data);
-}
-
-struct cleanup *
-make_cleanup_ui_out_tuple_begin_end (struct ui_out *uiout,
-                                    const char *id)
-{
-  uiout->begin (ui_out_type_tuple, id);
-  return make_cleanup_ui_out_end (uiout, ui_out_type_tuple);
-}
-
-struct cleanup *
-make_cleanup_ui_out_list_begin_end (struct ui_out *uiout,
-                                   const char *id)
-{
-  uiout->begin (ui_out_type_list, id);
-  return make_cleanup_ui_out_end (uiout, ui_out_type_list);
-}
-
 void
 ui_out::field_int (const char *fldname, int value)
 {
@@ -525,19 +468,19 @@ void
 ui_out::field_core_addr (const char *fldname, struct gdbarch *gdbarch,
                         CORE_ADDR address)
 {
-  field_string (fldname, print_core_address (gdbarch, address));
+  field_string (fldname, print_core_address (gdbarch, address),
+               ui_out_style_kind::ADDRESS);
 }
 
 void
-ui_out::field_stream (const char *fldname, ui_file *stream)
+ui_out::field_stream (const char *fldname, string_file &stream,
+                     ui_out_style_kind style)
 {
-  std::string buffer = ui_file_as_string (stream);
-
-  if (!buffer.empty ())
-    field_string (fldname, buffer.c_str ());
+  if (!stream.empty ())
+    field_string (fldname, stream.c_str (), style);
   else
     field_skip (fldname);
-  ui_file_rewind (stream);
+  stream.clear ();
 }
 
 /* Used to omit a field.  */
@@ -555,7 +498,8 @@ ui_out::field_skip (const char *fldname)
 }
 
 void
-ui_out::field_string (const char *fldname, const char *string)
+ui_out::field_string (const char *fldname, const char *string,
+                     ui_out_style_kind style)
 {
   int fldno;
   int width;
@@ -563,7 +507,13 @@ ui_out::field_string (const char *fldname, const char *string)
 
   verify_field (&fldno, &width, &align);
 
-  do_field_string (fldno, width, align, fldname, string);
+  do_field_string (fldno, width, align, fldname, string, style);
+}
+
+void
+ui_out::field_string (const char *fldname, const std::string &string)
+{
+  field_string (fldname, string.c_str ());
 }
 
 /* VARARGS */
@@ -575,7 +525,6 @@ ui_out::field_fmt (const char *fldname, const char *format, ...)
   int width;
   ui_align align;
 
-  /* Will not align, but has to call anyway.  */
   verify_field (&fldno, &width, &align);
 
   va_start (args, format);
@@ -619,10 +568,10 @@ ui_out::flush ()
   do_flush ();
 }
 
-int
+void
 ui_out::redirect (ui_file *outstream)
 {
-  return do_redirect (outstream);
+  do_redirect (outstream);
 }
 
 /* Test the flags against the mask given.  */
@@ -633,7 +582,7 @@ ui_out::test_flags (ui_out_flags mask)
 }
 
 bool
-ui_out::is_mi_like_p ()
+ui_out::is_mi_like_p () const
 {
   return do_is_mi_like_p ();
 }
This page took 0.027329 seconds and 4 git commands to generate.