From ec8cec5b96e2ebbd5e25a737c69d311970a8b219 Mon Sep 17 00:00:00 2001 From: Andrew Burgess Date: Tue, 2 Jun 2020 21:54:49 +0100 Subject: gdb: Convert language la_emitchar field to a method This commit changes the language_data::la_emitchar 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 (emit_char): Renamed to ada_language::emitchar. (ada_language_data): Delete la_emitchar initializer. (ada_language::emitchar): New member function, implementation from emit_char. * c-lang.c (c_language_data): Delete la_emitchar initializer. (cplus_language_data): Likewise. (asm_language_data): Likewise. (minimal_language_data): Likewise. * d-lang.c (d_language_data): Likewise. * f-lang.c (f_emit_char): Rename to f_language::emitchar. (f_language_data): Delete la_emitchar initializer. (f_language::emitchar): New member function, implementation from f_emit_char. * go-lang.c (go_language_data): Delete la_emitchar initializer. * language.c (unk_lang_emit_char): Delete. (language_defn::emitchar): New member function definition. (unknown_language_data): Delete la_emitchar initializer. (unknown_language::emitchar): New member function. (auto_language_data): Delete la_emitchar initializer. (auto_language::emitchar): New member function. * language.h (language_data): Delete la_emitchar field. (language_defn::emitchar): New member field declaration. (LA_EMIT_CHAR): Update call to emitchar. * m2-lang.c (m2_emit_char): Rename to m2_language::emitchar. (m2_language_data): Delete la_emitchar initializer. (m2_language::emitchar): New member function, implementation from m2_emit_char. * objc-lang.c (objc_language_data): Delete la_emitchar initializer. * opencl-lang.c (opencl_language_data): Likewise. * p-lang.c (pascal_emit_char): Rename to pascal_language::emitchar. (pascal_language_data): Delete la_emitchar initializer. (pascal_language::emitchar): New member function, implementation from pascal_emit_char. * rust-lang.c (rust_emitchar): Rename to rust_language::emitchar. (rust_language_data): Delete la_emitchar initializer. (rust_language::emitchar): New member function, implementation from rust_emitchar. --- gdb/language.c | 40 +++++++++++++++++++++++++--------------- 1 file changed, 25 insertions(+), 15 deletions(-) (limited to 'gdb/language.c') diff --git a/gdb/language.c b/gdb/language.c index 72fa1e4..6778646b 100644 --- a/gdb/language.c +++ b/gdb/language.c @@ -49,9 +49,6 @@ static void set_range_case (void); -static void unk_lang_emit_char (int c, struct type *type, - struct ui_file *stream, int quoter); - static void unk_lang_printchar (int c, struct type *type, struct ui_file *stream); @@ -657,6 +654,15 @@ language_defn::value_print_inner return c_value_print_inner (val, stream, recurse, options); } +/* See language.h. */ + +void +language_defn::emitchar (int ch, struct type *chtype, + struct ui_file * stream, int quoter) const +{ + c_emit_char (ch, chtype, stream, quoter); +} + /* The default implementation of the get_symbol_name_matcher_inner method from the language_defn class. Matches with strncmp_iw. */ @@ -722,16 +728,6 @@ default_is_string_type_p (struct type *type) return (type->code () == TYPE_CODE_STRING); } -/* Define the language that is no language. */ - -static void -unk_lang_emit_char (int c, struct type *type, struct ui_file *stream, - int quoter) -{ - error (_("internal error - unimplemented " - "function unk_lang_emit_char called.")); -} - static void unk_lang_printchar (int c, struct type *type, struct ui_file *stream) { @@ -779,7 +775,6 @@ extern const struct language_data unknown_language_data = &exp_descriptor_standard, unk_lang_printchar, /* Print character constant */ unk_lang_printstr, - unk_lang_emit_char, default_print_typedef, /* Print a typedef using appropriate syntax */ "this", /* name_of_this */ true, /* store_sym_names_in_linkage_form_p */ @@ -848,6 +843,14 @@ public: /* No parsing is done, just claim success. */ return 1; } + + /* See language.h. */ + + void emitchar (int ch, struct type *chtype, + struct ui_file *stream, int quoter) const override + { + error (_("unimplemented unknown_language::emitchar called")); + } }; /* Single instance of the unknown language class. */ @@ -869,7 +872,6 @@ extern const struct language_data auto_language_data = &exp_descriptor_standard, unk_lang_printchar, /* Print character constant */ unk_lang_printstr, - unk_lang_emit_char, default_print_typedef, /* Print a typedef using appropriate syntax */ "this", /* name_of_this */ false, /* store_sym_names_in_linkage_form_p */ @@ -938,6 +940,14 @@ public: /* No parsing is done, just claim success. */ return 1; } + + /* See language.h. */ + + void emitchar (int ch, struct type *chtype, + struct ui_file *stream, int quoter) const override + { + error (_("unimplemented auto_language::emitchar called")); + } }; /* Single instance of the fake "auto" language. */ -- cgit v1.1