gdb: Convert language la_value_print_inner field to a method
authorAndrew Burgess <andrew.burgess@embecosm.com>
Mon, 1 Jun 2020 14:36:30 +0000 (15:36 +0100)
committerAndrew Burgess <andrew.burgess@embecosm.com>
Wed, 17 Jun 2020 08:25:11 +0000 (09:25 +0100)
This commit changes the language_data::la_value_print_inner function
pointer member variable into a member function of language_defn.

There should be no user visible changes after this commit.

gdb/ChangeLog:

* ada-lang.c (ada_language_data): Delete la_value_print_inner
initializer.
(ada_language::value_print_inner): New member function.
* c-lang.c (c_language_data): Delete la_value_print_inner
initializer.
(cplus_language_data): Likewise.
(asm_language_data): Likewise.
(minimal_language_data): Likewise.
* d-lang.c (d_language_data): Likewise.
(d_language::value_print_inner): New member function.
* f-lang.c (f_language_data): Delete la_value_print_inner
initializer.
(f_language::value_print_inner): New member function.
* f-lang.h (f_value_print_innner): Rename to...
(f_value_print_inner): ...this (note spelling of 'inner').
* f-valprint.c (f_value_print_innner): Rename to...
(f_value_print_inner): ...this (note spelling of 'inner').
* go-lang.c (go_language_data): Delete la_value_print_inner
initializer.
(go_language::value_print_inner): New member function.
* language.c (language_defn::value_print_inner): Define new member
function.
(unk_lang_value_print_inner): Delete.
(unknown_language_data): Delete la_value_print_inner initializer.
(unknown_language::value_print_inner): New member function.
(auto_language_data): Delete la_value_print_inner initializer.
(auto_language::value_print_inner): New member function.
* language.h (language_data): Delete la_value_print_inner field.
(language_defn::value_print_inner): Delcare new member function.
* m2-lang.c (m2_language_data): Delete la_value_print_inner
initializer.
(m2_language::value_print_inner): New member function.
* objc-lang.c (objc_language_data): Delete la_value_print_inner
initializer.
* opencl-lang.c (opencl_language_data): Likewise.
* p-lang.c (pascal_language_data): Likewise.
(pascal_language::value_print_inner): New member function.
* rust-lang.c (rust_language_data): Delete la_value_print_inner
initializer.
(rust_language::value_print_inner): New member function.
* valprint.c (do_val_print): Update call to value_print_inner.

16 files changed:
gdb/ChangeLog
gdb/ada-lang.c
gdb/c-lang.c
gdb/d-lang.c
gdb/f-lang.c
gdb/f-lang.h
gdb/f-valprint.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
gdb/valprint.c

index d1acf26d8ef65bad21d318b2885eee0fd3377d79..c58a91556dcb88df5b42d2ac74f1549304bd4e57 100644 (file)
@@ -1,3 +1,47 @@
+2020-06-17  Andrew Burgess  <andrew.burgess@embecosm.com>
+
+       * ada-lang.c (ada_language_data): Delete la_value_print_inner
+       initializer.
+       (ada_language::value_print_inner): New member function.
+       * c-lang.c (c_language_data): Delete la_value_print_inner
+       initializer.
+       (cplus_language_data): Likewise.
+       (asm_language_data): Likewise.
+       (minimal_language_data): Likewise.
+       * d-lang.c (d_language_data): Likewise.
+       (d_language::value_print_inner): New member function.
+       * f-lang.c (f_language_data): Delete la_value_print_inner
+       initializer.
+       (f_language::value_print_inner): New member function.
+       * f-lang.h (f_value_print_innner): Rename to...
+       (f_value_print_inner): ...this (note spelling of 'inner').
+       * f-valprint.c (f_value_print_innner): Rename to...
+       (f_value_print_inner): ...this (note spelling of 'inner').
+       * go-lang.c (go_language_data): Delete la_value_print_inner
+       initializer.
+       (go_language::value_print_inner): New member function.
+       * language.c (language_defn::value_print_inner): Define new member
+       function.
+       (unk_lang_value_print_inner): Delete.
+       (unknown_language_data): Delete la_value_print_inner initializer.
+       (unknown_language::value_print_inner): New member function.
+       (auto_language_data): Delete la_value_print_inner initializer.
+       (auto_language::value_print_inner): New member function.
+       * language.h (language_data): Delete la_value_print_inner field.
+       (language_defn::value_print_inner): Delcare new member function.
+       * m2-lang.c (m2_language_data): Delete la_value_print_inner
+       initializer.
+       (m2_language::value_print_inner): New member function.
+       * objc-lang.c (objc_language_data): Delete la_value_print_inner
+       initializer.
+       * opencl-lang.c (opencl_language_data): Likewise.
+       * p-lang.c (pascal_language_data): Likewise.
+       (pascal_language::value_print_inner): New member function.
+       * rust-lang.c (rust_language_data): Delete la_value_print_inner
+       initializer.
+       (rust_language::value_print_inner): New member function.
+       * valprint.c (do_val_print): Update call to value_print_inner.
+
 2020-06-17  Andrew Burgess  <andrew.burgess@embecosm.com>
 
        * ada-lang.c (ada_language_data): Delete la_value_print
