+2020-06-23  Andrew Burgess  <andrew.burgess@embecosm.com>
+
+       * ada-lang.c (emit_char): Renamed to ada_language::emitchar.
+       (ada_language_data): Delete la_emitchar initializer.
+       (ada_language::emitchar): New member function, implementation from
+       emit_char.
+       * c-lang.c (c_language_data): Delete la_emitchar initializer.
+       (cplus_language_data): Likewise.
+       (asm_language_data): Likewise.
+       (minimal_language_data): Likewise.
+       * d-lang.c (d_language_data): Likewise.
+       * f-lang.c (f_emit_char): Rename to f_language::emitchar.
+       (f_language_data): Delete la_emitchar initializer.
+       (f_language::emitchar): New member function, implementation from
+       f_emit_char.
+       * go-lang.c (go_language_data): Delete la_emitchar initializer.
+       * language.c (unk_lang_emit_char): Delete.
+       (language_defn::emitchar): New member function definition.
+       (unknown_language_data): Delete la_emitchar initializer.
+       (unknown_language::emitchar): New member function.
+       (auto_language_data): Delete la_emitchar initializer.
+       (auto_language::emitchar): New member function.
+       * language.h (language_data): Delete la_emitchar field.
+       (language_defn::emitchar): New member field declaration.
+       (LA_EMIT_CHAR): Update call to emitchar.
+       * m2-lang.c (m2_emit_char): Rename to m2_language::emitchar.
+       (m2_language_data): Delete la_emitchar initializer.
+       (m2_language::emitchar): New member function, implementation from
+       m2_emit_char.
+       * objc-lang.c (objc_language_data): Delete la_emitchar
+       initializer.
+       * opencl-lang.c (opencl_language_data): Likewise.
+       * p-lang.c (pascal_emit_char): Rename to pascal_language::emitchar.
+       (pascal_language_data): Delete la_emitchar initializer.
+       (pascal_language::emitchar): New member function, implementation
+       from pascal_emit_char.
+       * rust-lang.c (rust_emitchar): Rename to rust_language::emitchar.
+       (rust_language_data): Delete la_emitchar initializer.
+       (rust_language::emitchar): New member function, implementation
+       from rust_emitchar.
+
 2020-06-23  Andrew Burgess  <andrew.burgess@embecosm.com>
 
        * ada-lang.c (resolve): Rename to ada_language::post_parser.
 
 \f
                                /* Language vector */
 
-/* Not really used, but needed in the ada_language_defn.  */
-
-static void
-emit_char (int c, struct type *type, struct ui_file *stream, int quoter)
-{
-  ada_emit_char (c, type, stream, quoter, 1);
-}
-
 static const struct exp_descriptor ada_exp_descriptor = {
   ada_print_subexp,
   ada_operator_length,
   &ada_exp_descriptor,
   ada_printchar,                /* Print a character constant */
   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 */
   NULL,                         /* name_of_this */
   true,                         /* la_store_sym_names_in_linkage_form_p */
     resolve_subexp (expp, &pc, 1, context_type, completing, tracker);
   }
 
+  /* See language.h.  */
+
+  void emitchar (int ch, struct type *chtype,
+                struct ui_file *stream, int quoter) const override
+  {
+    ada_emit_char (ch, chtype, stream, quoter, 1);
+  }
+
 protected:
   /* See language.h.  */
 
 
   &exp_descriptor_c,
   c_printchar,                 /* Print a character constant */
   c_printstr,                  /* Function to print string constant */
-  c_emit_char,                 /* Print a single char */
   c_print_typedef,             /* Print a typedef using appropriate syntax */
   NULL,                                /* name_of_this */
   true,                                /* la_store_sym_names_in_linkage_form_p */
   &exp_descriptor_c,
   c_printchar,                 /* Print a character constant */
   c_printstr,                  /* Function to print string constant */
-  c_emit_char,                 /* Print a single char */
   c_print_typedef,             /* Print a typedef using appropriate syntax */
   "this",                       /* name_of_this */
   false,                       /* la_store_sym_names_in_linkage_form_p */
   &exp_descriptor_c,
   c_printchar,                 /* Print a character constant */
   c_printstr,                  /* Function to print string constant */
-  c_emit_char,                 /* Print a single char */
   c_print_typedef,             /* Print a typedef using appropriate syntax */
   NULL,                                /* name_of_this */
   true,                                /* la_store_sym_names_in_linkage_form_p */
   &exp_descriptor_c,
   c_printchar,                 /* Print a character constant */
   c_printstr,                  /* Function to print string constant */
