GNU Binutils with patches for OS216
Revisão | 87afa6523b01cd6bdcc3903fe22953966cec7bb7 (tree) |
---|---|
Hora | 2020-06-23 21:34:10 |
Autor | Andrew Burgess <andrew.burgess@embe...> |
Commiter | Andrew Burgess |
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.
@@ -1,5 +1,39 @@ | ||
1 | 1 | 2020-06-23 Andrew Burgess <andrew.burgess@embecosm.com> |
2 | 2 | |
3 | + * ada-lang.c (parse): Rename to ada_language::parser. | |
4 | + (ada_language_data): Delete la_parser initializer. | |
5 | + (ada_language::parser): New member function, implementation from | |
6 | + parse. | |
7 | + * c-lang.c (c_language_data): Delete la_parser initializer. | |
8 | + (cplus_language_data): Likewise. | |
9 | + (asm_language_data): Likewise. | |
10 | + (minimal_language_data): Likewise. | |
11 | + * d-lang.c (d_language_data): Likewise. | |
12 | + (d_language::parser): New member function. | |
13 | + * f-lang.c (f_language_data): Delete la_parser initializer. | |
14 | + (f_language::parser): New member function. | |
15 | + * go-lang.c (go_language_data): Delete la_parser initializer. | |
16 | + (go_language::parser): New member function. | |
17 | + * language.c (unk_lang_parser): Delete. | |
18 | + (language_defn::parser): Define new member function. | |
19 | + (unknown_language_data): Delete la_parser initializer. | |
20 | + (unknown_language::parser): New member function. | |
21 | + (auto_language_data): Delete la_parser initializer. | |
22 | + (auto_language::parser): New member function. | |
23 | + * language.h (language_data): Delete la_parser field. | |
24 | + (language_defn::parser): Declare new member function. | |
25 | + * m2-lang.c (m2_language_data): Delete la_parser initializer. | |
26 | + (m2_language::parser): New member function. | |
27 | + * objc-lang.c (objc_language_data): Delete la_parser initializer. | |
28 | + * opencl-lang.c (opencl_language_data): Likewise. | |
29 | + * p-lang.c (pascal_language_data): Likewise. | |
30 | + (pascal_language::parser): New member function. | |
31 | + * parse.c (parse_exp_in_context): Update call to parser. | |
32 | + * rust-lang.c (rust_language_data): Delete la_parser initializer. | |
33 | + (rust_language::parser): New member function. | |
34 | + | |
35 | +2020-06-23 Andrew Burgess <andrew.burgess@embecosm.com> | |
36 | + | |
3 | 37 | * top.c (print_gdb_configuration): Print --with-python-libdir |
4 | 38 | configuration value. |
5 | 39 |
@@ -13534,13 +13534,6 @@ emit_char (int c, struct type *type, struct ui_file *stream, int quoter) | ||
13534 | 13534 | ada_emit_char (c, type, stream, quoter, 1); |
13535 | 13535 | } |
13536 | 13536 | |
13537 | -static int | |
13538 | -parse (struct parser_state *ps) | |
13539 | -{ | |
13540 | - warnings_issued = 0; | |
13541 | - return ada_parse (ps); | |
13542 | -} | |
13543 | - | |
13544 | 13537 | static const struct exp_descriptor ada_exp_descriptor = { |
13545 | 13538 | ada_print_subexp, |
13546 | 13539 | ada_operator_length, |
@@ -13718,7 +13711,6 @@ extern const struct language_data ada_language_data = | ||
13718 | 13711 | macro_expansion_no, |
13719 | 13712 | ada_extensions, |
13720 | 13713 | &ada_exp_descriptor, |
13721 | - parse, | |
13722 | 13714 | resolve, |
13723 | 13715 | ada_printchar, /* Print a character constant */ |
13724 | 13716 | ada_printstr, /* Function to print string constant */ |
@@ -14116,6 +14108,14 @@ public: | ||
14116 | 14108 | return {}; |
14117 | 14109 | } |
14118 | 14110 | |
14111 | + /* See language.h. */ | |
14112 | + | |
14113 | + int parser (struct parser_state *ps) const override | |
14114 | + { | |
14115 | + warnings_issued = 0; | |
14116 | + return ada_parse (ps); | |
14117 | + } | |
14118 | + | |
14119 | 14119 | protected: |
14120 | 14120 | /* See language.h. */ |
14121 | 14121 |
@@ -889,7 +889,6 @@ extern const struct language_data c_language_data = | ||
889 | 889 | macro_expansion_c, |
890 | 890 | c_extensions, |
891 | 891 | &exp_descriptor_c, |
892 | - c_parse, | |
893 | 892 | null_post_parser, |
894 | 893 | c_printchar, /* Print a character constant */ |
895 | 894 | c_printstr, /* Function to print string constant */ |
@@ -997,7 +996,6 @@ extern const struct language_data cplus_language_data = | ||
997 | 996 | macro_expansion_c, |
998 | 997 | cplus_extensions, |
999 | 998 | &exp_descriptor_c, |
1000 | - c_parse, | |
1001 | 999 | null_post_parser, |
1002 | 1000 | c_printchar, /* Print a character constant */ |
1003 | 1001 | c_printstr, /* Function to print string constant */ |
@@ -1202,7 +1200,6 @@ extern const struct language_data asm_language_data = | ||
1202 | 1200 | macro_expansion_c, |
1203 | 1201 | asm_extensions, |
1204 | 1202 | &exp_descriptor_c, |
1205 | - c_parse, | |
1206 | 1203 | null_post_parser, |
1207 | 1204 | c_printchar, /* Print a character constant */ |
1208 | 1205 | c_printstr, /* Function to print string constant */ |
@@ -1265,7 +1262,6 @@ extern const struct language_data minimal_language_data = | ||
1265 | 1262 | macro_expansion_c, |
1266 | 1263 | NULL, |
1267 | 1264 | &exp_descriptor_c, |
1268 | - c_parse, | |
1269 | 1265 | null_post_parser, |
1270 | 1266 | c_printchar, /* Print a character constant */ |
1271 | 1267 | c_printstr, /* Function to print string constant */ |
@@ -142,7 +142,6 @@ extern const struct language_data d_language_data = | ||
142 | 142 | macro_expansion_no, |
143 | 143 | d_extensions, |
144 | 144 | &exp_descriptor_c, |
145 | - d_parse, | |
146 | 145 | null_post_parser, |
147 | 146 | c_printchar, /* Print a character constant. */ |
148 | 147 | c_printstr, /* Function to print string constant. */ |
@@ -273,6 +272,13 @@ public: | ||
273 | 272 | { |
274 | 273 | return d_lookup_symbol_nonlocal (this, name, block, domain); |
275 | 274 | } |
275 | + | |
276 | + /* See language.h. */ | |
277 | + | |
278 | + int parser (struct parser_state *ps) const override | |
279 | + { | |
280 | + return d_parse (ps); | |
281 | + } | |
276 | 282 | }; |
277 | 283 | |
278 | 284 | /* Single instance of the D language class. */ |
@@ -564,7 +564,6 @@ extern const struct language_data f_language_data = | ||
564 | 564 | macro_expansion_no, |
565 | 565 | f_extensions, |
566 | 566 | &exp_descriptor_f, |
567 | - f_parse, /* parser */ | |
568 | 567 | null_post_parser, |
569 | 568 | f_printchar, /* Print character constant */ |
570 | 569 | f_printstr, /* function to print string constant */ |
@@ -713,6 +712,13 @@ public: | ||
713 | 712 | return cp_lookup_symbol_nonlocal (this, name, block, domain); |
714 | 713 | } |
715 | 714 | |
715 | + /* See language.h. */ | |
716 | + | |
717 | + int parser (struct parser_state *ps) const override | |
718 | + { | |
719 | + return f_parse (ps); | |
720 | + } | |
721 | + | |
716 | 722 | protected: |
717 | 723 | |
718 | 724 | /* See language.h. */ |
@@ -527,7 +527,6 @@ extern const struct language_data go_language_data = | ||
527 | 527 | macro_expansion_no, |
528 | 528 | NULL, |
529 | 529 | &exp_descriptor_c, |
530 | - go_parse, | |
531 | 530 | null_post_parser, |
532 | 531 | c_printchar, /* Print a character constant. */ |
533 | 532 | c_printstr, /* Function to print string constant. */ |
@@ -638,6 +637,13 @@ public: | ||
638 | 637 | { |
639 | 638 | return go_value_print_inner (val, stream, recurse, options); |
640 | 639 | } |
640 | + | |
641 | + /* See language.h. */ | |
642 | + | |
643 | + int parser (struct parser_state *ps) const override | |
644 | + { | |
645 | + return go_parse (ps); | |
646 | + } | |
641 | 647 | }; |
642 | 648 | |
643 | 649 | /* Single instance of the Go language class. */ |
@@ -47,8 +47,6 @@ | ||
47 | 47 | #include <algorithm> |
48 | 48 | #include "gdbarch.h" |
49 | 49 | |
50 | -static int unk_lang_parser (struct parser_state *); | |
51 | - | |
52 | 50 | static void set_range_case (void); |
53 | 51 | |
54 | 52 | 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, | ||
643 | 641 | |
644 | 642 | /* See language.h. */ |
645 | 643 | |
644 | +int | |
645 | +language_defn::parser (struct parser_state *ps) const | |
646 | +{ | |
647 | + return c_parse (ps); | |
648 | +} | |
649 | + | |
650 | +/* See language.h. */ | |
651 | + | |
646 | 652 | void |
647 | 653 | language_defn::value_print_inner |
648 | 654 | (struct value *val, struct ui_file *stream, int recurse, |
@@ -718,12 +724,6 @@ default_is_string_type_p (struct type *type) | ||
718 | 724 | |
719 | 725 | /* Define the language that is no language. */ |
720 | 726 | |
721 | -static int | |
722 | -unk_lang_parser (struct parser_state *ps) | |
723 | -{ | |
724 | - return 1; | |
725 | -} | |
726 | - | |
727 | 727 | static void |
728 | 728 | unk_lang_emit_char (int c, struct type *type, struct ui_file *stream, |
729 | 729 | int quoter) |
@@ -777,7 +777,6 @@ extern const struct language_data unknown_language_data = | ||
777 | 777 | macro_expansion_no, |
778 | 778 | NULL, |
779 | 779 | &exp_descriptor_standard, |
780 | - unk_lang_parser, | |
781 | 780 | null_post_parser, |
782 | 781 | unk_lang_printchar, /* Print character constant */ |
783 | 782 | unk_lang_printstr, |
@@ -842,6 +841,14 @@ public: | ||
842 | 841 | { |
843 | 842 | error (_("unimplemented unknown_language::value_print_inner called")); |
844 | 843 | } |
844 | + | |
845 | + /* See language.h. */ | |
846 | + | |
847 | + int parser (struct parser_state *ps) const override | |
848 | + { | |
849 | + /* No parsing is done, just claim success. */ | |
850 | + return 1; | |
851 | + } | |
845 | 852 | }; |
846 | 853 | |
847 | 854 | /* Single instance of the unknown language class. */ |
@@ -861,7 +868,6 @@ extern const struct language_data auto_language_data = | ||
861 | 868 | macro_expansion_no, |
862 | 869 | NULL, |
863 | 870 | &exp_descriptor_standard, |
864 | - unk_lang_parser, | |
865 | 871 | null_post_parser, |
866 | 872 | unk_lang_printchar, /* Print character constant */ |
867 | 873 | unk_lang_printstr, |
@@ -926,6 +932,14 @@ public: | ||
926 | 932 | { |
927 | 933 | error (_("unimplemented auto_language::value_print_inner called")); |
928 | 934 | } |
935 | + | |
936 | + /* See language.h. */ | |
937 | + | |
938 | + int parser (struct parser_state *ps) const override | |
939 | + { | |
940 | + /* No parsing is done, just claim success. */ | |
941 | + return 1; | |
942 | + } | |
929 | 943 | }; |
930 | 944 | |
931 | 945 | /* Single instance of the fake "auto" language. */ |
@@ -225,10 +225,6 @@ struct language_data | ||
225 | 225 | |
226 | 226 | const struct exp_descriptor *la_exp_desc; |
227 | 227 | |
228 | - /* Parser function. */ | |
229 | - | |
230 | - int (*la_parser) (struct parser_state *); | |
231 | - | |
232 | 228 | /* Given an expression *EXPP created by prefixifying the result of |
233 | 229 | la_parser, perform any remaining processing necessary to complete |
234 | 230 | its translation. *EXPP may change; la_post_parser is responsible |
@@ -540,6 +536,10 @@ struct language_defn : language_data | ||
540 | 536 | (struct value *val, struct ui_file *stream, int recurse, |
541 | 537 | const struct value_print_options *options) const; |
542 | 538 | |
539 | + /* Parser function. */ | |
540 | + | |
541 | + virtual int parser (struct parser_state *ps) const; | |
542 | + | |
543 | 543 | protected: |
544 | 544 | |
545 | 545 | /* This is the overridable part of the GET_SYMBOL_NAME_MATCHER method. |
@@ -362,7 +362,6 @@ extern const struct language_data m2_language_data = | ||
362 | 362 | macro_expansion_no, |
363 | 363 | NULL, |
364 | 364 | &exp_descriptor_modula2, |
365 | - m2_parse, /* parser */ | |
366 | 365 | null_post_parser, |
367 | 366 | m2_printchar, /* Print character constant */ |
368 | 367 | m2_printstr, /* function to print string constant */ |
@@ -430,6 +429,13 @@ public: | ||
430 | 429 | { |
431 | 430 | return m2_value_print_inner (val, stream, recurse, options); |
432 | 431 | } |
432 | + | |
433 | + /* See language.h. */ | |
434 | + | |
435 | + int parser (struct parser_state *ps) const override | |
436 | + { | |
437 | + return m2_parse (ps); | |
438 | + } | |
433 | 439 | }; |
434 | 440 | |
435 | 441 | /* Single instance of the M2 language. */ |
@@ -337,7 +337,6 @@ extern const struct language_data objc_language_data = | ||
337 | 337 | macro_expansion_c, |
338 | 338 | objc_extensions, |
339 | 339 | &exp_descriptor_standard, |
340 | - c_parse, | |
341 | 340 | null_post_parser, |
342 | 341 | c_printchar, /* Print a character constant */ |
343 | 342 | c_printstr, /* Function to print string constant */ |
@@ -1016,7 +1016,6 @@ extern const struct language_data opencl_language_data = | ||
1016 | 1016 | macro_expansion_c, |
1017 | 1017 | NULL, |
1018 | 1018 | &exp_descriptor_opencl, |
1019 | - c_parse, | |
1020 | 1019 | null_post_parser, |
1021 | 1020 | c_printchar, /* Print a character constant */ |
1022 | 1021 | c_printstr, /* Function to print string constant */ |
@@ -393,7 +393,6 @@ extern const struct language_data pascal_language_data = | ||
393 | 393 | macro_expansion_no, |
394 | 394 | p_extensions, |
395 | 395 | &exp_descriptor_standard, |
396 | - pascal_parse, | |
397 | 396 | null_post_parser, |
398 | 397 | pascal_printchar, /* Print a character constant */ |
399 | 398 | pascal_printstr, /* Function to print string constant */ |
@@ -492,6 +491,13 @@ public: | ||
492 | 491 | { |
493 | 492 | return pascal_value_print_inner (val, stream, recurse, options); |
494 | 493 | } |
494 | + | |
495 | + /* See language.h. */ | |
496 | + | |
497 | + int parser (struct parser_state *ps) const override | |
498 | + { | |
499 | + return pascal_parse (ps); | |
500 | + } | |
495 | 501 | }; |
496 | 502 | |
497 | 503 | /* Single instance of the Pascal language class. */ |
@@ -1119,7 +1119,7 @@ parse_exp_in_context (const char **stringptr, CORE_ADDR pc, | ||
1119 | 1119 | |
1120 | 1120 | try |
1121 | 1121 | { |
1122 | - lang->la_parser (&ps); | |
1122 | + lang->parser (&ps); | |
1123 | 1123 | } |
1124 | 1124 | catch (const gdb_exception &except) |
1125 | 1125 | { |
@@ -1989,7 +1989,6 @@ extern const struct language_data rust_language_data = | ||
1989 | 1989 | macro_expansion_no, |
1990 | 1990 | rust_extensions, |
1991 | 1991 | &exp_descriptor_rust, |
1992 | - rust_parse, | |
1993 | 1992 | null_post_parser, |
1994 | 1993 | rust_printchar, /* Print a character constant */ |
1995 | 1994 | rust_printstr, /* Function to print string constant */ |
@@ -2142,6 +2141,13 @@ public: | ||
2142 | 2141 | } |
2143 | 2142 | return result; |
2144 | 2143 | } |
2144 | + | |
2145 | + /* See language.h. */ | |
2146 | + | |
2147 | + int parser (struct parser_state *ps) const override | |
2148 | + { | |
2149 | + return rust_parse (ps); | |
2150 | + } | |
2145 | 2151 | }; |
2146 | 2152 | |
2147 | 2153 | /* Single instance of the Rust language class. */ |