index 85483d4e4b64adebdac3094fc472dab40ca5081b..a3ce7c325b2a92436ffae5ac1153083256ee02d9 100644 (file)
@@ -13764,7 +13764,6 @@ extern const struct language_data ada_language_data =
   ada_printstr,                 /* Function to print string constant */
   emit_char,                    /* Function to print single char (not used) */
   ada_print_typedef,            /* Print a typedef using appropriate syntax */
-  ada_value_print_inner,       /* la_value_print_inner */
   NULL,                         /* name_of_this */
   true,                         /* la_store_sym_names_in_linkage_form_p */
   ada_lookup_symbol_nonlocal,   /* Looking up non-local symbols.  */
@@ -14108,6 +14107,15 @@ public:
     return ada_value_print (val, stream, options);
   }
 
+  /* See language.h.  */
+
+  void value_print_inner
+       (struct value *val, struct ui_file *stream, int recurse,
+        const struct value_print_options *options) const override
+  {
+    return ada_value_print_inner (val, stream, recurse, options);
+  }
+
 protected:
   /* See language.h.  */
 
index 6aa05a63119855c561bfc6d49bf354351ec8f0a2..cead372ae6f75760c5f52a2fd1ee15f1fb09d78f 100644 (file)
@@ -895,7 +895,6 @@ extern const struct language_data c_language_data =
   c_printstr,                  /* Function to print string constant */
   c_emit_char,                 /* Print a single char */
   c_print_typedef,             /* Print a typedef using appropriate syntax */
-  c_value_print_inner,         /* la_value_print_inner */
   NULL,                                /* name_of_this */
   true,                                /* la_store_sym_names_in_linkage_form_p */
   basic_lookup_symbol_nonlocal,        /* lookup_symbol_nonlocal */
@@ -1005,7 +1004,6 @@ extern const struct language_data cplus_language_data =
   c_printstr,                  /* Function to print string constant */
   c_emit_char,                 /* Print a single char */
   c_print_typedef,             /* Print a typedef using appropriate syntax */
-  c_value_print_inner,         /* la_value_print_inner */
   "this",                       /* name_of_this */
   false,                       /* la_store_sym_names_in_linkage_form_p */
   cp_lookup_symbol_nonlocal,   /* lookup_symbol_nonlocal */
@@ -1203,7 +1201,6 @@ extern const struct language_data asm_language_data =
   c_printstr,                  /* Function to print string constant */
   c_emit_char,                 /* Print a single char */
   c_print_typedef,             /* Print a typedef using appropriate syntax */
-  c_value_print_inner,         /* la_value_print_inner */
   NULL,                                /* name_of_this */
   true,                                /* la_store_sym_names_in_linkage_form_p */
   basic_lookup_symbol_nonlocal,        /* lookup_symbol_nonlocal */
@@ -1268,7 +1265,6 @@ extern const struct language_data minimal_language_data =
   c_printstr,                  /* Function to print string constant */
   c_emit_char,                 /* Print a single char */
   c_print_typedef,             /* Print a typedef using appropriate syntax */
-  c_value_print_inner,         /* la_value_print_inner */
   NULL,                                /* name_of_this */
   true,                                /* la_store_sym_names_in_linkage_form_p */
   basic_lookup_symbol_nonlocal,        /* lookup_symbol_nonlocal */
index 553b38de81e770bfad33b1807d0c7e2098af8a58..dff9d470bc9816f70cf8b038c0f1d5827e78d2f6 100644 (file)
@@ -149,7 +149,6 @@ extern const struct language_data d_language_data =
   c_emit_char,                 /* Print a single char.  */
   c_print_typedef,             /* Print a typedef using appropriate
                                   syntax.  */
