[PATCH 2/9] gdb: move Modula2 language class into a header file

Gaius Mulley gaius.mulley@southwales.ac.uk
Tue Oct 13 09:58:27 GMT 2020


Andrew Burgess <andrew.burgess@embecosm.com> writes:

> 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.

Hi Andrew,

all looks good to me - thanks for tidying up the code and rationalising
the method names,


regards,
Gaius


More information about the Gdb-patches mailing list