-  c_emit_char,                 /* Print a single char */
   c_print_typedef,             /* Print a typedef using appropriate syntax */
   NULL,                                /* name_of_this */
   true,                                /* la_store_sym_names_in_linkage_form_p */
 
   &exp_descriptor_c,
   c_printchar,                 /* Print a character constant.  */
   c_printstr,                  /* Function to print string constant.  */
-  c_emit_char,                 /* Print a single char.  */
   c_print_typedef,             /* Print a typedef using appropriate
                                   syntax.  */
   "this",
 
 /* Local functions */
 
 static void f_printchar (int c, struct type *type, struct ui_file * stream);
-static void f_emit_char (int c, struct type *type,
-                        struct ui_file * stream, int quoter);
 
 /* Return the encoding that should be used for the character type
    TYPE.  */
   return encoding;
 }
 
-/* Print the character C on STREAM as part of the contents of a literal
-   string whose delimiter is QUOTER.  Note that that format for printing
-   characters and strings is language specific.
-   FIXME:  This is a copy of the same function from c-exp.y.  It should
-   be replaced with a true F77 version.  */
-
-static void
-f_emit_char (int c, struct type *type, struct ui_file *stream, int quoter)
-{
-  const char *encoding = f_get_encoding (type);
-
-  generic_emit_char (c, type, stream, quoter, encoding);
-}
-
 /* Implementation of la_printchar.  */
 
 static void
   &exp_descriptor_f,
   f_printchar,                 /* Print character constant */
   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 */
   NULL,                        /* name_of_this */
   false,                       /* la_store_sym_names_in_linkage_form_p */
     return f_parse (ps);
   }
 
+  /* See language.h.  */
+
+  void emitchar (int ch, struct type *chtype,
+                struct ui_file *stream, int quoter) const override
+  {
+    const char *encoding = f_get_encoding (chtype);
+    generic_emit_char (ch, chtype, stream, quoter, encoding);
+  }
+
 protected:
 
   /* See language.h.  */
 
   &exp_descriptor_c,
   c_printchar,                 /* Print a character constant.  */
   c_printstr,                  /* Function to print string constant.  */
-  c_emit_char,                 /* Print a single char.  */
   c_print_typedef,             /* Print a typedef using appropriate
                                   syntax.  */
   NULL,                                /* name_of_this */
 
 
 static void set_range_case (void);
 
-static void unk_lang_emit_char (int c, struct type *type,
-                               struct ui_file *stream, int quoter);
-
 static void unk_lang_printchar (int c, struct type *type,
                                struct ui_file *stream);
 
   return c_value_print_inner (val, stream, recurse, options);
 }
 
+/* See language.h.  */
+
+void
+language_defn::emitchar (int ch, struct type *chtype,
+                        struct ui_file * stream, int quoter) const
+{
+  c_emit_char (ch, chtype, stream, quoter);
+}
+
 /* The default implementation of the get_symbol_name_matcher_inner method
    from the language_defn class.  Matches with strncmp_iw.  */
 
   return (type->code ()  == TYPE_CODE_STRING);
 }
 
-/* Define the language that is no language.  */
-
-static void
-unk_lang_emit_char (int c, struct type *type, struct ui_file *stream,
-                   int quoter)
-{
-  error (_("internal error - unimplemented "
-          "function unk_lang_emit_char called."));
-}
-
 static void
 unk_lang_printchar (int c, struct type *type, struct ui_file *stream)
 {
   &exp_descriptor_standard,
   unk_lang_printchar,          /* Print character constant */
   unk_lang_printstr,
-  unk_lang_emit_char,
   default_print_typedef,       /* Print a typedef using appropriate syntax */
   "this",                      /* name_of_this */
   true,                                /* store_sym_names_in_linkage_form_p */
     /* No parsing is done, just claim success.  */
     return 1;
   }
+
+  /* See language.h.  */
+
+  void emitchar (int ch, struct type *chtype,
+                struct ui_file *stream, int quoter) const override
+  {
+    error (_("unimplemented unknown_language::emitchar called"));
+  }
 };
 
 /* Single instance of the unknown language class.  */
   &exp_descriptor_standard,
   unk_lang_printchar,          /* Print character constant */
   unk_lang_printstr,
-  unk_lang_emit_char,
   default_print_typedef,       /* Print a typedef using appropriate syntax */
   "this",                      /* name_of_this */
   false,                       /* store_sym_names_in_linkage_form_p */
     /* No parsing is done, just claim success.  */
     return 1;
   }
+
+  /* See language.h.  */
+
+  void emitchar (int ch, struct type *chtype,
+                struct ui_file *stream, int quoter) const override
+  {
+    error (_("unimplemented auto_language::emitchar called"));
+  }
 };
 
 /* Single instance of the fake "auto" language.  */
 
                         const char *encoding, int force_ellipses,
                         const struct value_print_options *);
 
