From 46157d77c324ab6adf52ddf994a6ccb3328b3edb Mon Sep 17 00:00:00 2001 From: Andrew Burgess Date: Wed, 28 Oct 2020 18:10:01 +0000 Subject: gdb: move pascal_language into p-lang.h Move the pascal_language class declaration into the p-lang.h header file. This allows for the function implementations to be spread over the different p-*.c files without the need for global trampoline functions. As a consequence of this change many of the Pascal value and type printing helper functions have become member functions within the pascal_language class. There should be no user visible changes after this commit. gdb/ChangeLog: * p-exp.y (exp): Update call to pascal_is_string_type. (pascal_parse): Rename to... (pascal_language::parser): ...this. * p-lang.c (is_pascal_string_type): Rename to... (pascal_is_string_type): ...this. (pascal_one_char): Rename to... (pascal_language::print_one_char): ...this. (pascal_printchar): Rename to... (pascal_language::printchar): ...this. Update call to print_one_char member function. (pascal_op_print_tab): Rename to... (pascal_language::op_print_tab): ...this. (class pascal_language): Moved to p-lang.h. (pascal_language::language_arch_info): Function implementation moved out of class declaration. (pascal_language::printstr): Likewise. * p-lang.h (pascal_parse): Delete declaration. (pascal_is_string_type): Declare. (pascal_print_type): Delete declaration. (pascal_print_typedef): Delete declaration. (pascal_value_print_inner): Delete declaration. (pascal_value_print): Delete declaration. (pascal_type_print_method_args): Delete declaration. (is_pascal_string_type): Delete declaration. (pascal_printchar): Delete declaration. (pascal_builtin_types): Delete declaration. (pascal_type_print_base): Delete declaration. (pascal_type_print_varspec_prefix): Delete declaration. (class pascal_language): Moved here from p-lang.c. * p-typeprint.c (pascal_type_print_varspec_suffix): Delete declaration. (pascal_type_print_derivation_info): Delete declaration. (pascal_print_type): Rename to... (pascal_language::print_type): ...this. Update calls to member functions. (pascal_print_typedef): Rename to... (pascal_language::print_typedef): ...this. Update calls to member functions. (pascal_type_print_derivation_info): Rename to... (pascal_language::type_print_derivation_info): ...this. (pascal_type_print_method_args): Rename to... (pascal_language::type_print_method_args): ...this. (pascal_type_print_varspec_prefix): Rename to... (pascal_language::type_print_varspec_prefix): ...this. Update calls to member functions. (pascal_print_func_args): Rename to... (pascal_language::print_func_args): ...this. Update calls to member functions. (pascal_type_print_func_varspec_suffix): Rename to... (pascal_language::type_print_func_varspec_suffix): ...this. Update calls to member functions. (pascal_type_print_varspec_suffix): Rename to... (pascal_language::type_print_varspec_suffix): ...this. Update calls to member functions. (pascal_type_print_base): Rename to... (pascal_language::type_print_base): ...this. Update calls to member functions. * p-valprint.c (pascal_value_print_inner): Rename to... (pascal_language::value_print_inner): ...this. Update calls to member functions. (pascal_value_print): Rename to... (pascal_language::value_print): ...this. Update calls to member functions. --- gdb/p-exp.y | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'gdb/p-exp.y') diff --git a/gdb/p-exp.y b/gdb/p-exp.y index 618557c..469c284 100644 --- a/gdb/p-exp.y +++ b/gdb/p-exp.y @@ -301,10 +301,9 @@ exp : field_exp COMPLETE exp : exp '[' /* We need to save the current_type value. */ { const char *arrayname; - int arrayfieldindex; - arrayfieldindex = is_pascal_string_type ( - current_type, NULL, NULL, - NULL, NULL, &arrayname); + int arrayfieldindex + = pascal_is_string_type (current_type, NULL, NULL, + NULL, NULL, &arrayname); if (arrayfieldindex) { struct stoken stringsval; @@ -1727,8 +1726,10 @@ yylex (void) } } +/* See language.h. */ + int -pascal_parse (struct parser_state *par_state) +pascal_language::parser (struct parser_state *par_state) const { /* Setting up the parser state. */ scoped_restore pstate_restore = make_scoped_restore (&pstate); -- cgit v1.1