diff options
author | Andrew Burgess <andrew.burgess@embecosm.com> | 2020-06-02 14:48:04 +0100 |
---|---|---|
committer | Andrew Burgess <andrew.burgess@embecosm.com> | 2020-06-23 13:34:10 +0100 |
commit | 87afa6523b01cd6bdcc3903fe22953966cec7bb7 (patch) | |
tree | f97b950d1ff8b582383dad54e51e7bd65280ff7d /gdb | |
parent | 3084d7a27b8e4d13f0fdd0fac62ffadc9c2223b5 (diff) | |
download | gdb-87afa6523b01cd6bdcc3903fe22953966cec7bb7.zip gdb-87afa6523b01cd6bdcc3903fe22953966cec7bb7.tar.gz gdb-87afa6523b01cd6bdcc3903fe22953966cec7bb7.tar.bz2 |
gdb: Convert language la_parser field to a method
This commit changes the language_data::la_parser 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 (parse): Rename to ada_language::parser.
(ada_language_data): Delete la_parser initializer.
(ada_language::parser): New member function, implementation from
parse.
* c-lang.c (c_language_data): Delete la_parser initializer.
(cplus_language_data): Likewise.
(asm_language_data): Likewise.
(minimal_language_data): Likewise.
* d-lang.c (d_language_data): Likewise.
(d_language::parser): New member function.
* f-lang.c (f_language_data): Delete la_parser initializer.
(f_language::parser): New member function.
* go-lang.c (go_language_data): Delete la_parser initializer.
(go_language::parser): New member function.
* language.c (unk_lang_parser): Delete.
(language_defn::parser): Define new member function.
(unknown_language_data): Delete la_parser initializer.
(unknown_language::parser): New member function.
(auto_language_data): Delete la_parser initializer.
(auto_language::parser): New member function.
* language.h (language_data): Delete la_parser field.
(language_defn::parser): Declare new member function.
* m2-lang.c (m2_language_data): Delete la_parser initializer.
(m2_language::parser): New member function.
* objc-lang.c (objc_language_data): Delete la_parser initializer.
* opencl-lang.c (opencl_language_data): Likewise.
* p-lang.c (pascal_language_data): Likewise.
(pascal_language::parser): New member function.
* parse.c (parse_exp_in_context): Update call to parser.
* rust-lang.c (rust_language_data): Delete la_parser initializer.
(rust_language::parser): New member function.
Diffstat (limited to 'gdb')
-rw-r--r-- | gdb/ChangeLog | 34 | ||||
-rw-r--r-- | gdb/ada-lang.c | 16 | ||||
-rw-r--r-- | gdb/c-lang.c | 4 | ||||
-rw-r--r-- | gdb/d-lang.c | 8 | ||||
-rw-r--r-- | gdb/f-lang.c | 8 | ||||
-rw-r--r-- | gdb/go-lang.c | 8 | ||||
-rw-r--r-- | gdb/language.c | 34 | ||||
-rw-r--r-- | gdb/language.h | 8 | ||||
-rw-r--r-- | gdb/m2-lang.c | 8 | ||||
-rw-r--r-- | gdb/objc-lang.c | 1 | ||||
-rw-r--r-- | gdb/opencl-lang.c | 1 | ||||
-rw-r--r-- | gdb/p-lang.c | 8 | ||||
-rw-r--r-- | gdb/parse.c | 2 | ||||
-rw-r--r-- | gdb/rust-lang.c | 8 |
14 files changed, 113 insertions, 35 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index cf1c037..a0e120d 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,5 +1,39 @@ 2020-06-23 Andrew Burgess <andrew.burgess@embecosm.com> + * ada-lang.c (parse): Rename to ada_language::parser. + (ada_language_data): Delete la_parser initializer. + (ada_language::parser): New member function, implementation from + parse. + * c-lang.c (c_language_data): Delete la_parser initializer. + (cplus_language_data): Likewise. + (asm_language_data): Likewise. + (minimal_language_data): Likewise. + * d-lang.c (d_language_data): Likewise. + (d_language::parser): New member function. + * f-lang.c (f_language_data): Delete la_parser initializer. + (f_language::parser): New member function. + * go-lang.c (go_language_data): Delete la_parser initializer. + (go_language::parser): New member function. + * language.c (unk_lang_parser): Delete. + (language_defn::parser): Define new member function. + (unknown_language_data): Delete la_parser initializer. + (unknown_language::parser): New member function. + (auto_language_data): Delete la_parser initializer. + (auto_language::parser): New member function. + * language.h (language_data): Delete la_parser field. + (language_defn::parser): Declare new member function. + * m2-lang.c (m2_language_data): Delete la_parser initializer. + (m2_language::parser): New member function. + * objc-lang.c (objc_language_data): Delete la_parser initializer. + * opencl-lang.c (opencl_language_data): Likewise. + * p-lang.c (pascal_language_data): Likewise. + (pascal_language::parser): New member function. + * parse.c (parse_exp_in_context): Update call to parser. + * rust-lang.c (rust_language_data): Delete la_parser initializer. + (rust_language::parser): New member function. + +2020-06-23 Andrew Burgess <andrew.burgess@embecosm.com> + * top.c (print_gdb_configuration): Print --with-python-libdir configuration value. diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c index d303915..c4ee79e 100644 --- a/gdb/ada-lang.c +++ b/gdb/ada-lang.c @@ -13534,13 +13534,6 @@ emit_char (int c, struct type *type, struct ui_file *stream, int quoter) ada_emit_char (c, type, stream, quoter, 1); } -static int -parse (struct parser_state *ps) -{ - warnings_issued = 0; - return ada_parse (ps); -} - static const struct exp_descriptor ada_exp_descriptor = { ada_print_subexp, ada_operator_length, @@ -13718,7 +13711,6 @@ extern const struct language_data ada_language_data = macro_expansion_no, ada_extensions, &ada_exp_descriptor, - parse, resolve, ada_printchar, /* Print a character constant */ ada_printstr, /* Function to print string constant */ @@ -14116,6 +14108,14 @@ public: return {}; } + /* See language.h. */ + + int parser (struct parser_state *ps) const override + { + warnings_issued = 0; + return ada_parse (ps); + } + protected: /* See language.h. */ diff --git a/gdb/c-lang.c b/gdb/c-lang.c index 64dfd71..37e69d4 100644 --- a/gdb/c-lang.c +++ b/gdb/c-lang.c @@ -889,7 +889,6 @@ extern const struct language_data c_language_data = macro_expansion_c, c_extensions, &exp_descriptor_c, - c_parse, null_post_parser, c_printchar, /* Print a character constant */ c_printstr, /* Function to print string constant */ @@ -997,7 +996,6 @@ extern const struct language_data cplus_language_data = macro_expansion_c, cplus_extensions, &exp_descriptor_c, - c_parse, null_post_parser, c_printchar, /* Print a character constant */ c_printstr, /* Function to print string constant */ @@ -1202,7 +1200,6 @@ extern const struct language_data asm_language_data = macro_expansion_c, asm_extensions, &exp_descriptor_c, - c_parse, null_post_parser, c_printchar, /* Print a character constant */ c_printstr, /* Function to print string constant */ @@ -1265,7 +1262,6 @@ extern const struct language_data minimal_language_data = macro_expansion_c, NULL, &exp_descriptor_c, - c_parse, null_post_parser, c_printchar, /* Print a character constant */ c_printstr, /* Function to print string constant */ diff --git a/gdb/d-lang.c b/gdb/d-lang.c index 5689b6c..e2765b5 100644 --- a/gdb/d-lang.c +++ b/gdb/d-lang.c @@ -142,7 +142,6 @@ extern const struct language_data d_language_data = macro_expansion_no, d_extensions, &exp_descriptor_c, - d_parse, null_post_parser, c_printchar, /* Print a character constant. */ c_printstr, /* Function to print string constant. */ @@ -273,6 +272,13 @@ public: { return d_lookup_symbol_nonlocal (this, name, block, domain); } + + /* See language.h. */ + + int parser (struct parser_state *ps) const override + { + return d_parse (ps); + } }; /* Single instance of the D language class. */ diff --git a/gdb/f-lang.c b/gdb/f-lang.c index db337be..918a8cf 100644 --- a/gdb/f-lang.c +++ b/gdb/f-lang.c @@ -564,7 +564,6 @@ extern const struct language_data f_language_data = macro_expansion_no, f_extensions, &exp_descriptor_f, - f_parse, /* parser */ null_post_parser, f_printchar, /* Print character constant */ f_printstr, /* function to print string constant */ @@ -713,6 +712,13 @@ public: return cp_lookup_symbol_nonlocal (this, name, block, domain); } + /* See language.h. */ + + int parser (struct parser_state *ps) const override + { + return f_parse (ps); + } + protected: /* See language.h. */ diff --git a/gdb/go-lang.c b/gdb/go-lang.c index 7da9299..f2553bb 100644 --- a/gdb/go-lang.c +++ b/gdb/go-lang.c @@ -527,7 +527,6 @@ extern const struct language_data go_language_data = macro_expansion_no, NULL, &exp_descriptor_c, - go_parse, null_post_parser, c_printchar, /* Print a character constant. */ c_printstr, /* Function to print string constant. */ @@ -638,6 +637,13 @@ public: { return go_value_print_inner (val, stream, recurse, options); } + + /* See language.h. */ + + int parser (struct parser_state *ps) const override + { + return go_parse (ps); + } }; /* Single instance of the Go language class. */ diff --git a/gdb/language.c b/gdb/language.c index 0cbc7f0..828d21d 100644 --- a/gdb/language.c +++ b/gdb/language.c @@ -47,8 +47,6 @@ #include <algorithm> #include "gdbarch.h" -static int unk_lang_parser (struct parser_state *); - static void set_range_case (void); static void unk_lang_emit_char (int c, struct type *type, @@ -643,6 +641,14 @@ language_defn::value_print (struct value *val, struct ui_file *stream, /* See language.h. */ +int +language_defn::parser (struct parser_state *ps) const +{ + return c_parse (ps); +} + +/* See language.h. */ + void language_defn::value_print_inner (struct value *val, struct ui_file *stream, int recurse, @@ -718,12 +724,6 @@ default_is_string_type_p (struct type *type) /* Define the language that is no language. */ -static int -unk_lang_parser (struct parser_state *ps) -{ - return 1; -} - static void unk_lang_emit_char (int c, struct type *type, struct ui_file *stream, int quoter) @@ -777,7 +777,6 @@ extern const struct language_data unknown_language_data = macro_expansion_no, NULL, &exp_descriptor_standard, - unk_lang_parser, null_post_parser, unk_lang_printchar, /* Print character constant */ unk_lang_printstr, @@ -842,6 +841,14 @@ public: { error (_("unimplemented unknown_language::value_print_inner called")); } + + /* See language.h. */ + + int parser (struct parser_state *ps) const override + { + /* No parsing is done, just claim success. */ + return 1; + } }; /* Single instance of the unknown language class. */ @@ -861,7 +868,6 @@ extern const struct language_data auto_language_data = macro_expansion_no, NULL, &exp_descriptor_standard, - unk_lang_parser, null_post_parser, unk_lang_printchar, /* Print character constant */ unk_lang_printstr, @@ -926,6 +932,14 @@ public: { error (_("unimplemented auto_language::value_print_inner called")); } + + /* See language.h. */ + + int parser (struct parser_state *ps) const override + { + /* No parsing is done, just claim success. */ + return 1; + } }; /* Single instance of the fake "auto" language. */ diff --git a/gdb/language.h b/gdb/language.h index 2149487..7434d74 100644 --- a/gdb/language.h +++ b/gdb/language.h @@ -225,10 +225,6 @@ struct language_data const struct exp_descriptor *la_exp_desc; - /* Parser function. */ - - int (*la_parser) (struct parser_state *); - /* Given an expression *EXPP created by prefixifying the result of la_parser, perform any remaining processing necessary to complete its translation. *EXPP may change; la_post_parser is responsible @@ -540,6 +536,10 @@ struct language_defn : language_data (struct value *val, struct ui_file *stream, int recurse, const struct value_print_options *options) const; + /* Parser function. */ + + virtual int parser (struct parser_state *ps) const; + protected: /* This is the overridable part of the GET_SYMBOL_NAME_MATCHER method. diff --git a/gdb/m2-lang.c b/gdb/m2-lang.c index 356ed4c..189f513 100644 --- a/gdb/m2-lang.c +++ b/gdb/m2-lang.c @@ -362,7 +362,6 @@ extern const struct language_data m2_language_data = macro_expansion_no, NULL, &exp_descriptor_modula2, - m2_parse, /* parser */ null_post_parser, m2_printchar, /* Print character constant */ m2_printstr, /* function to print string constant */ @@ -430,6 +429,13 @@ public: { return m2_value_print_inner (val, stream, recurse, options); } + + /* See language.h. */ + + int parser (struct parser_state *ps) const override + { + return m2_parse (ps); + } }; /* Single instance of the M2 language. */ diff --git a/gdb/objc-lang.c b/gdb/objc-lang.c index 1e4862f..90804ac 100644 --- a/gdb/objc-lang.c +++ b/gdb/objc-lang.c @@ -337,7 +337,6 @@ extern const struct language_data objc_language_data = macro_expansion_c, objc_extensions, &exp_descriptor_standard, - c_parse, null_post_parser, c_printchar, /* Print a character constant */ c_printstr, /* Function to print string constant */ diff --git a/gdb/opencl-lang.c b/gdb/opencl-lang.c index 2a83f51..7c99658 100644 --- a/gdb/opencl-lang.c +++ b/gdb/opencl-lang.c @@ -1016,7 +1016,6 @@ extern const struct language_data opencl_language_data = macro_expansion_c, NULL, &exp_descriptor_opencl, - c_parse, null_post_parser, c_printchar, /* Print a character constant */ c_printstr, /* Function to print string constant */ diff --git a/gdb/p-lang.c b/gdb/p-lang.c index 5c1b273..ce812d1 100644 --- a/gdb/p-lang.c +++ b/gdb/p-lang.c @@ -393,7 +393,6 @@ extern const struct language_data pascal_language_data = macro_expansion_no, p_extensions, &exp_descriptor_standard, - pascal_parse, null_post_parser, pascal_printchar, /* Print a character constant */ pascal_printstr, /* Function to print string constant */ @@ -492,6 +491,13 @@ public: { return pascal_value_print_inner (val, stream, recurse, options); } + + /* See language.h. */ + + int parser (struct parser_state *ps) const override + { + return pascal_parse (ps); + } }; /* Single instance of the Pascal language class. */ diff --git a/gdb/parse.c b/gdb/parse.c index d5efe4a..f003a30 100644 --- a/gdb/parse.c +++ b/gdb/parse.c @@ -1119,7 +1119,7 @@ parse_exp_in_context (const char **stringptr, CORE_ADDR pc, try { - lang->la_parser (&ps); + lang->parser (&ps); } catch (const gdb_exception &except) { diff --git a/gdb/rust-lang.c b/gdb/rust-lang.c index d251dab..2153323 100644 --- a/gdb/rust-lang.c +++ b/gdb/rust-lang.c @@ -1989,7 +1989,6 @@ extern const struct language_data rust_language_data = macro_expansion_no, rust_extensions, &exp_descriptor_rust, - rust_parse, null_post_parser, rust_printchar, /* Print a character constant */ rust_printstr, /* Function to print string constant */ @@ -2142,6 +2141,13 @@ public: } return result; } + + /* See language.h. */ + + int parser (struct parser_state *ps) const override + { + return rust_parse (ps); + } }; /* Single instance of the Rust language class. */ |