From 85967615df75e299b375223cc5d211ef78fcf3e8 Mon Sep 17 00:00:00 2001 From: Andrew Burgess Date: Fri, 3 Jul 2020 18:51:34 +0100 Subject: [PATCH] gdb: Move la_language into the language_defn class Move the language_data::la_language member variable into the langage_defn class. I have not made the la_language member variable a method of langage_defn simply because of the large number of places that la_language is referenced throughout GDB. I have made the new member variable constant though, so this should prevent accidental assignment. In the future we might consider converting la_language to a method, but right now my goal is to remove the langage_data class, so I'm happy to leave la_language as a constant member variable. There should be no user visible changes after this commit. gdb/ChangeLog: * ada-lang.c (ada_language_data): Remove la_language 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 la_language field. (language_defn::language_defn): Initialise la_language field. (language_defn::la_language): New member variable. * m2-lang.c (m2_language_data): Remove la_language field. * 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. --- gdb/ChangeLog | 21 +++++++++++++++++++++ gdb/ada-lang.c | 1 - gdb/c-lang.c | 4 ---- gdb/d-lang.c | 1 - gdb/f-lang.c | 1 - gdb/go-lang.c | 1 - gdb/language.c | 2 -- gdb/language.h | 11 ++++++----- gdb/m2-lang.c | 1 - gdb/objc-lang.c | 1 - gdb/opencl-lang.c | 1 - gdb/p-lang.c | 1 - gdb/rust-lang.c | 1 - 13 files changed, 27 insertions(+), 20 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 82a621de60e..dfdd18f6101 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,24 @@ +2020-09-16 Andrew Burgess + + * ada-lang.c (ada_language_data): Remove la_language 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 la_language field. + (language_defn::language_defn): Initialise la_language field. + (language_defn::la_language): New member variable. + * m2-lang.c (m2_language_data): Remove la_language field. + * 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 * ada-lang.c (ada_extensions): Delete, moved into diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c index b9cd9a3cdcb..b1127d84217 100644 --- a/gdb/ada-lang.c +++ b/gdb/ada-lang.c @@ -13708,7 +13708,6 @@ ada_get_symbol_name_matcher (const lookup_name_info &lookup_name) extern const struct language_data ada_language_data = { - language_ada, range_check_off, case_sensitive_on, /* Yes, Ada is case-insensitive, but that's not quite what this means. */ diff --git a/gdb/c-lang.c b/gdb/c-lang.c index ce4620a136c..d8d66c24103 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 = { - language_c, range_check_off, case_sensitive_on, array_row_major, @@ -984,7 +983,6 @@ enum cplus_primitive_types { extern const struct language_data cplus_language_data = { - language_cplus, range_check_off, case_sensitive_on, array_row_major, @@ -1196,7 +1194,6 @@ static cplus_language cplus_language_defn; extern const struct language_data asm_language_data = { - language_asm, range_check_off, case_sensitive_on, array_row_major, @@ -1266,7 +1263,6 @@ static asm_language asm_language_defn; extern const struct language_data minimal_language_data = { - language_minimal, range_check_off, case_sensitive_on, array_row_major, diff --git a/gdb/d-lang.c b/gdb/d-lang.c index 2c0ea3865cd..18f785fd58d 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 = { - language_d, range_check_off, case_sensitive_on, array_row_major, diff --git a/gdb/f-lang.c b/gdb/f-lang.c index 2c4d5231c62..55d0a7a00de 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 = { - language_fortran, range_check_on, case_sensitive_off, array_column_major, diff --git a/gdb/go-lang.c b/gdb/go-lang.c index 13fa0edb9a1..ed7fcd1f425 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 = { - language_go, range_check_off, case_sensitive_on, array_row_major, diff --git a/gdb/language.c b/gdb/language.c index cc4076253a5..55e8104132b 100644 --- a/gdb/language.c +++ b/gdb/language.c @@ -775,7 +775,6 @@ unknown_language_arch_info (struct gdbarch *gdbarch, extern const struct language_data unknown_language_data = { - language_unknown, range_check_off, case_sensitive_on, array_row_major, @@ -911,7 +910,6 @@ static unknown_language unknown_language_defn; extern const struct language_data auto_language_data = { - language_auto, range_check_off, case_sensitive_on, array_row_major, diff --git a/gdb/language.h b/gdb/language.h index 9a7ad214d88..731b641d261 100644 --- a/gdb/language.h +++ b/gdb/language.h @@ -188,10 +188,6 @@ extern const char *default_word_break_characters (void); struct language_data { - /* its symtab language-enum (defs.h). */ - - enum language la_language; - /* Default range checking. */ enum range_check la_range_check; @@ -253,13 +249,18 @@ struct language_data struct language_defn : language_data { language_defn (enum language lang, const language_data &init_data) - : language_data (init_data) + : language_data (init_data), + la_language (lang) { /* We should only ever create one instance of each language. */ gdb_assert (languages[lang] == nullptr); languages[lang] = this; } + /* Which language this is. */ + + const enum language la_language; + /* Name of the language. */ virtual const char *name () const = 0; diff --git a/gdb/m2-lang.c b/gdb/m2-lang.c index ef415381169..94340b0d9b2 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 = { - language_m2, range_check_on, case_sensitive_on, array_row_major, diff --git a/gdb/objc-lang.c b/gdb/objc-lang.c index ff9735e59d9..f605c2194b0 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 = { - language_objc, range_check_off, case_sensitive_on, array_row_major, diff --git a/gdb/opencl-lang.c b/gdb/opencl-lang.c index a8d48577752..2c8dba013fe 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 = { - language_opencl, range_check_off, case_sensitive_on, array_row_major, diff --git a/gdb/p-lang.c b/gdb/p-lang.c index da48a52a9ab..aef908c7dc6 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 = { - language_pascal, range_check_on, case_sensitive_on, array_row_major, diff --git a/gdb/rust-lang.c b/gdb/rust-lang.c index a7b58351839..2ceb573da2b 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 = { - language_rust, range_check_on, case_sensitive_on, array_row_major, -- 2.30.2