+2020-06-23 Andrew Burgess <andrew.burgess@embecosm.com>
+
+ * ada-lang.c (ada_language_data): Delete la_printchar initializer.
+ (ada_language::printchar): New member function.
+ * c-lang.c (c_language_data): Delete la_printchar initializer.
+ (cplus_language_data): Likewise.
+ (asm_language_data): Likewise.
+ (minimal_language_data): Likewise.
+ * d-lang.c (d_language_data): Likewise.
+ * f-lang.c (f_printchar): Rename to f_language::printchar.
+ (f_language_data): Delete la_printchar initializer.
+ (f_language::printchar): New member function, implementation from
+ f_printchar.
+ * go-lang.c (go_language_data): Delete la_printchar initializer.
+ * language.c (unk_lang_printchar): Delete.
+ (language_defn::printchar): Define new member function.
+ (unknown_language_data): Delete la_printchar initializer.
+ (unknown_language::printchar): New member function.
+ (auto_language_data): Delete la_printchar initializer.
+ (auto_language::printchar): New member function.
+ * language.h (language_data): Delete la_printchar field.
+ (language_defn::printchar): Declare new member function.
+ (LA_PRINT_CHAR): Update call to printchar.
+ * m2-lang.c (m2_language_data): Delete la_printchar initializer.
+ (m2_language::printchar): New member function.
+ * objc-lang.c (objc_language_data): Delete la_printchar
+ initializer.
+ * opencl-lang.c (opencl_language_data): Likewise.
+ * p-lang.c (pascal_language_data): Delete la_printchar
+ initializer.
+ (pascal_language::printchar): New member function.
+ * rust-lang.c (rust_printchar): Rename to
+ rust_language::printchar.
+ (rust_language_data): Delete la_printchar initializer.
+ (rust_language::printchar): New member function, implementation
+ from rust_printchar.
+
2020-06-23 Andrew Burgess <andrew.burgess@embecosm.com>
* ada-lang.c (emit_char): Renamed to ada_language::emitchar.
macro_expansion_no,
ada_extensions,
&ada_exp_descriptor,
- ada_printchar, /* Print a character constant */
ada_printstr, /* Function to print string constant */
ada_print_typedef, /* Print a typedef using appropriate syntax */
NULL, /* name_of_this */
ada_emit_char (ch, chtype, stream, quoter, 1);
}
+ /* See language.h. */
+
+ void printchar (int ch, struct type *chtype,
+ struct ui_file *stream) const override
+ {
+ ada_printchar (ch, chtype, stream);
+ }
+
protected:
/* See language.h. */
macro_expansion_c,
c_extensions,
&exp_descriptor_c,
- c_printchar, /* Print a character constant */
c_printstr, /* Function to print string constant */
c_print_typedef, /* Print a typedef using appropriate syntax */
NULL, /* name_of_this */
macro_expansion_c,
cplus_extensions,
&exp_descriptor_c,
- c_printchar, /* Print a character constant */
c_printstr, /* Function to print string constant */
c_print_typedef, /* Print a typedef using appropriate syntax */
"this", /* name_of_this */
macro_expansion_c,
asm_extensions,
&exp_descriptor_c,
- c_printchar, /* Print a character constant */
c_printstr, /* Function to print string constant */
c_print_typedef, /* Print a typedef using appropriate syntax */
NULL, /* name_of_this */
macro_expansion_c,
NULL,
&exp_descriptor_c,
- c_printchar, /* Print a character constant */
c_printstr, /* Function to print string constant */
c_print_typedef, /* Print a typedef using appropriate syntax */
NULL, /* name_of_this */
macro_expansion_no,
d_extensions,
&exp_descriptor_c,
- c_printchar, /* Print a character constant. */
c_printstr, /* Function to print string constant. */
c_print_typedef, /* Print a typedef using appropriate
syntax. */
/* Local functions */
-static void f_printchar (int c, struct type *type, struct ui_file * stream);
-
/* Return the encoding that should be used for the character type
TYPE. */
return encoding;
}
-/* Implementation of la_printchar. */
-
-static void
-f_printchar (int c, struct type *type, struct ui_file *stream)
-{
- fputs_filtered ("'", stream);
- LA_EMIT_CHAR (c, type, stream, '\'');
- fputs_filtered ("'", stream);
-}
-
/* Print the character string STRING, printing at most LENGTH characters.
Printing stops early if the number hits print_max; repeat counts
are printed as appropriate. Print ellipses at the end if we
macro_expansion_no,
f_extensions,
&exp_descriptor_f,
- f_printchar, /* Print character constant */
f_printstr, /* function to print string constant */
f_print_typedef, /* Print a typedef using appropriate syntax */
NULL, /* name_of_this */
generic_emit_char (ch, chtype, stream, quoter, encoding);
}
+ /* See language.h. */
+
+ void printchar (int ch, struct type *chtype,
+ struct ui_file *stream) const override
+ {
+ fputs_filtered ("'", stream);
+ LA_EMIT_CHAR (ch, chtype, stream, '\'');
+ fputs_filtered ("'", stream);
+ }
+
protected:
/* See language.h. */
macro_expansion_no,
NULL,
&exp_descriptor_c,
- c_printchar, /* Print a character constant. */
c_printstr, /* Function to print string constant. */
c_print_typedef, /* Print a typedef using appropriate
syntax. */
static void set_range_case (void);
-static void unk_lang_printchar (int c, struct type *type,
- struct ui_file *stream);
-
/* The current (default at startup) state of type and range checking.
(If the modes are set to "auto", though, these are changed based
on the default language at startup, and then again based on the
c_emit_char (ch, chtype, stream, quoter);
}
+/* See language.h. */
+
+void
+language_defn::printchar (int ch, struct type *chtype,
+ struct ui_file * stream) const
+{
+ c_printchar (ch, chtype, stream);
+}
+
/* 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);
}
-static void
-unk_lang_printchar (int c, struct type *type, struct ui_file *stream)
-{
- error (_("internal error - unimplemented "
- "function unk_lang_printchar called."));
-}
-
static void
unk_lang_printstr (struct ui_file *stream, struct type *type,
const gdb_byte *string, unsigned int length,
macro_expansion_no,
NULL,
&exp_descriptor_standard,
- unk_lang_printchar, /* Print character constant */
unk_lang_printstr,
default_print_typedef, /* Print a typedef using appropriate syntax */
"this", /* name_of_this */
{
error (_("unimplemented unknown_language::emitchar called"));
}
+
+ /* See language.h. */
+
+ void printchar (int ch, struct type *chtype,
+ struct ui_file *stream) const override
+ {
+ error (_("unimplemented unknown_language::printchar called"));
+ }
};
/* Single instance of the unknown language class. */
macro_expansion_no,
NULL,
&exp_descriptor_standard,
- unk_lang_printchar, /* Print character constant */
unk_lang_printstr,
default_print_typedef, /* Print a typedef using appropriate syntax */
"this", /* name_of_this */
{
error (_("unimplemented auto_language::emitchar called"));
}
+
+ /* See language.h. */
+
+ void printchar (int ch, struct type *chtype,
+ struct ui_file *stream) const override
+ {
+ error (_("unimplemented auto_language::printchar called"));
+ }
};
/* Single instance of the fake "auto" language. */
const struct exp_descriptor *la_exp_desc;
- void (*la_printchar) (int ch, struct type *chtype,
- struct ui_file * stream);
-
void (*la_printstr) (struct ui_file * stream, struct type *elttype,
const gdb_byte *string, unsigned int length,
const char *encoding, int force_ellipses,
virtual void emitchar (int ch, struct type *chtype,
struct ui_file *stream, int quoter) const;
+ virtual void printchar (int ch, struct type *chtype,
+ struct ui_file * stream) const;
+
protected:
/* This is the overridable part of the GET_SYMBOL_NAME_MATCHER method.
(current_language->value_print (val,stream,options))
#define LA_PRINT_CHAR(ch, type, stream) \
- (current_language->la_printchar(ch, type, stream))
+ (current_language->printchar (ch, type, stream))
#define LA_PRINT_STRING(stream, elttype, string, length, encoding, force_ellipses, options) \
(current_language->la_printstr(stream, elttype, string, length, \
encoding, force_ellipses,options))
macro_expansion_no,
NULL,
&exp_descriptor_modula2,
- m2_printchar, /* Print character constant */
m2_printstr, /* function to print string constant */
m2_print_typedef, /* Print a typedef using appropriate syntax */
NULL, /* name_of_this */
}
}
}
+
+ /* See language.h. */
+
+ void printchar (int ch, struct type *chtype,
+ struct ui_file *stream) const override
+ {
+ m2_printchar (ch, chtype, stream);
+ }
};
/* Single instance of the M2 language. */
macro_expansion_c,
objc_extensions,
&exp_descriptor_standard,
- c_printchar, /* Print a character constant */
c_printstr, /* Function to print string constant */
c_print_typedef, /* Print a typedef using appropriate syntax */
"self", /* name_of_this */
macro_expansion_c,
NULL,
&exp_descriptor_opencl,
- c_printchar, /* Print a character constant */
c_printstr, /* Function to print string constant */
c_print_typedef, /* Print a typedef using appropriate syntax */
NULL, /* name_of_this */
macro_expansion_no,
p_extensions,
&exp_descriptor_standard,
- pascal_printchar, /* Print a character constant */
pascal_printstr, /* Function to print string constant */
pascal_print_typedef, /* Print a typedef using appropriate syntax */
"this", /* name_of_this */
if (in_quotes)
fputs_filtered ("'", stream);
}
+
+ /* See language.h. */
+
+ void printchar (int ch, struct type *chtype,
+ struct ui_file *stream) const override
+ {
+ pascal_printchar (ch, chtype, stream);
+ }
+
};
/* Single instance of the Pascal language class. */
\f
-/* la_printchar implementation for Rust. */
-
-static void
-rust_printchar (int c, struct type *type, struct ui_file *stream)
-{
- fputs_filtered ("'", stream);
- LA_EMIT_CHAR (c, type, stream, '\'');
- fputs_filtered ("'", stream);
-}
-
/* la_printstr implementation for Rust. */
static void
macro_expansion_no,
rust_extensions,
&exp_descriptor_rust,
- rust_printchar, /* Print a character constant */
rust_printstr, /* Function to print string constant */
rust_print_typedef, /* Print a typedef using appropriate syntax */
NULL, /* name_of_this */
else
fprintf_filtered (stream, "\\u{%06x}", ch);
}
+
+ /* See language.h. */
+
+ void printchar (int ch, struct type *chtype,
+ struct ui_file *stream) const override
+ {
+ fputs_filtered ("'", stream);
+ LA_EMIT_CHAR (ch, chtype, stream, '\'');
+ fputs_filtered ("'", stream);
+ }
};
/* Single instance of the Rust language class. */