-    void (*la_emitchar) (int ch, struct type *chtype,
-                        struct ui_file * stream, int quoter);
-
     /* Print a typedef using syntax appropriate for this language.
        TYPE is the underlying type.  NEW_SYMBOL is the symbol naming
        the type.  STREAM is the output stream on which to print.  */
     /* By default the post-parser does nothing.  */
   }
 
+  /* Print the character CH (of type CHTYPE) on STREAM as part of the
+     contents of a literal string whose delimiter is QUOTER.  */
+
+  virtual void emitchar (int ch, struct type *chtype,
+                        struct ui_file *stream, int quoter) const;
+
 protected:
 
   /* This is the overridable part of the GET_SYMBOL_NAME_MATCHER method.
   (current_language->la_printstr(stream, elttype, string, length, \
                                 encoding, force_ellipses,options))
 #define LA_EMIT_CHAR(ch, type, stream, quoter) \
-  (current_language->la_emitchar(ch, type, stream, quoter))
+  (current_language->emitchar (ch, type, stream, quoter))
 
 #define LA_PRINT_ARRAY_INDEX(index_type, index_value, stream, options) \
   (current_language->print_array_index(index_type, index_value, stream, \
 
 #include "gdbarch.h"
 
 static void m2_printchar (int, struct type *, struct ui_file *);
-static void m2_emit_char (int, struct type *, struct ui_file *, int);
-
-/* Print the character C on STREAM as part of the contents of a literal
-   string whose delimiter is QUOTER.  Note that that format for printing
-   characters and strings is language specific.
-   FIXME:  This is a copy of the same function from c-exp.y.  It should
-   be replaced with a true Modula version.  */
-
-static void
-m2_emit_char (int c, struct type *type, struct ui_file *stream, int quoter)
-{
-
-  c &= 0xFF;                   /* Avoid sign bit follies.  */
-
-  if (PRINT_LITERAL_FORM (c))
-    {
-      if (c == '\\' || c == quoter)
-       {
-         fputs_filtered ("\\", stream);
-       }
-      fprintf_filtered (stream, "%c", c);
-    }
-  else
-    {
-      switch (c)
-       {
-       case '\n':
-         fputs_filtered ("\\n", stream);
-         break;
-       case '\b':
-         fputs_filtered ("\\b", stream);
-         break;
-       case '\t':
-         fputs_filtered ("\\t", stream);
-         break;
-       case '\f':
-         fputs_filtered ("\\f", stream);
-         break;
-       case '\r':
-         fputs_filtered ("\\r", stream);
-         break;
-       case '\033':
-         fputs_filtered ("\\e", stream);
-         break;
-       case '\007':
-         fputs_filtered ("\\a", stream);
-         break;
-       default:
-         fprintf_filtered (stream, "\\%.3o", (unsigned int) c);
-         break;
-       }
-    }
-}
 
 /* FIXME:  This is a copy of the same function from c-exp.y.  It should
    be replaced with a true Modula version.  */
   &exp_descriptor_modula2,
   m2_printchar,                        /* Print character constant */
   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 */
   NULL,                                /* name_of_this */
   false,                       /* la_store_sym_names_in_linkage_form_p */
   {
     return m2_parse (ps);
   }
+
+  /* See language.h.  */
+
+  void emitchar (int ch, struct type *chtype,
+                struct ui_file *stream, int quoter) const override
+  {
+    ch &= 0xFF;                        /* Avoid sign bit follies.  */
+
+    if (PRINT_LITERAL_FORM (ch))
+      {
+       if (ch == '\\' || ch == quoter)
+         fputs_filtered ("\\", stream);
+       fprintf_filtered (stream, "%c", ch);
+      }
+    else
+      {
+       switch (ch)
+         {
+         case '\n':
+           fputs_filtered ("\\n", stream);
+           break;
+         case '\b':
+           fputs_filtered ("\\b", stream);
+           break;
+         case '\t':
+           fputs_filtered ("\\t", stream);
+           break;
+         case '\f':
+           fputs_filtered ("\\f", stream);
+           break;
+         case '\r':
+           fputs_filtered ("\\r", stream);
+           break;
+         case '\033':
+           fputs_filtered ("\\e", stream);
+           break;
+         case '\007':
+           fputs_filtered ("\\a", stream);
+           break;
+         default:
+           fprintf_filtered (stream, "\\%.3o", (unsigned int) ch);
+           break;
+         }
+      }
+  }
 };
 
 /* Single instance of the M2 language.  */
 
   &exp_descriptor_standard,
   c_printchar,                /* Print a character constant */
   c_printstr,                 /* Function to print string constant */
