aboutsummaryrefslogtreecommitdiff
path: root/gdb/compile/compile-c-support.c
diff options
context:
space:
mode:
authorTom Tromey <tom@tromey.com>2022-01-02 11:46:15 -0700
committerTom Tromey <tom@tromey.com>2022-03-29 12:46:24 -0600
commit6cb06a8cdaaf30f5d879f24d37100cf1d25c6a3a (patch)
tree641a6a86240919fe4ba9219fbbbe15bc6331c22d /gdb/compile/compile-c-support.c
parenta11ac3b3e8ff6769badcf0041894f6c5acc1b94f (diff)
downloadgdb-6cb06a8cdaaf30f5d879f24d37100cf1d25c6a3a.zip
gdb-6cb06a8cdaaf30f5d879f24d37100cf1d25c6a3a.tar.gz
gdb-6cb06a8cdaaf30f5d879f24d37100cf1d25c6a3a.tar.bz2
Unify gdb printf functions
Now that filtered and unfiltered output can be treated identically, we can unify the printf family of functions. This is done under the name "gdb_printf". Most of this patch was written by script.
Diffstat (limited to 'gdb/compile/compile-c-support.c')
-rw-r--r--gdb/compile/compile-c-support.c50
1 files changed, 25 insertions, 25 deletions
diff --git a/gdb/compile/compile-c-support.c b/gdb/compile/compile-c-support.c
index 52a7cc1..81356f0 100644
--- a/gdb/compile/compile-c-support.c
+++ b/gdb/compile/compile-c-support.c
@@ -161,7 +161,7 @@ print_one_macro (const char *name, const struct macro_definition *macro,
/* None of -Wno-builtin-macro-redefined, #undef first
or plain #define of the same value would avoid a warning. */
- fprintf_filtered (file, "#ifndef %s\n# define %s", name, name);
+ gdb_printf (file, "#ifndef %s\n# define %s", name, name);
if (macro->kind == macro_function_like)
{
@@ -177,7 +177,7 @@ print_one_macro (const char *name, const struct macro_definition *macro,
gdb_puts (")", file);
}
- fprintf_filtered (file, " %s\n#endif\n", macro->replacement);
+ gdb_printf (file, " %s\n#endif\n", macro->replacement);
}
/* Write macro definitions at PC to FILE. */
@@ -245,8 +245,8 @@ generate_register_struct (struct ui_file *stream, struct gdbarch *gdbarch,
switch (regtype->code ())
{
case TYPE_CODE_PTR:
- fprintf_filtered (stream, "__gdb_uintptr %s",
- regname.c_str ());
+ gdb_printf (stream, "__gdb_uintptr %s",
+ regname.c_str ());
break;
case TYPE_CODE_INT:
@@ -258,11 +258,11 @@ generate_register_struct (struct ui_file *stream, struct gdbarch *gdbarch,
{
if (regtype->is_unsigned ())
gdb_puts ("unsigned ", stream);
- fprintf_unfiltered (stream,
- "int %s"
- " __attribute__ ((__mode__(__%s__)))",
- regname.c_str (),
- mode);
+ gdb_printf (stream,
+ "int %s"
+ " __attribute__ ((__mode__(__%s__)))",
+ regname.c_str (),
+ mode);
break;
}
}
@@ -270,12 +270,12 @@ generate_register_struct (struct ui_file *stream, struct gdbarch *gdbarch,
/* Fall through. */
default:
- fprintf_unfiltered (stream,
- " unsigned char %s[%s]"
- " __attribute__((__aligned__("
- "__BIGGEST_ALIGNMENT__)))",
- regname.c_str (),
- pulongest (TYPE_LENGTH (regtype)));
+ gdb_printf (stream,
+ " unsigned char %s[%s]"
+ " __attribute__((__aligned__("
+ "__BIGGEST_ALIGNMENT__)))",
+ regname.c_str (),
+ pulongest (TYPE_LENGTH (regtype)));
}
gdb_puts (";\n", stream);
}
@@ -393,15 +393,15 @@ struct c_add_input
{
case COMPILE_I_PRINT_ADDRESS_SCOPE:
case COMPILE_I_PRINT_VALUE_SCOPE:
- fprintf_unfiltered (buf,
- "__auto_type " COMPILE_I_EXPR_VAL " = %s;\n"
- "typeof (%s) *" COMPILE_I_EXPR_PTR_TYPE ";\n"
- "memcpy (" COMPILE_I_PRINT_OUT_ARG ", %s"
- COMPILE_I_EXPR_VAL ",\n"
- "sizeof (*" COMPILE_I_EXPR_PTR_TYPE "));\n"
- , input, input,
- (type == COMPILE_I_PRINT_ADDRESS_SCOPE
- ? "&" : ""));
+ gdb_printf (buf,
+ "__auto_type " COMPILE_I_EXPR_VAL " = %s;\n"
+ "typeof (%s) *" COMPILE_I_EXPR_PTR_TYPE ";\n"
+ "memcpy (" COMPILE_I_PRINT_OUT_ARG ", %s"
+ COMPILE_I_EXPR_VAL ",\n"
+ "sizeof (*" COMPILE_I_EXPR_PTR_TYPE "));\n"
+ , input, input,
+ (type == COMPILE_I_PRINT_ADDRESS_SCOPE
+ ? "&" : ""));
break;
default:
@@ -494,7 +494,7 @@ struct cplus_add_input
{
case COMPILE_I_PRINT_VALUE_SCOPE:
case COMPILE_I_PRINT_ADDRESS_SCOPE:
- fprintf_unfiltered
+ gdb_printf
(buf,
/* "auto" strips ref- and cv- qualifiers, so we need to also strip
those from COMPILE_I_EXPR_PTR_TYPE. */