aboutsummaryrefslogtreecommitdiff
path: root/gdb/m2-valprint.c
diff options
context:
space:
mode:
authorAndrew Burgess <andrew.burgess@embecosm.com>2020-08-14 14:50:48 +0100
committerAndrew Burgess <andrew.burgess@embecosm.com>2020-10-23 10:57:13 +0100
commit790e2a12487890559d692d60bdaefaef9b9b45b1 (patch)
tree6599b3ad35d4564009d20029a6b543258f175236 /gdb/m2-valprint.c
parentb01175fc46bbb9103bde88ec93236bcb6719c696 (diff)
downloadgdb-790e2a12487890559d692d60bdaefaef9b9b45b1.zip
gdb-790e2a12487890559d692d60bdaefaef9b9b45b1.tar.gz
gdb-790e2a12487890559d692d60bdaefaef9b9b45b1.tar.bz2
gdb: move Modula2 language class into a header file
Move the m2_language class from m2-lang.c into m2-lang.h. The benefit of this move is that we can remove trampoline functions. Currently the language implementation is split of different m2-* files with m2-lang.h including declaration for all the language implementation functions. Currently the m2_language class in m2-lang.c has member functions that then call the global functions declared in m2-lang.h. After this change the m2_language class is declared in m2-lang.h, and the member functions are the implementations defined in all the m2-* files. There should be no user visible changes after this commit. gdb/ChangeLog: * m2-exp.y (m2_parse): Rename to... (m2_language::parser): ...this. Update function signature. * m2-lang.c (m2_printchar): Renamed to m2_language::printchar. (m2_op_print): Rename to... (m2_language::op_print_tab): ...this, and make const. (exp_descriptor_modula2): Rename to... (m2_language::exp_descriptor_modula2): ...this. (class m2_language): Move to m2-lang.h. (m2_language::language_arch_info): New function, moved out of class declaration. (m2_language::printchar): New function, body from m2_printchar. (m2_language::printstr): New function, moved out of class declaration. (m2_language::emitchar): Likewise. * m2-lang.h (m2_parse): Delete declaration. (m2_print_typedef): Delete declaration. (m2_value_print_inner): Delete declaration. (class m2_language): Class declaration moved from m2-lang.c, larger functions are left in m2-lang.c. * m2-typeprint.c (m2_print_typedef): Rename to... (m2_language::print_typedef): ...this, and update function signature. * m2-valprint.c (m2_value_print_inner): Rename to... (m2_language::value_print_inner): ...this, replace use of LA_PRINT_STRING with a direct call to printstr member function, and update recursive call.
Diffstat (limited to 'gdb/m2-valprint.c')
-rw-r--r--gdb/m2-valprint.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/gdb/m2-valprint.c b/gdb/m2-valprint.c
index c285543..fdccbaf 100644
--- a/gdb/m2-valprint.c
+++ b/gdb/m2-valprint.c
@@ -298,8 +298,9 @@ static const struct generic_val_print_decorations m2_decorations =
/* See m2-lang.h. */
void
-m2_value_print_inner (struct value *val, struct ui_file *stream, int recurse,
- const struct value_print_options *options)
+m2_language::value_print_inner (struct value *val, struct ui_file *stream,
+ int recurse,
+ const struct value_print_options *options) const
{
unsigned len;
struct type *elttype;
@@ -336,8 +337,8 @@ m2_value_print_inner (struct value *val, struct ui_file *stream, int recurse,
len = temp_len;
}
- LA_PRINT_STRING (stream, TYPE_TARGET_TYPE (type),
- valaddr, len, NULL, 0, options);
+ printstr (stream, TYPE_TARGET_TYPE (type), valaddr, len,
+ NULL, 0, options);
}
else
{
@@ -445,7 +446,7 @@ m2_value_print_inner (struct value *val, struct ui_file *stream, int recurse,
if (TYPE_LENGTH (type) == TYPE_LENGTH (TYPE_TARGET_TYPE (type)))
{
struct value *v = value_cast (TYPE_TARGET_TYPE (type), val);
- m2_value_print_inner (v, stream, recurse, options);
+ value_print_inner (v, stream, recurse, options);
break;
}
/* FALLTHROUGH */