-  c_emit_char,
   c_print_typedef,             /* Print a typedef using appropriate syntax */
   "self",                      /* name_of_this */
   false,                       /* la_store_sym_names_in_linkage_form_p */
 
   &exp_descriptor_opencl,
   c_printchar,                 /* Print a character constant */
   c_printstr,                  /* Function to print string constant */
-  c_emit_char,                 /* Print a single char */
   c_print_typedef,             /* Print a typedef using appropriate syntax */
   NULL,                         /* name_of_this */
   false,                       /* la_store_sym_names_in_linkage_form_p */
 
     }
 }
 
-static void pascal_emit_char (int c, struct type *type,
-                             struct ui_file *stream, int quoter);
-
-/* Print the character C on STREAM as part of the contents of a literal
-   string whose delimiter is QUOTER.  Note that that format for printing
-   characters and strings is language specific.  */
-
-static void
-pascal_emit_char (int c, struct type *type, struct ui_file *stream, int quoter)
-{
-  int in_quotes = 0;
-
-  pascal_one_char (c, stream, &in_quotes);
-  if (in_quotes)
-    fputs_filtered ("'", stream);
-}
-
 void
 pascal_printchar (int c, struct type *type, struct ui_file *stream)
 {
   &exp_descriptor_standard,
   pascal_printchar,            /* Print a character constant */
   pascal_printstr,             /* Function to print string constant */
-  pascal_emit_char,            /* Print a single char */
   pascal_print_typedef,                /* Print a typedef using appropriate syntax */
   "this",                      /* name_of_this */
   false,                       /* la_store_sym_names_in_linkage_form_p */
   {
     return pascal_parse (ps);
   }
+
+  /* See language.h.  */
+
+  void emitchar (int ch, struct type *chtype,
+                struct ui_file *stream, int quoter) const override
+  {
+    int in_quotes = 0;
+
+    pascal_one_char (ch, stream, &in_quotes);
+    if (in_quotes)
+      fputs_filtered ("'", stream);
+  }
 };
 
 /* Single instance of the Pascal language class.  */
 
 
 \f
 
-/* la_emitchar implementation for Rust.  */
-
-static void
-rust_emitchar (int c, struct type *type, struct ui_file *stream, int quoter)
-{
-  if (!rust_chartype_p (type))
-    generic_emit_char (c, type, stream, quoter,
-                      target_charset (get_type_arch (type)));
-  else if (c == '\\' || c == quoter)
-    fprintf_filtered (stream, "\\%c", c);
-  else if (c == '\n')
-    fputs_filtered ("\\n", stream);
-  else if (c == '\r')
-    fputs_filtered ("\\r", stream);
-  else if (c == '\t')
-    fputs_filtered ("\\t", stream);
-  else if (c == '\0')
-    fputs_filtered ("\\0", stream);
-  else if (c >= 32 && c <= 127 && isprint (c))
-    fputc_filtered (c, stream);
-  else if (c <= 255)
-    fprintf_filtered (stream, "\\x%02x", c);
-  else
-    fprintf_filtered (stream, "\\u{%06x}", c);
-}
-
 /* la_printchar implementation for Rust.  */
 
 static void
   &exp_descriptor_rust,
   rust_printchar,              /* Print a character constant */
   rust_printstr,               /* Function to print string constant */
-  rust_emitchar,               /* Print a single char */
   rust_print_typedef,          /* Print a typedef using appropriate syntax */
   NULL,                                /* name_of_this */
   false,                       /* la_store_sym_names_in_linkage_form_p */
   {
     return rust_parse (ps);
   }
+
+  /* See language.h.  */
+
+  void emitchar (int ch, struct type *chtype,
+                struct ui_file *stream, int quoter) const override
+  {
+    if (!rust_chartype_p (chtype))
+      generic_emit_char (ch, chtype, stream, quoter,
+                        target_charset (get_type_arch (chtype)));
+    else if (ch == '\\' || ch == quoter)
+      fprintf_filtered (stream, "\\%c", ch);
+    else if (ch == '\n')
+      fputs_filtered ("\\n", stream);
+    else if (ch == '\r')
+      fputs_filtered ("\\r", stream);
+    else if (ch == '\t')
+      fputs_filtered ("\\t", stream);
+    else if (ch == '\0')
+      fputs_filtered ("\\0", stream);
+    else if (ch >= 32 && ch <= 127 && isprint (ch))
+      fputc_filtered (ch, stream);
+    else if (ch <= 255)
+      fprintf_filtered (stream, "\\x%02x", ch);
+    else
+      fprintf_filtered (stream, "\\u{%06x}", ch);
+  }
 };
 
 /* Single instance of the Rust language class.  */