[PATCHv2,18/18] gdb: Remove language_data struct

Message ID 305278161fafe56ed198297b458d33eb837ae401.1596638296.git.andrew.burgess@embecosm.com
State New
Headers show
Series
  • Further updates for the language class structure
Related show

Commit Message

Andrew Burgess Aug. 5, 2020, 2:45 p.m.
The language_data type, from which language_defn inherits, is now
empty, and this commit removes it.

Each language is updated to no longer create and use a language_data
struct.

There should be no user visible changes after this commit.

gdb/ChangeLog:

	* ada-lang.c (ada_language_data): Delete.
	(ada_language): Remove references to ada_language_data.
	* c-lang.c (c_language_data): Delete.
	(c_language): Remove references to c_language_data.
	(cplus_language_data): Delete.
	(cplus_language): Remove references to cplus_language_data.
	(asm_language_data): Delete.
	(asm_language): Remove references to asm_language_data.
	(minimal_language_data): Delete.
	(minimal_language): Remove references to minimal_language_data.
	* d-lang.c (d_language_data): Delete.
	(d_language): Remove references to d_language_data.
	* f-lang.c (f_language_data): Delete.
	(f_language): Remove references to f_language_data.
	* go-lang.c (go_language_data): Delete.
	(go_language): Remove references to go_language_data.
	* language.c (unknown_language_data): Delete.
	(unknown_language): Remove references to unknown_language_data.
	(auto_language_data): Delete.
	(auto_language): Remove references to auto_language_data.
	* language.h (language_data): Delete struct.
	(language_defn): No longer inherit from language_data.
	* m2-lang.c (m2_language_data): Delete.
	(m2_language): Remove references to m2_language_data.
	* objc-lang.c (objc_language_data): Delete.
	(objc_language): Remove references to objc_language_data.
	* opencl-lang.c (opencl_language_data): Delete.
	(opencl_language): Remove references to opencl_language_data.
	* p-lang.c (pascal_language_data): Delete.
	(pascal_language): Remove references to pascal_language_data.
	* rust-lang.c (rust_language_data): Delete.
	(rust_language): Remove references to rust_language_data.
---
 gdb/ChangeLog     | 35 +++++++++++++++++++++++++++++++++++
 gdb/ada-lang.c    |  8 +-------
 gdb/c-lang.c      | 38 +++++++-------------------------------
 gdb/d-lang.c      |  8 +-------
 gdb/f-lang.c      |  8 +-------
 gdb/go-lang.c     |  8 +-------
 gdb/language.c    | 16 ++--------------
 gdb/language.h    | 25 +++----------------------
 gdb/m2-lang.c     |  8 +-------
 gdb/objc-lang.c   |  8 +-------
 gdb/opencl-lang.c |  7 +------
 gdb/p-lang.c      |  8 +-------
 gdb/rust-lang.c   |  8 +-------
 13 files changed, 56 insertions(+), 129 deletions(-)

-- 
2.25.4

Patch

diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c
index dbfaebc66e2..918870de491 100644
--- a/gdb/ada-lang.c
+++ b/gdb/ada-lang.c
@@ -13704,19 +13704,13 @@  ada_get_symbol_name_matcher (const lookup_name_info &lookup_name)
     }
 }
 
-/* Constant data that describes the Ada language.  */
-
-extern const struct language_data ada_language_data =
-{
-};
-
 /* Class representing the Ada language.  */
 
 class ada_language : public language_defn
 {
 public:
   ada_language ()
-    : language_defn (language_ada, ada_language_data)
+    : language_defn (language_ada)
   { /* Nothing.  */ }
 
   /* See language.h.  */
diff --git a/gdb/c-lang.c b/gdb/c-lang.c
index 73968ed20f4..4e942435177 100644
--- a/gdb/c-lang.c
+++ b/gdb/c-lang.c
@@ -871,19 +871,13 @@  const struct exp_descriptor exp_descriptor_c =
   evaluate_subexp_c
 };
 
