diff options
author | Andrew Burgess <andrew.burgess@embecosm.com> | 2020-07-12 15:09:52 +0100 |
---|---|---|
committer | Andrew Burgess <andrew.burgess@embecosm.com> | 2020-09-16 11:04:03 +0100 |
commit | 0d201fa46059ddd27980ccf8cca8488ac98b89be (patch) | |
tree | 3bbb11e9ef64b1a8a6781aed8f094a8f07286a9f | |
parent | efdf6a733d2a59a1a07ec61e848fa9e128259fe3 (diff) | |
download | binutils-0d201fa46059ddd27980ccf8cca8488ac98b89be.zip binutils-0d201fa46059ddd27980ccf8cca8488ac98b89be.tar.gz binutils-0d201fa46059ddd27980ccf8cca8488ac98b89be.tar.bz2 |
gdb: Convert language_data::la_case_sensitivity to a method
Convert language_data::la_case_sensitivity member variable to a virtual
method language_defn::case_sensitivity.
This is mostly straight forward. The only slight problem is that I
ended up deleting this comment from ada-lang.c:
/* Yes, Ada is case-insensitive, but that's not quite what this
means. */
However, as the comment (which has existed since Ada support was first
added to GDB) doesn't explain _why_ Ada sets case sensitivity to on
despite being a generally case insensitive language, this doesn't
really help me much.
If I understood _why_ the setting doesn't quite mean what it seems to
mean (at least as far as Ada is concerned) then I would extend the
comment on language_defn::case_sensitivity (in language.h) to include
the detail, and note how this impacts Ada. But as it stands I've just
deleted the comment for now.
There should be no user visible changes after this commit.
gdb/ChangeLog:
* ada-lang.c (ada_language_data): Remove la_case_sensitivity
initializer.
* c-lang.c (c_language_data): Likewise.
(cplus_language_data): Likewise.
(asm_language_data): Likewise.
(minimal_language_data): Likewise.
* d-lang.c (d_language_data): Likewise.
* f-lang.c (f_language_data): Likewise.
(f_language::case_sensitivity): New member function.
* go-lang.c (go_language_data): Remove la_case_sensitivity
initializer.
* language.c (enum case_mode): Moved here from language.h.
(case_mode): Make static.
(show_case_command): Update for case_sensitivity being a method.
(set_case_command): Likewise.
(set_range_case): Likewise.
(unknown_language_data): Remove la_case_sensitivity initializer.
(auto_language_data): Likewise.
* language.h (case_mode): Delete, move enum declaration to
language.c.
(language_data): Delete la_case_sensitivity field.
(language_defn::case_sensitivity): New member function.
* m2-lang.c (m2_language_data): Remove la_case_sensitivity
initializer.
* objc-lang.c (objc_language_data): Likewise.
* opencl-lang.c (opencl_language_data): Likewise.
* p-lang.c (pascal_language_data): Likewise.
* rust-lang.c (rust_language_data): Likewise.
-rw-r--r-- | gdb/ChangeLog | 31 | ||||
-rw-r--r-- | gdb/ada-lang.c | 2 | ||||
-rw-r--r-- | gdb/c-lang.c | 4 | ||||
-rw-r--r-- | gdb/d-lang.c | 1 | ||||
-rw-r--r-- | gdb/f-lang.c | 6 | ||||
-rw-r--r-- | gdb/go-lang.c | 1 | ||||
-rw-r--r-- | gdb/language.c | 19 | ||||
-rw-r--r-- | gdb/language.h | 20 | ||||
-rw-r--r-- | gdb/m2-lang.c | 1 | ||||
-rw-r--r-- | gdb/objc-lang.c | 1 | ||||
-rw-r--r-- | gdb/opencl-lang.c | 1 | ||||
-rw-r--r-- | gdb/p-lang.c | 1 | ||||
-rw-r--r-- | gdb/rust-lang.c | 1 |
13 files changed, 56 insertions, 33 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index b46e89c..134010d 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,5 +1,36 @@ 2020-09-16 Andrew Burgess <andrew.burgess@embecosm.com> + * ada-lang.c (ada_language_data): Remove la_case_sensitivity + initializer. + * c-lang.c (c_language_data): Likewise. + (cplus_language_data): Likewise. + (asm_language_data): Likewise. + (minimal_language_data): Likewise. + * d-lang.c (d_language_data): Likewise. + * f-lang.c (f_language_data): Likewise. + (f_language::case_sensitivity): New member function. + * go-lang.c (go_language_data): Remove la_case_sensitivity + initializer. + * language.c (enum case_mode): Moved here from language.h. + (case_mode): Make static. + (show_case_command): Update for case_sensitivity being a method. + (set_case_command): Likewise. + (set_range_case): Likewise. + (unknown_language_data): Remove la_case_sensitivity initializer. + (auto_language_data): Likewise. + * language.h (case_mode): Delete, move enum declaration to + language.c. + (language_data): Delete la_case_sensitivity field. + (language_defn::case_sensitivity): New member function. + * m2-lang.c (m2_language_data): Remove la_case_sensitivity + initializer. + * objc-lang.c (objc_language_data): Likewise. + * opencl-lang.c (opencl_language_data): Likewise. + * p-lang.c (pascal_language_data): Likewise. + * rust-lang.c (rust_language_data): Likewise. + +2020-09-16 Andrew Burgess <andrew.burgess@embecosm.com> + * ada-lang.c (ada_language_data): Remove la_range_check initializer. * c-lang.c (c_language_data): Likewise. diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c index 0a0dc21..bb850c1 100644 --- a/gdb/ada-lang.c +++ b/gdb/ada-lang.c @@ -13708,8 +13708,6 @@ ada_get_symbol_name_matcher (const lookup_name_info &lookup_name) extern const struct language_data ada_language_data = { - case_sensitive_on, /* Yes, Ada is case-insensitive, but - that's not quite what this means. */ array_row_major, macro_expansion_no, &ada_exp_descriptor, diff --git a/gdb/c-lang.c b/gdb/c-lang.c index 88af458..c1aa02f 100644 --- a/gdb/c-lang.c +++ b/gdb/c-lang.c @@ -875,7 +875,6 @@ const struct exp_descriptor exp_descriptor_c = extern const struct language_data c_language_data = { - case_sensitive_on, array_row_major, macro_expansion_c, &exp_descriptor_c, @@ -984,7 +983,6 @@ enum cplus_primitive_types { extern const struct language_data cplus_language_data = { - case_sensitive_on, array_row_major, macro_expansion_c, &exp_descriptor_c, @@ -1191,7 +1189,6 @@ static cplus_language cplus_language_defn; extern const struct language_data asm_language_data = { - case_sensitive_on, array_row_major, macro_expansion_c, &exp_descriptor_c, @@ -1261,7 +1258,6 @@ static asm_language asm_language_defn; extern const struct language_data minimal_language_data = { - case_sensitive_on, array_row_major, macro_expansion_c, &exp_descriptor_c, diff --git a/gdb/d-lang.c b/gdb/d-lang.c index 4cbe9d8..176593f 100644 --- a/gdb/d-lang.c +++ b/gdb/d-lang.c @@ -128,7 +128,6 @@ enum d_primitive_types { extern const struct language_data d_language_data = { - case_sensitive_on, array_row_major, macro_expansion_no, &exp_descriptor_c, diff --git a/gdb/f-lang.c b/gdb/f-lang.c index dc5c085..a938d2b 100644 --- a/gdb/f-lang.c +++ b/gdb/f-lang.c @@ -486,7 +486,6 @@ static const struct exp_descriptor exp_descriptor_f = extern const struct language_data f_language_data = { - case_sensitive_off, array_column_major, macro_expansion_no, &exp_descriptor_f, @@ -726,6 +725,11 @@ public: bool range_checking_on_by_default () const override { return true; } + /* See language.h. */ + + enum case_sensitivity case_sensitivity () const override + { return case_sensitive_off; } + protected: /* See language.h. */ diff --git a/gdb/go-lang.c b/gdb/go-lang.c index f5abd51..7ac7e94 100644 --- a/gdb/go-lang.c +++ b/gdb/go-lang.c @@ -508,7 +508,6 @@ enum go_primitive_types { extern const struct language_data go_language_data = { - case_sensitive_on, array_row_major, macro_expansion_no, &exp_descriptor_c, diff --git a/gdb/language.c b/gdb/language.c index 56b3b2e..41fdf35 100644 --- a/gdb/language.c +++ b/gdb/language.c @@ -58,6 +58,15 @@ enum range_mode range_mode_auto, range_mode_manual }; +/* case_mode == + case_mode_auto: case_sensitivity set upon selection of scope. + case_mode_manual: case_sensitivity set only by user. */ + +enum case_mode + { + case_mode_auto, case_mode_manual + }; + /* The current (default at startup) state of type and range checking. (If the modes are set to "auto", though, these are changed based on the default language at startup, and then again based on the @@ -65,7 +74,7 @@ enum range_mode static enum range_mode range_mode = range_mode_auto; enum range_check range_check = range_check_off; -enum case_mode case_mode = case_mode_auto; +static enum case_mode case_mode = case_mode_auto; enum case_sensitivity case_sensitivity = case_sensitive_on; /* The current language and language_mode (see language.h). */ @@ -296,7 +305,7 @@ show_case_command (struct ui_file *file, int from_tty, _("Case sensitivity in name search is \"%s\".\n"), value); - if (case_sensitivity != current_language->la_case_sensitivity) + if (case_sensitivity != current_language->case_sensitivity ()) warning (_("the current case sensitivity setting does not match " "the language.\n")); } @@ -329,7 +338,7 @@ set_case_command (const char *ignore, int from_tty, struct cmd_list_element *c) case_sensitive); } - if (case_sensitivity != current_language->la_case_sensitivity) + if (case_sensitivity != current_language->case_sensitivity ()) warning (_("the current case sensitivity setting does not match " "the language.\n")); } @@ -346,7 +355,7 @@ set_range_case (void) ? range_check_on : range_check_off); if (case_mode == case_mode_auto) - case_sensitivity = current_language->la_case_sensitivity; + case_sensitivity = current_language->case_sensitivity (); } /* Set current language to (enum language) LANG. Returns previous @@ -789,7 +798,6 @@ unknown_language_arch_info (struct gdbarch *gdbarch, extern const struct language_data unknown_language_data = { - case_sensitive_on, array_row_major, macro_expansion_no, &exp_descriptor_standard, @@ -925,7 +933,6 @@ static unknown_language unknown_language_defn; extern const struct language_data auto_language_data = { - case_sensitive_on, array_row_major, macro_expansion_no, &exp_descriptor_standard, diff --git a/gdb/language.h b/gdb/language.h index ffdcdbc..b6d1d15 100644 --- a/gdb/language.h +++ b/gdb/language.h @@ -53,16 +53,6 @@ extern enum range_check } range_check; -/* case_mode == - case_mode_auto: case_sensitivity set upon selection of scope. - case_mode_manual: case_sensitivity set only by user. */ - -extern enum case_mode - { - case_mode_auto, case_mode_manual - } -case_mode; - /* array_ordering == array_row_major: Arrays are in row major order. array_column_major: Arrays are in column major order. */ @@ -178,9 +168,6 @@ extern const char *default_word_break_characters (void); struct language_data { - /* Default case sensitivity. */ - enum case_sensitivity la_case_sensitivity; - /* Multi-dimensional array ordering. */ enum array_ordering la_array_ordering; @@ -565,6 +552,13 @@ struct language_defn : language_data virtual bool range_checking_on_by_default () const { return false; } + /* Is this language case sensitive? The return value from this function + provides the automativ setting for 'set case-sensitive', as a + consequence, a user is free to override this setting if they want. */ + + virtual enum case_sensitivity case_sensitivity () const + { return case_sensitive_on; } + 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 785436c..94fa012 100644 --- a/gdb/m2-lang.c +++ b/gdb/m2-lang.c @@ -199,7 +199,6 @@ const struct exp_descriptor exp_descriptor_modula2 = extern const struct language_data m2_language_data = { - case_sensitive_on, array_row_major, macro_expansion_no, &exp_descriptor_modula2, diff --git a/gdb/objc-lang.c b/gdb/objc-lang.c index 1788910..45936c9 100644 --- a/gdb/objc-lang.c +++ b/gdb/objc-lang.c @@ -323,7 +323,6 @@ static const struct op_print objc_op_print_tab[] = extern const struct language_data objc_language_data = { - case_sensitive_on, array_row_major, macro_expansion_c, &exp_descriptor_standard, diff --git a/gdb/opencl-lang.c b/gdb/opencl-lang.c index 2ad9321..2a184fd 100644 --- a/gdb/opencl-lang.c +++ b/gdb/opencl-lang.c @@ -1006,7 +1006,6 @@ const struct exp_descriptor exp_descriptor_opencl = /* Constant data representing the OpenCL language. */ extern const struct language_data opencl_language_data = { - case_sensitive_on, array_row_major, macro_expansion_c, &exp_descriptor_opencl, diff --git a/gdb/p-lang.c b/gdb/p-lang.c index 2325aca..fcc0eb9 100644 --- a/gdb/p-lang.c +++ b/gdb/p-lang.c @@ -252,7 +252,6 @@ enum pascal_primitive_types { extern const struct language_data pascal_language_data = { - case_sensitive_on, array_row_major, macro_expansion_no, &exp_descriptor_standard, diff --git a/gdb/rust-lang.c b/gdb/rust-lang.c index 4489cab..7b76e27 100644 --- a/gdb/rust-lang.c +++ b/gdb/rust-lang.c @@ -1901,7 +1901,6 @@ static const struct exp_descriptor exp_descriptor_rust = extern const struct language_data rust_language_data = { - case_sensitive_on, array_row_major, macro_expansion_no, &exp_descriptor_rust, |