gdb: Move la_language into the language_defn class
authorAndrew Burgess <andrew.burgess@embecosm.com>
Fri, 3 Jul 2020 17:51:34 +0000 (18:51 +0100)
committerAndrew Burgess <andrew.burgess@embecosm.com>
Wed, 16 Sep 2020 09:16:46 +0000 (10:16 +0100)
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.

13 files changed:
gdb/ChangeLog
gdb/ada-lang.c
gdb/c-lang.c
gdb/d-lang.c
gdb/f-lang.c
gdb/go-lang.c
gdb/language.c
gdb/language.h
gdb/m2-lang.c
gdb/objc-lang.c
gdb/opencl-lang.c
gdb/p-lang.c
gdb/rust-lang.c

index 82a621de60e2a139e5b87f54154ec2d23cc404e9..dfdd18f61010d3299bf5b51b663dd1412ffb54f3 100644 (file)
@@ -1,3 +1,24 @@
+2020-09-16  Andrew Burgess  <andrew.burgess@embecosm.com>
+
+       * 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  <andrew.burgess@embecosm.com>
 
        * ada-lang.c (ada_extensions): Delete, moved into
index b9cd9a3cdcbcd7bdd075c53a8d5d00c8aa773e53..b1127d8421791781b5b0b7639621e4e962884c38 100644 (file)
@@ -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.  */
index ce4620a136cb9ce75b1adb388f5ee6e7327b4d6b..d8d66c241033431ba7a21762dc4013466945bcd0 100644 (file)
@@ -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,
index 2c0ea3865cd95ee4bc3ea27477ddbe1aea027b87..18f785fd58dd472e222e39b0ab20c2ce634f874f 100644 (file)
@@ -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,
index 2c4d5231c62ffd9b18e3c85b68f59c2ff742b9c3..55d0a7a00deb21355a1ca04bf5e3abd7fe03358c 100644 (file)
@@ -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,
index 13fa0edb9a118eb81becc1f1b7627043c880f8f1..ed7fcd1f425b9567f5c41e9036163beb8f8f82c6 100644 (file)
@@ -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,
index cc4076253a5bc396cf7dacc814f2ea433384eb31..55e8104132b1b611b6d4c3745f353b0a4984c432 100644 (file)
@@ -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,
index 9a7ad214d88ee0407734f7d53a7624a0c5ce9c56..731b641d261d7f07b6608e76b28b9c9c3b6759a7 100644 (file)
@@ -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;
index ef4153811698c62cd31d599bda28cd8c982e64e2..94340b0d9b29131e5013772cb92de819aed09ffa 100644 (file)
@@ -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,
index ff9735e59d9be41e3880acb96576f95b0c3537d7..f605c2194b067515cca2b474a0b35252ca5e6828 100644 (file)
@@ -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,
index a8d485777523a6c07941ca717fa2ec4bb8a24714..2c8dba013fe805fe5e88ead317364671c4cbfa60 100644 (file)
@@ -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,
index da48a52a9abc65094762448898e6880d06cf4e83..aef908c7dc6c7723603a937cd8eb04a525fbe00d 100644 (file)
@@ -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,
index a7b58351839ad7c066cfffcde0e21a428c465907..2ceb573da2bef618dc72bcd1ff651440e2412f97 100644 (file)
@@ -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,