-/* Constant data that describes the C language.  */
-
-extern const struct language_data c_language_data =
-{
-};
-
 /* Class representing the C language.  */
 
 class c_language : public language_defn
 {
 public:
   c_language ()
-    : language_defn (language_c, c_language_data)
+    : language_defn (language_c)
   { /* Nothing.  */ }
 
   /* See language.h.  */
@@ -989,19 +983,13 @@  enum cplus_primitive_types {
   nr_cplus_primitive_types
 };
 
-/* Constant data that describes the C++ language.  */
-
-extern const struct language_data cplus_language_data =
-{
-};
-
 /* A class for the C++ language.  */
 
 class cplus_language : public language_defn
 {
 public:
   cplus_language ()
-    : language_defn (language_cplus, cplus_language_data)
+    : language_defn (language_cplus)
   { /* Nothing.  */ }
 
   /* See language.h.  */
@@ -1210,19 +1198,13 @@  class cplus_language : public language_defn
 
 static cplus_language cplus_language_defn;
 
-/* Constant data that describes the ASM language.  */
-
-extern const struct language_data asm_language_data =
-{
-};
-
 /* A class for the ASM language.  */
 
 class asm_language : public language_defn
 {
 public:
   asm_language ()
-    : language_defn (language_asm, asm_language_data)
+    : language_defn (language_asm)
   { /* Nothing.  */ }
 
   /* See language.h.  */
@@ -1286,22 +1268,16 @@  class asm_language : public language_defn
 /* The single instance of the ASM language class.  */
 static asm_language asm_language_defn;
 
-/* The following language_defn does not represent a real language.
-   It just provides a minimal support a-la-C that should allow users
-   to do some simple operations when debugging applications that use
+/* A class for the minimal language.  This does not represent a real
+   language.  It just provides a minimal support a-la-C that should allow
+   users to do some simple operations when debugging applications that use
    a language currently not supported by GDB.  */
 
-extern const struct language_data minimal_language_data =
-{
-};
-
-/* A class for the minimal language.  */
-
 class minimal_language : public language_defn
 {
 public:
   minimal_language ()
-    : language_defn (language_minimal, minimal_language_data)
+    : language_defn (language_minimal)
   { /* Nothing.  */ }
 
   /* See language.h.  */
diff --git a/gdb/d-lang.c b/gdb/d-lang.c
index f590d63d930..58664f73349 100644
--- a/gdb/d-lang.c
+++ b/gdb/d-lang.c
@@ -124,19 +124,13 @@  enum d_primitive_types {
   nr_d_primitive_types
 };
 
-/* Constant data that describes the D language.  */
-
-extern const struct language_data d_language_data =
-{
-};
-
 /* Class representing the D language.  */
 
 class d_language : public language_defn
 {
 public:
   d_language ()
-    : language_defn (language_d, d_language_data)
+    : language_defn (language_d)
   { /* Nothing.  */ }
 
   /* See language.h.  */
diff --git a/gdb/f-lang.c b/gdb/f-lang.c
index 101f4dbc1e5..ab7e524cada 100644
--- a/gdb/f-lang.c
+++ b/gdb/f-lang.c
@@ -482,19 +482,13 @@  static const struct exp_descriptor exp_descriptor_f =
   evaluate_subexp_f
 };
 
-/* Constant data that describes the Fortran language.  */
-
-extern const struct language_data f_language_data =
-{
-};
-
 /* Class representing the Fortran language.  */
 
 class f_language : public language_defn
 {
 public:
   f_language ()
-    : language_defn (language_fortran, f_language_data)
+    : language_defn (language_fortran)
   { /* Nothing.  */ }
 
   /* See language.h.  */
diff --git a/gdb/go-lang.c b/gdb/go-lang.c
index 2b9be93b2e5..0322961179f 100644
--- a/gdb/go-lang.c
+++ b/gdb/go-lang.c
@@ -504,19 +504,13 @@  enum go_primitive_types {
   nr_go_primitive_types
 };
 
-/* Constant data that describes the Go language.  */
-
-extern const struct language_data go_language_data =
-{
-};
-
 /* Class representing the Go language.  */
 
 class go_language : public language_defn
 {
 public:
   go_language ()
-    : language_defn (language_go, go_language_data)
+    : language_defn (language_go)
   { /* Nothing.  */ }
 
   /* See language.h.  */
diff --git a/gdb/language.c b/gdb/language.c
index 37aef2cd73b..761f4966979 100644
--- a/gdb/language.c
+++ b/gdb/language.c
@@ -812,19 +812,13 @@  unknown_language_arch_info (struct gdbarch *gdbarch,
 						       struct type *);
 }
 
-/* Constant data that describes the unknown language.  */
-
-extern const struct language_data unknown_language_data =
-{
-};
-
 /* Class representing the unknown language.  */
 
 class unknown_language : public language_defn
 {
 public:
   unknown_language ()
-    : language_defn (language_unknown, unknown_language_data)
+    : language_defn (language_unknown)
   { /* Nothing.  */ }
 
   /* See language.h.  */
@@ -947,19 +941,13 @@  class unknown_language : public language_defn
 
 static unknown_language unknown_language_defn;
 
-/* Constant data for the fake "auto" language.  */
-
-extern const struct language_data auto_language_data =
-{
-};
-
 /* Class representing the fake "auto" language.  */
 
 class auto_language : public language_defn
 {
 public:
   auto_language ()
-    : language_defn (language_auto, auto_language_data)
+    : language_defn (language_auto)
   { /* Nothing.  */ }
 
   /* See language.h.  */
diff --git a/gdb/language.h b/gdb/language.h
index 2d13cfa9db9..3ee6476cbbb 100644
--- a/gdb/language.h
+++ b/gdb/language.h
@@ -152,31 +152,12 @@  struct language_pass_by_ref_info
 /* Splitting strings into words.  */
 extern const char *default_word_break_characters (void);
 
-/* Structure tying together assorted information about a language.
-
-   As we move over from the old structure based languages to a class
-   hierarchy of languages this structure will continue to contain a
-   mixture of both data and function pointers.
-
-   Once the class hierarchy of languages in place the first task is to
-   remove the function pointers from this structure and convert them into
-   member functions on the different language classes.
-
-   The current plan it to keep the constant data that describes a language
-   in this structure, and have each language pass in an instance of this
-   structure at construction time.  */
-
-struct language_data
-  {
-  };
-
 /* Base class from which all other language classes derive.  */
 
-struct language_defn : language_data
+struct language_defn
 {
-  language_defn (enum language lang, const language_data &init_data)
-    : language_data (init_data),
-      la_language (lang)
+  language_defn (enum language lang)
+    : la_language (lang)
   {
     /* We should only ever create one instance of each language.  */
     gdb_assert (languages[lang] == nullptr);
diff --git a/gdb/m2-lang.c b/gdb/m2-lang.c
index 1f9c8a878e4..3cc0364b4a1 100644
--- a/gdb/m2-lang.c
+++ b/gdb/m2-lang.c
@@ -195,19 +195,13 @@  const struct exp_descriptor exp_descriptor_modula2 =
   evaluate_subexp_modula2
 };
 
-/* Constant data describing the M2 language.  */
-
-extern const struct language_data m2_language_data =
-{
-};
-
 /* Class representing the M2 language.  */
 
 class m2_language : public language_defn
 {
 public:
   m2_language ()
-    : language_defn (language_m2, m2_language_data)
+    : language_defn (language_m2)
   { /* Nothing.  */ }
 
   /* See language.h.  */
diff --git a/gdb/objc-lang.c b/gdb/objc-lang.c
index b59a45b49be..9eaaf96a2a5 100644
--- a/gdb/objc-lang.c
+++ b/gdb/objc-lang.c
@@ -319,19 +319,13 @@  static const struct op_print objc_op_print_tab[] =
     {NULL, OP_NULL, PREC_NULL, 0}
 };
 
-/* Constant data representing the Objective-C language.  */
-
-extern const struct language_data objc_language_data =
-{
-};
-
 /* Class representing the Objective-C language.  */
 
 class objc_language : public language_defn
 {
 public:
   objc_language ()
-    : language_defn (language_objc, objc_language_data)
+    : language_defn (language_objc)
   { /* Nothing.  */ }
 
   /* See language.h.  */
diff --git a/gdb/opencl-lang.c b/gdb/opencl-lang.c
index 9bc5f5698c6..bbb251e83e2 100644
--- a/gdb/opencl-lang.c
+++ b/gdb/opencl-lang.c
@@ -1004,18 +1004,13 @@  const struct exp_descriptor exp_descriptor_opencl =
   evaluate_subexp_opencl
 };
 
-/* Constant data representing the OpenCL language.  */
-extern const struct language_data opencl_language_data =
-{
-};
-
 /* Class representing the OpenCL language.  */
 
 class opencl_language : public language_defn
 {
 public:
   opencl_language ()
-    : language_defn (language_opencl, opencl_language_data)
+    : language_defn (language_opencl)
   { /* Nothing.  */ }
 
   /* See language.h.  */
diff --git a/gdb/p-lang.c b/gdb/p-lang.c
index 6a9811d869c..1867fd4b943 100644
--- a/gdb/p-lang.c
+++ b/gdb/p-lang.c
@@ -248,19 +248,13 @@  enum pascal_primitive_types {
   nr_pascal_primitive_types
 };
 
-/* Constant data representing the Pascal language.  */
-
-extern const struct language_data pascal_language_data =
-{
-};
-
 /* Class representing the Pascal language.  */
 
 class pascal_language : public language_defn
 {
 public:
   pascal_language ()
-    : language_defn (language_pascal, pascal_language_data)
+    : language_defn (language_pascal)
   { /* Nothing.  */ }
 
   /* See language.h.  */
diff --git a/gdb/rust-lang.c b/gdb/rust-lang.c
index 23508af96dc..0f61eb18fc1 100644
--- a/gdb/rust-lang.c
+++ b/gdb/rust-lang.c
@@ -1902,19 +1902,13 @@  static const struct exp_descriptor exp_descriptor_rust =
   rust_evaluate_subexp
 };
 
-/* Constant data representing the Rust language.  */
-
-extern const struct language_data rust_language_data =
-{
-};
-
 /* Class representing the Rust language.  */
 
 class rust_language : public language_defn
 {
 public:
   rust_language ()
-    : language_defn (language_rust, rust_language_data)
+    : language_defn (language_rust)
   { /* Nothing.  */ }
 
   /* See language.h.  */