summaryrefslogtreecommitdiff
path: root/gdb/d-lang.c
diff options
context:
space:
mode:
authorAndrew Burgess <andrew.burgess@embecosm.com>2020-07-05 09:29:34 +0100
committerAndrew Burgess <andrew.burgess@embecosm.com>2020-09-16 10:16:48 +0100
commit22c12a6c70a0bf1c292478436f12df0a2d84c2a2 (patch)
treeeb8f23e76fedac0151280623ebe9d055819b34d3 /gdb/d-lang.c
parent1c236ddd45b182b6f4895b276183cdd8382d3e1b (diff)
downloadbinutils-gdb-22c12a6c70a0bf1c292478436f12df0a2d84c2a2.tar.gz
gdb: Convert language_data::string_lower_bound to a method
Convert language_data::string_lower_bound member variable to a virtual method language_defn::string_lower_bound. Over all of the languages we currently support there are currently only two values for the lower bound, 0 or 1. I noticed that in all cases, if a language has C style arrays then the lower bound is 0, otherwise the lower bound is 1. So the default for the virtual method in language.h makes use of this, which means languages don't have to worry about providing a string_lower_bound method at all. Except for Modula2. This language is defined to not have C style arrays, but has a string_lower_bound index of 0, this behaviour is maintained after this commit by having Modula2 be the only language that overrides the string_lower_bound method. There should be no user visible changes after this commit. gdb/ChangeLog: * ada-lang.c (ada_language_data): Remove string_lower_bound 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. * go-lang.c (go_language_data): Likewise. * language.c (unknown_language_data): Likewise. (auto_language_data): Likewise. * language.h (language_data): Remove string_lower_bound field. (language_defn::string_lower_bound): New member function. * m2-lang.c (m2_language_data): Remove string_lower_bound initializer. (m2_language::string_lower_bound): New member function. * objc-lang.c (objc_language_data): Remove string_lower_bound initializer. * opencl-lang.c (opencl_language_data): Likewise. * p-lang.c (pascal_language_data): Likewise. * rust-lang.c (rust_language_data): Likewise. * valops.c (value_cstring): Update call to string_lower_bound. (value_string): Likewise. * value.c (allocate_repeated_value): Likewise.
Diffstat (limited to 'gdb/d-lang.c')
-rw-r--r--gdb/d-lang.c1
1 files changed, 0 insertions, 1 deletions
diff --git a/gdb/d-lang.c b/gdb/d-lang.c
index 67912089989..f75a973fbfb 100644
--- a/gdb/d-lang.c
+++ b/gdb/d-lang.c
@@ -135,7 +135,6 @@ extern const struct language_data d_language_data =
&exp_descriptor_c,
false, /* la_store_sym_names_in_linkage_form_p */
d_op_print_tab, /* Expression operators for printing. */
- 0, /* String lower bound. */
&default_varobj_ops,
};