mirror of
https://github.com/espressif/binutils-gdb.git
synced 2025-06-04 13:57:12 +08:00
gdb: Convert language la_printstr field to a method
This commit changes the language_data::la_printstr function pointer member variable into a member function of language_defn. There should be no user visible changes after this commit. gdb/ChangeLog: * ada-lang.c (ada_language_data): Delete la_printstr initializer. (ada_language::printstr): New member function. * c-lang.c (c_language_data): Delete la_printstr initializer. (cplus_language_data): Likewise. (asm_language_data): Likewise. (minimal_language_data): Likewise. * d-lang.c (d_language_data): Likewise. * f-lang.c (f_printstr): Rename to f_language::printstr. (f_language_data): Delete la_printstr initializer. (f_language::printstr): New member function, implementation from f_printstr. * go-lang.c (go_language_data): Delete la_printstr initializer. * language.c (language_defn::printstr): Define new member function. (unk_lang_printstr): Delete. (unknown_language_data): Delete la_printstr initializer. (unknown_language::printstr): New member function. (auto_language_data): Delete la_printstr initializer. (auto_language::printstr): New member function. * language.h (language_data): Delete la_printstr field. (language_defn::printstr): Declare new member function. (LA_PRINT_STRING): Update call to printstr. * m2-lang.c (m2_printstr): Rename to m2_language::printstr. (m2_language_data): Delete la_printstr initializer. (m2_language::printstr): New member function, implementation from m2_printstr. * objc-lang.c (objc_language_data): Delete la_printstr initializer. * opencl-lang.c (opencl_language_data): Likewise. * p-lang.c (pascal_printstr): Rename to pascal_language::printstr. (pascal_language_data): Delete la_printstr initializer. (pascal_language::printstr): New member function, implementation from pascal_printstr. * p-lang.h (pascal_printstr): Delete declaration. * rust-lang.c (rust_printstr): Update header comment. (rust_language_data): Delete la_printstr initializer. (rust_language::printstr): New member function.
This commit is contained in:
43
gdb/f-lang.c
43
gdb/f-lang.c
@ -68,29 +68,6 @@ f_get_encoding (struct type *type)
|
||||
return encoding;
|
||||
}
|
||||
|
||||
/* Print the character string STRING, printing at most LENGTH characters.
|
||||
Printing stops early if the number hits print_max; repeat counts
|
||||
are printed as appropriate. Print ellipses at the end if we
|
||||
had to stop before printing LENGTH characters, or if FORCE_ELLIPSES.
|
||||
FIXME: This is a copy of the same function from c-exp.y. It should
|
||||
be replaced with a true F77 version. */
|
||||
|
||||
static void
|
||||
f_printstr (struct ui_file *stream, struct type *type, const gdb_byte *string,
|
||||
unsigned int length, const char *encoding, int force_ellipses,
|
||||
const struct value_print_options *options)
|
||||
{
|
||||
const char *type_encoding = f_get_encoding (type);
|
||||
|
||||
if (TYPE_LENGTH (type) == 4)
|
||||
fputs_filtered ("4_", stream);
|
||||
|
||||
if (!encoding || !*encoding)
|
||||
encoding = type_encoding;
|
||||
|
||||
generic_printstr (stream, type, string, length, encoding,
|
||||
force_ellipses, '\'', 0, options);
|
||||
}
|
||||
|
||||
|
||||
/* Table of operators and their precedences for printing expressions. */
|
||||
@ -536,7 +513,6 @@ extern const struct language_data f_language_data =
|
||||
macro_expansion_no,
|
||||
f_extensions,
|
||||
&exp_descriptor_f,
|
||||
f_printstr, /* function to print string constant */
|
||||
f_print_typedef, /* Print a typedef using appropriate syntax */
|
||||
NULL, /* name_of_this */
|
||||
false, /* la_store_sym_names_in_linkage_form_p */
|
||||
@ -707,6 +683,25 @@ public:
|
||||
fputs_filtered ("'", stream);
|
||||
}
|
||||
|
||||
/* See language.h. */
|
||||
|
||||
void printstr (struct ui_file *stream, struct type *elttype,
|
||||
const gdb_byte *string, unsigned int length,
|
||||
const char *encoding, int force_ellipses,
|
||||
const struct value_print_options *options) const override
|
||||
{
|
||||
const char *type_encoding = f_get_encoding (elttype);
|
||||
|
||||
if (TYPE_LENGTH (elttype) == 4)
|
||||
fputs_filtered ("4_", stream);
|
||||
|
||||
if (!encoding || !*encoding)
|
||||
encoding = type_encoding;
|
||||
|
||||
generic_printstr (stream, elttype, string, length, encoding,
|
||||
force_ellipses, '\'', 0, options);
|
||||
}
|
||||
|
||||
protected:
|
||||
|
||||
/* See language.h. */
|
||||
|
Reference in New Issue
Block a user