Remove the ui_out_style_kind enum

This removes the ui_out_style_kind enum, in favor of simply using
ui_file_style references.  This simplifies the code somewhat.

gdb/ChangeLog
2019-10-01  Tom Tromey  <tom@tromey.com>

	* ui-out.h (enum class ui_out_style_kind): Remove.
	(class ui_out) <field_string, field_stsream, do_field_string>:
	Change type of "style".
	* ui-out.c (ui_out::field_core_addr, ui_out::field_stream)
	(ui_out::field_string): Update.
	* tui/tui-out.h (class tui_ui_out) <do_field_string>: Change type
	of "style".
	* tui/tui-out.c (tui_ui_out::do_field_string): Update.
	* tracepoint.c (print_one_static_tracepoint_marker): Update.
	* stack.c (print_frame_arg, print_frame_info, print_frame):
	Update.
	* source.c (print_source_lines_base): Update.
	* solib.c (info_sharedlibrary_command): Update.
	* skip.c (info_skip_command): Update.
	* record-btrace.c (btrace_call_history_src_line)
	(btrace_call_history): Update.
	* python/py-framefilter.c (py_print_frame): Update.
	* mi/mi-out.h (class mi_ui_out) <do_field_string>: Change type of
	"style".
	* mi/mi-out.c (mi_ui_out::do_table_header)
	(mi_ui_out::do_field_signed, mi_ui_out::do_field_unsigned)
	(mi_ui_out::do_field_string): Update.
	* disasm.c (gdb_pretty_print_disassembler::pretty_print_insn):
	Update.
	* cli-out.h (class cli_ui_out) <do_field_string>: Change type of
	"style".
	* cli-out.c (cli_ui_out::do_table_header)
	(cli_ui_out::do_field_signed, cli_ui_out::do_field_unsigned)
	(cli_ui_out::do_field_skip, cli_ui_out::do_field_string)
	(cli_ui_out::do_field_fmt): Update.
	* breakpoint.c (print_breakpoint_location): Update.
	(update_static_tracepoint): Update.
This commit is contained in:
Tom Tromey 2019-06-05 16:21:24 -06:00
parent 53d666ecfb
commit e43b10e10e
18 changed files with 93 additions and 86 deletions

View file

@ -73,7 +73,7 @@ cli_ui_out::do_table_header (int width, ui_align alignment,
return;
do_field_string (0, width, alignment, 0, col_hdr.c_str (),
ui_out_style_kind::DEFAULT);
ui_file_style ());
}
/* Mark beginning of a list */
@ -100,7 +100,7 @@ cli_ui_out::do_field_signed (int fldno, int width, ui_align alignment,
return;
do_field_string (fldno, width, alignment, fldname, plongest (value),
ui_out_style_kind::DEFAULT);
ui_file_style ());
}
/* output an unsigned field */
@ -113,7 +113,7 @@ cli_ui_out::do_field_unsigned (int fldno, int width, ui_align alignment,
return;
do_field_string (fldno, width, alignment, fldname, pulongest (value),
ui_out_style_kind::DEFAULT);
ui_file_style ());
}
/* used to omit a field */
@ -126,7 +126,7 @@ cli_ui_out::do_field_skip (int fldno, int width, ui_align alignment,
return;
do_field_string (fldno, width, alignment, fldname, "",
ui_out_style_kind::DEFAULT);
ui_file_style ());
}
/* other specific cli_field_* end up here so alignment and field
@ -135,7 +135,7 @@ cli_ui_out::do_field_skip (int fldno, int width, ui_align alignment,
void
cli_ui_out::do_field_string (int fldno, int width, ui_align align,
const char *fldname, const char *string,
ui_out_style_kind style)
const ui_file_style &style)
{
int before = 0;
int after = 0;
@ -170,31 +170,7 @@ cli_ui_out::do_field_string (int fldno, int width, ui_align align,
spaces (before);
if (string)
{
ui_file_style fstyle;
switch (style)
{
case ui_out_style_kind::DEFAULT:
/* Nothing. */
break;
case ui_out_style_kind::FILE:
/* Nothing. */
fstyle = file_name_style.style ();
break;
case ui_out_style_kind::FUNCTION:
fstyle = function_name_style.style ();
break;
case ui_out_style_kind::VARIABLE:
fstyle = variable_name_style.style ();
break;
case ui_out_style_kind::ADDRESS:
fstyle = address_style.style ();
break;
default:
gdb_assert_not_reached ("missing case");
}
fputs_styled (string, fstyle, m_streams.back ());
}
fputs_styled (string, style, m_streams.back ());
if (after)
spaces (after);
@ -216,7 +192,7 @@ cli_ui_out::do_field_fmt (int fldno, int width, ui_align align,
std::string str = string_vprintf (format, args);
do_field_string (fldno, width, align, fldname, str.c_str (),
ui_out_style_kind::DEFAULT);
ui_file_style ());
}
void