Remove printfi_filtered and fprintfi_filtered

After seeing Simon's patch, I thought maybe it was finally time to
remove printfi_filtered and fprintfi_filtered, in favor of using the
"%*s" approach to indenting.

In this patch I took the straightforward approach of always adding a
leading "%*s", even when the format already started with "%s", to
avoid the trickier form of:

    printf ("%*s", -indent, string)

Regression tested on x86-64 Fedora 32.
Let me know what you think.

gdb/ChangeLog
2020-12-17  Tom Tromey  <tromey@adacore.com>

	* gdbtypes.c (print_args, dump_fn_fieldlists, print_cplus_stuff)
	(print_gnat_stuff, print_fixed_point_type_info)
	(recursive_dump_type): Update.
	* go32-nat.c (go32_sysinfo, display_descriptor): Update.
	* c-typeprint.c (c_type_print_base_struct_union)
	(c_type_print_base_1): Update.
	* rust-lang.c (rust_internal_print_type): Update.
	* f-typeprint.c (f_language::f_type_print_base): Update.
	* utils.h (fprintfi_filtered, printfi_filtered): Remove.
	* m2-typeprint.c (m2_record_fields): Update.
	* p-typeprint.c (pascal_type_print_base): Update.
	* compile/compile-loc2c.c (push, pushf, unary, binary)
	(do_compile_dwarf_expr_to_c): Update.
	* utils.c (fprintfi_filtered, printfi_filtered): Remove.
This commit is contained in:
Tom Tromey
2020-12-17 13:29:38 -07:00
parent 85be4f5a8c
commit 32f47895b5
11 changed files with 212 additions and 215 deletions

View File

@@ -1122,13 +1122,13 @@ c_type_print_base_struct_union (struct type *type, struct ui_file *stream,
&& TYPE_TYPEDEF_FIELD_COUNT (type) == 0)
{
if (type->is_stub ())
fprintfi_filtered (level + 4, stream,
_("%p[<incomplete type>%p]\n"),
metadata_style.style ().ptr (), nullptr);
fprintf_filtered (stream, _("%*s%p[<incomplete type>%p]\n"),
level + 4, "",
metadata_style.style ().ptr (), nullptr);
else
fprintfi_filtered (level + 4, stream,
_("%p[<no data fields>%p]\n"),
metadata_style.style ().ptr (), nullptr);
fprintf_filtered (stream, _("%*s%p[<no data fields>%p]\n"),
level + 4, "",
metadata_style.style ().ptr (), nullptr);
}
/* Start off with no specific section type, so we can print
@@ -1439,7 +1439,7 @@ c_type_print_base_struct_union (struct type *type, struct ui_file *stream,
print_spaces_filtered (2, stream);
}
fprintfi_filtered (level, stream, "}");
fprintf_filtered (stream, "%*s}", level, "");
}
}
@@ -1633,13 +1633,15 @@ c_type_print_base_1 (struct type *type, struct ui_file *stream,
if (type->num_fields () == 0)
{
if (type->is_stub ())
fprintfi_filtered (level + 4, stream,
_("%p[<incomplete type>%p]\n"),
metadata_style.style ().ptr (), nullptr);
fprintf_filtered (stream,
_("%*s%p[<incomplete type>%p]\n"),
level + 4, "",
metadata_style.style ().ptr (), nullptr);
else
fprintfi_filtered (level + 4, stream,
_("%p[<no data fields>%p]\n"),
metadata_style.style ().ptr (), nullptr);
fprintf_filtered (stream,
_("%*s%p[<no data fields>%p]\n"),
level + 4, "",
metadata_style.style ().ptr (), nullptr);
}
len = type->num_fields ();
for (i = 0; i < len; i++)
@@ -1663,7 +1665,7 @@ c_type_print_base_1 (struct type *type, struct ui_file *stream,
}
fprintf_filtered (stream, ";\n");
}
fprintfi_filtered (level, stream, "}");
fprintf_filtered (stream, "%*s}", level, "");
}
}
break;