-  d_value_print_inner,         /* la_value_print_inner */
   "this",
   false,                       /* la_store_sym_names_in_linkage_form_p */
   d_lookup_symbol_nonlocal,
@@ -257,6 +256,15 @@ public:
   {
     c_print_type (type, varstring, stream, show, level, flags);
   }
+
+  /* See language.h.  */
+
+  void value_print_inner
+       (struct value *val, struct ui_file *stream, int recurse,
+        const struct value_print_options *options) const override
+  {
+    return d_value_print_inner (val, stream, recurse, options);
+  }
 };
 
 /* Single instance of the D language class.  */
index 3e2c97c06192a18e6de1ebd87a0be9b8da042434..d5b2bf286daf8f67067d056e0634e785752ff5b8 100644 (file)
@@ -570,7 +570,6 @@ extern const struct language_data f_language_data =
   f_printstr,                  /* function to print string constant */
   f_emit_char,                 /* Function to print a single character */
   f_print_typedef,             /* Print a typedef using appropriate syntax */
-  f_value_print_innner,                /* la_value_print_inner */
   NULL,                        /* name_of_this */
   false,                       /* la_store_sym_names_in_linkage_form_p */
   cp_lookup_symbol_nonlocal,   /* lookup_symbol_nonlocal */
@@ -697,6 +696,16 @@ public:
                                                        code);
   }
 
+  /* See language.h.  */
+
+  void value_print_inner
+       (struct value *val, struct ui_file *stream, int recurse,
+        const struct value_print_options *options) const override
+  {
+    return f_value_print_inner (val, stream, recurse, options);
+  }
+
+
 protected:
 
   /* See language.h.  */
index 84a63a8a410133194f5cb0da83789f250d9771c6..4710b14aa62f162085c113a7a82173b3a3534d0e 100644 (file)
@@ -38,7 +38,7 @@ extern void f_print_type (struct type *, const char *, struct ui_file *, int,
 
 /* Implement la_value_print_inner for Fortran.  */
 
-extern void f_value_print_innner (struct value *val, struct ui_file *stream,
+extern void f_value_print_inner (struct value *val, struct ui_file *stream,
                                  int recurse,
                                  const struct value_print_options *options);
 
index 972d1652db72727971a2aabb9d605eb4dfb86a2f..6ed1c340c7602b33c4d26c91a7785c3f7eed6567 100644 (file)
@@ -211,7 +211,7 @@ static const struct generic_val_print_decorations f_decorations =
 /* See f-lang.h.  */
 
 void
-f_value_print_innner (struct value *val, struct ui_file *stream, int recurse,
+f_value_print_inner (struct value *val, struct ui_file *stream, int recurse,
                      const struct value_print_options *options)
 {
   struct type *type = check_typedef (value_type (val));
index 14d63ab7e8c4b6806bfd825278e67b682af8f9a4..9fdd45290f0027ea6b024639e0294954adcc52d5 100644 (file)
@@ -534,7 +534,6 @@ extern const struct language_data go_language_data =
   c_emit_char,                 /* Print a single char.  */
   c_print_typedef,             /* Print a typedef using appropriate
                                   syntax.  */
-  go_value_print_inner,                /* la_value_print_inner */
   NULL,                                /* name_of_this */
   false,                       /* la_store_sym_names_in_linkage_form_p */
   basic_lookup_symbol_nonlocal, 
@@ -631,6 +630,15 @@ public:
   {
     go_print_type (type, varstring, stream, show, level, flags);
   }
+
+  /* See language.h.  */
+
+  void value_print_inner
+       (struct value *val, struct ui_file *stream, int recurse,
+        const struct value_print_options *options) const override
+  {
+    return go_value_print_inner (val, stream, recurse, options);
+  }
 };
 
 /* Single instance of the Go language class.  */
index 5b47a4956ed25721ad1688a22b6ca6baca0e7809..d93b4756707b890f982a77aa8754dba7cde86abc 100644 (file)
@@ -641,6 +641,16 @@ language_defn::value_print (struct value *val, struct ui_file *stream,
   return c_value_print (val, stream, options);
 }
 
+/* See language.h.  */
+
+void
+language_defn::value_print_inner
+       (struct value *val, struct ui_file *stream, int recurse,
+        const struct value_print_options *options) const
+{
+  return c_value_print_inner (val, stream, recurse, options);
+}
+
 /* The default implementation of the get_symbol_name_matcher_inner method
    from the language_defn class.  Matches with strncmp_iw.  */
 
@@ -739,15 +749,6 @@ unk_lang_printstr (struct ui_file *stream, struct type *type,
           "function unk_lang_printstr called."));
 }
 
-static void
-unk_lang_value_print_inner (struct value *val,
-                           struct ui_file *stream, int recurse,
-                           const struct value_print_options *options)
-{
-  error (_("internal error - unimplemented "
-          "function unk_lang_value_print_inner called."));
-}
-
 static const struct op_print unk_op_print_tab[] =
 {
   {NULL, OP_NULL, PREC_NULL, 0}
@@ -782,7 +783,6 @@ extern const struct language_data unknown_language_data =
   unk_lang_printstr,
   unk_lang_emit_char,
   default_print_typedef,       /* Print a typedef using appropriate syntax */
-  unk_lang_value_print_inner,  /* la_value_print_inner */
   "this",                      /* name_of_this */
   true,                                /* store_sym_names_in_linkage_form_p */
   basic_lookup_symbol_nonlocal, /* lookup_symbol_nonlocal */
@@ -834,6 +834,15 @@ public:
   {
     error (_("unimplemented unknown_language::value_print called"));
   }
+
+  /* See language.h.  */
+
+  void value_print_inner
+       (struct value *val, struct ui_file *stream, int recurse,
+        const struct value_print_options *options) const override
+  {
+    error (_("unimplemented unknown_language::value_print_inner called"));
+  }
 };
 
 /* Single instance of the unknown language class.  */
@@ -859,7 +868,6 @@ extern const struct language_data auto_language_data =
   unk_lang_printstr,
   unk_lang_emit_char,
   default_print_typedef,       /* Print a typedef using appropriate syntax */
-  unk_lang_value_print_inner,  /* la_value_print_inner */
   "this",                      /* name_of_this */
   false,                       /* store_sym_names_in_linkage_form_p */
   basic_lookup_symbol_nonlocal,        /* lookup_symbol_nonlocal */
@@ -911,6 +919,15 @@ public:
   {
     error (_("unimplemented auto_language::value_print called"));
   }
+
+  /* See language.h.  */
+
+  void value_print_inner
+       (struct value *val, struct ui_file *stream, int recurse,
+        const struct value_print_options *options) const override
+  {
+    error (_("unimplemented auto_language::value_print_inner called"));
+  }
 };
 
 /* Single instance of the fake "auto" language.  */
index 4b27c010b0e947e06d8538b899671063522139a6..06978d7067f24e719f13bcd5a83303fb4eef2906 100644 (file)
@@ -258,13 +258,6 @@ struct language_data
     void (*la_print_typedef) (struct type *type, struct symbol *new_symbol,
                              struct ui_file *stream);
 
-    /* Print a value using syntax appropriate for this language.
-       RECURSE is the recursion depth.  It is zero-based.  */
-
-    void (*la_value_print_inner) (struct value *, struct ui_file *,
-                                 int recurse,
-                                 const struct value_print_options *);
-
     /* Now come some hooks for lookup_symbol.  */
 
     /* If this is non-NULL, specifies the name that of the implicit
@@ -542,6 +535,12 @@ struct language_defn : language_data
   virtual void value_print (struct value *val, struct ui_file *stream,
                            const struct value_print_options *options) const;
 
+  /* Print a value using syntax appropriate for this language.  RECURSE is
+     the recursion depth.  It is zero-based.  */
+  virtual void value_print_inner
+       (struct value *val, struct ui_file *stream, int recurse,
+        const struct value_print_options *options) const;
+
 protected:
 
   /* This is the overridable part of the GET_SYMBOL_NAME_MATCHER method.
index 615c2f95bd2709fec9a400f56c94276aaf5fe7cf..6bc4eb089ea957cbcd2246f76f5870a1febf479c 100644 (file)
@@ -368,7 +368,6 @@ extern const struct language_data m2_language_data =
   m2_printstr,                 /* function to print string constant */
   m2_emit_char,                        /* Function to print a single character */
   m2_print_typedef,            /* Print a typedef using appropriate syntax */
-  m2_value_print_inner,                /* la_value_print_inner */
   NULL,                                /* name_of_this */
   false,                       /* la_store_sym_names_in_linkage_form_p */
   basic_lookup_symbol_nonlocal,        /* lookup_symbol_nonlocal */
@@ -423,6 +422,15 @@ public:
   {
     m2_print_type (type, varstring, stream, show, level, flags);
   }
+
+  /* See language.h.  */
+
+  void value_print_inner
+       (struct value *val, struct ui_file *stream, int recurse,
+        const struct value_print_options *options) const override
+  {
+    return m2_value_print_inner (val, stream, recurse, options);
+  }
 };
 
 /* Single instance of the M2 language.  */
index aa9d1a9312cb06de918f015b6782b68272ddb137..387c6ba7e117312b943518f4408f2268c6c4071a 100644 (file)
@@ -343,7 +343,6 @@ extern const struct language_data objc_language_data =
   c_printstr,                 /* Function to print string constant */
   c_emit_char,
   c_print_typedef,             /* Print a typedef using appropriate syntax */
-  c_value_print_inner,         /* la_value_print_inner */
   "self",                      /* name_of_this */
   false,                       /* la_store_sym_names_in_linkage_form_p */
   basic_lookup_symbol_nonlocal,        /* lookup_symbol_nonlocal */
index 1b7553dde6e1435aced737b72d1bfc6e19cd11d2..5cb983900093035e390ac729e784c1373ec76e42 100644 (file)
@@ -1022,7 +1022,6 @@ extern const struct language_data opencl_language_data =
   c_printstr,                  /* Function to print string constant */
   c_emit_char,                 /* Print a single char */
   c_print_typedef,             /* Print a typedef using appropriate syntax */
-  c_value_print_inner,         /* la_value_print_inner */
   NULL,                         /* name_of_this */
   false,                       /* la_store_sym_names_in_linkage_form_p */
   basic_lookup_symbol_nonlocal,        /* lookup_symbol_nonlocal */
index ff3ba3b56e048d53bfed68ecf33f6c54779f3a18..4c9d354fc09b7ce3c241e0afe2bbf99fef2d59f0 100644 (file)
@@ -399,7 +399,6 @@ extern const struct language_data pascal_language_data =
   pascal_printstr,             /* Function to print string constant */
   pascal_emit_char,            /* Print a single char */
   pascal_print_typedef,                /* Print a typedef using appropriate syntax */
-  pascal_value_print_inner,    /* la_value_print_inner */
   "this",                      /* name_of_this */
   false,                       /* la_store_sym_names_in_linkage_form_p */
   basic_lookup_symbol_nonlocal,        /* lookup_symbol_nonlocal */
@@ -485,6 +484,15 @@ public:
   {
     return pascal_value_print (val, stream, options);
   }
+
+  /* See language.h.  */
+
+  void value_print_inner
+       (struct value *val, struct ui_file *stream, int recurse,
+        const struct value_print_options *options) const override
+  {
+    return pascal_value_print_inner (val, stream, recurse, options);
+  }
 };
 
 /* Single instance of the Pascal language class.  */
index e48be115afcef506041a37733bfc3ee74ee0edb4..c2fd3ba5946990aa765a392722b70114e0f9ce59 100644 (file)
@@ -2040,7 +2040,6 @@ extern const struct language_data rust_language_data =
   rust_printstr,               /* Function to print string constant */
   rust_emitchar,               /* Print a single char */
   rust_print_typedef,          /* Print a typedef using appropriate syntax */
-  rust_value_print_inner,      /* la_value_print_inner */
   NULL,                                /* name_of_this */
   false,                       /* la_store_sym_names_in_linkage_form_p */
   rust_lookup_symbol_nonlocal, /* lookup_symbol_nonlocal */
@@ -2139,6 +2138,15 @@ public:
       (xstrprintf ("*(%s as *mut %s)", core_addr_to_string (addr),
                   name.c_str ()));
   }
+
+  /* See language.h.  */
+
+  void value_print_inner
+       (struct value *val, struct ui_file *stream, int recurse,
+        const struct value_print_options *options) const override
+  {
+    return rust_value_print_inner (val, stream, recurse, options);
+  }
 };
 
 /* Single instance of the Rust language class.  */
index f2549805268e23b77d96b580825c1337835ccec3..51c77c3e6d2cdf0a1eb92b8ee254f296fba08479 100644 (file)
@@ -979,7 +979,7 @@ do_val_print (struct value *value, struct ui_file *stream, int recurse,
 
   try
     {
-      language->la_value_print_inner (value, stream, recurse, &local_opts);
+      language->value_print_inner (value, stream, recurse, &local_opts);
     }
   catch (const gdb_exception_error &except)
     {