aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Burgess <andrew.burgess@embecosm.com>2020-09-16 16:27:30 +0100
committerAndrew Burgess <andrew.burgess@embecosm.com>2020-10-23 10:57:14 +0100
commit1a0ea39913588b4e7ae47e384683784314fca8fe (patch)
treeeaacbc454afff822ae1f7495b6bc16532ce2de90
parent88cefd9be076ea1f66b933be484d82f200b0f6c3 (diff)
downloadbinutils-1a0ea39913588b4e7ae47e384683784314fca8fe.zip
binutils-1a0ea39913588b4e7ae47e384683784314fca8fe.tar.gz
binutils-1a0ea39913588b4e7ae47e384683784314fca8fe.tar.bz2
gdb: move f_language class into a header file
Moves the f_language class from f-lang.c into f-lang.h. The benefit of this is that functions declared in other f-*.c files can become member functions without having to go through a level of indirection. Some additional support functions have now become private member functions of the f_language class, these are mostly functions that then called some other function that was itself a member of the language_defn class hierarchy. There should be no user visible changes after this commit. gdb/ChangeLog: * f-exp.y (f_parse): Rename to... (f_language::parser): ...this. * f-lang.c (f_get_encoding): Rename to... (f_language::get_encoding): ...this. (f_op_print_tab): Rename to... (f_language::op_print_tab): ...this. (exp_descriptor_f): Rename to... (f_language::exp_descriptor_tab): ...this. (class f_language): Moved to f-lang.h. (f_language::language_arch_info): New function, moved out of class declaration. (f_language::search_name_hash): Likewise. (f_language::lookup_symbol_nonlocal): Likewise. (f_language::get_symbol_name_matcher_inner): Likewise. * f-lang.h: Add 'valprint.h' include. (class f_language): Moved here from f-lang.c. * f-typeprint.c (f_type_print_args): Delete commented out declaration. (f_print_typedef): Rename to... (f_language::print_typedef): ...this. (f_print_type): Rename to... (f_language::print_type): ...this. (f_type_print_varspec_prefix): Delete declaration and rename to... (f_language::f_type_print_varspec_prefix): ...this. (f_type_print_varspec_suffix): Delete declaration and rename to... (f_language::f_type_print_varspec_suffix): ...this. (f_type_print_base): Delete declaration and rename to... (f_language::f_type_print_base): ...this. * f-valprint.c (f_value_print_inner): Rename to... (f_language::value_print_inner): ...this. * parse.c: Delete 'f-lang.h' include.
-rw-r--r--gdb/ChangeLog34
-rw-r--r--gdb/f-exp.y2
-rw-r--r--gdb/f-lang.c320
-rw-r--r--gdb/f-lang.h272
-rw-r--r--gdb/f-typeprint.c82
-rw-r--r--gdb/f-valprint.c5
-rw-r--r--gdb/parse.c1
7 files changed, 387 insertions, 329 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 6b870f5..398d9a7 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,39 @@
2020-10-23 Andrew Burgess <andrew.burgess@embecosm.com>
+ * f-exp.y (f_parse): Rename to...
+ (f_language::parser): ...this.
+ * f-lang.c (f_get_encoding): Rename to...
+ (f_language::get_encoding): ...this.
+ (f_op_print_tab): Rename to...
+ (f_language::op_print_tab): ...this.
+ (exp_descriptor_f): Rename to...
+ (f_language::exp_descriptor_tab): ...this.
+ (class f_language): Moved to f-lang.h.
+ (f_language::language_arch_info): New function, moved out of class
+ declaration.
+ (f_language::search_name_hash): Likewise.
+ (f_language::lookup_symbol_nonlocal): Likewise.
+ (f_language::get_symbol_name_matcher_inner): Likewise.
+ * f-lang.h: Add 'valprint.h' include.
+ (class f_language): Moved here from f-lang.c.
+ * f-typeprint.c (f_type_print_args): Delete commented out
+ declaration.
+ (f_print_typedef): Rename to...
+ (f_language::print_typedef): ...this.
+ (f_print_type): Rename to...
+ (f_language::print_type): ...this.
+ (f_type_print_varspec_prefix): Delete declaration and rename to...
+ (f_language::f_type_print_varspec_prefix): ...this.
+ (f_type_print_varspec_suffix): Delete declaration and rename to...
+ (f_language::f_type_print_varspec_suffix): ...this.
+ (f_type_print_base): Delete declaration and rename to...
+ (f_language::f_type_print_base): ...this.
+ * f-valprint.c (f_value_print_inner): Rename to...
+ (f_language::value_print_inner): ...this.
+ * parse.c: Delete 'f-lang.h' include.
+
+2020-10-23 Andrew Burgess <andrew.burgess@embecosm.com>
+
* language.h (language_defn::print_type): Add variable names in
declaration, and update header comment.
diff --git a/gdb/f-exp.y b/gdb/f-exp.y
index eaa7214..6c1c1fa 100644
--- a/gdb/f-exp.y
+++ b/gdb/f-exp.y
@@ -1383,7 +1383,7 @@ yylex (void)
}
int
-f_parse (struct parser_state *par_state)
+f_language::parser (struct parser_state *par_state) const
{
/* Setting up the parser state. */
scoped_restore pstate_restore = make_scoped_restore (&pstate);
diff --git a/gdb/f-lang.c b/gdb/f-lang.c
index 9089166..5249374 100644
--- a/gdb/f-lang.c
+++ b/gdb/f-lang.c
@@ -44,8 +44,8 @@
/* Return the encoding that should be used for the character type
TYPE. */
-static const char *
-f_get_encoding (struct type *type)
+const char *
+f_language::get_encoding (struct type *type)
{
const char *encoding;
@@ -72,7 +72,7 @@ f_get_encoding (struct type *type)
/* Table of operators and their precedences for printing expressions. */
-static const struct op_print f_op_print_tab[] =
+const struct op_print f_language::op_print_tab[] =
{
{"+", BINOP_ADD, PREC_ADD, 0},
{"+", UNOP_PLUS, PREC_PREFIX, 0},
@@ -701,7 +701,7 @@ operator_check_f (struct expression *exp, int pos,
}
/* Expression processing for Fortran. */
-static const struct exp_descriptor exp_descriptor_f =
+const struct exp_descriptor f_language::exp_descriptor_tab =
{
print_subexp_f,
operator_length_f,
@@ -711,268 +711,72 @@ static const struct exp_descriptor exp_descriptor_f =
evaluate_subexp_f
};
-/* Class representing the Fortran language. */
+/* See language.h. */
-class f_language : public language_defn
+void
+f_language::language_arch_info (struct gdbarch *gdbarch,
+ struct language_arch_info *lai) const
{
-public:
- f_language ()
- : language_defn (language_fortran)
- { /* Nothing. */ }
-
- /* See language.h. */
-
- const char *name () const override
- { return "fortran"; }
-
- /* See language.h. */
-
- const char *natural_name () const override
- { return "Fortran"; }
-
- /* See language.h. */
-
- const std::vector<const char *> &filename_extensions () const override
- {
- static const std::vector<const char *> extensions = {
- ".f", ".F", ".for", ".FOR", ".ftn", ".FTN", ".fpp", ".FPP",
- ".f90", ".F90", ".f95", ".F95", ".f03", ".F03", ".f08", ".F08"
- };
- return extensions;
- }
-
- /* See language.h. */
- void language_arch_info (struct gdbarch *gdbarch,
- struct language_arch_info *lai) const override
- {
- const struct builtin_f_type *builtin = builtin_f_type (gdbarch);
-
- lai->string_char_type = builtin->builtin_character;
- lai->primitive_type_vector
- = GDBARCH_OBSTACK_CALLOC (gdbarch, nr_f_primitive_types + 1,
- struct type *);
-
- lai->primitive_type_vector [f_primitive_type_character]
- = builtin->builtin_character;
- lai->primitive_type_vector [f_primitive_type_logical]
- = builtin->builtin_logical;
- lai->primitive_type_vector [f_primitive_type_logical_s1]
- = builtin->builtin_logical_s1;
- lai->primitive_type_vector [f_primitive_type_logical_s2]
- = builtin->builtin_logical_s2;
- lai->primitive_type_vector [f_primitive_type_logical_s8]
- = builtin->builtin_logical_s8;
- lai->primitive_type_vector [f_primitive_type_real]
- = builtin->builtin_real;
- lai->primitive_type_vector [f_primitive_type_real_s8]
- = builtin->builtin_real_s8;
- lai->primitive_type_vector [f_primitive_type_real_s16]
- = builtin->builtin_real_s16;
- lai->primitive_type_vector [f_primitive_type_complex_s8]
- = builtin->builtin_complex_s8;
- lai->primitive_type_vector [f_primitive_type_complex_s16]
- = builtin->builtin_complex_s16;
- lai->primitive_type_vector [f_primitive_type_void]
- = builtin->builtin_void;
-
- lai->bool_type_symbol = "logical";
- lai->bool_type_default = builtin->builtin_logical_s2;
- }
-
- /* See language.h. */
- unsigned int search_name_hash (const char *name) const override
- {
- return cp_search_name_hash (name);
- }
-
- /* See language.h. */
-
- char *demangle_symbol (const char *mangled, int options) const override
- {
- /* We could support demangling here to provide module namespaces
- also for inferiors with only minimal symbol table (ELF symbols).
- Just the mangling standard is not standardized across compilers
- and there is no DW_AT_producer available for inferiors with only
- the ELF symbols to check the mangling kind. */
- return nullptr;
- }
-
- /* See language.h. */
-
- void print_type (struct type *type, const char *varstring,
- struct ui_file *stream, int show, int level,
- const struct type_print_options *flags) const override
- {
- f_print_type (type, varstring, stream, show, level, flags);
- }
-
- /* See language.h. This just returns default set of word break
- characters but with the modules separator `::' removed. */
-
- const char *word_break_characters (void) const override
- {
- static char *retval;
-
- if (!retval)
- {
- char *s;
-
- retval = xstrdup (language_defn::word_break_characters ());
- s = strchr (retval, ':');
- if (s)
- {
- char *last_char = &s[strlen (s) - 1];
-
- *s = *last_char;
- *last_char = 0;
- }
- }
- return retval;
- }
-
-
- /* See language.h. */
-
- void collect_symbol_completion_matches (completion_tracker &tracker,
- complete_symbol_mode mode,
- symbol_name_match_type name_match_type,
- const char *text, const char *word,
- enum type_code code) const override
- {
- /* Consider the modules separator :: as a valid symbol name character
- class. */
- default_collect_symbol_completion_matches_break_on (tracker, mode,
- name_match_type,
- text, word, ":",
- 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);
- }
-
- /* See language.h. */
-
- struct block_symbol lookup_symbol_nonlocal
- (const char *name, const struct block *block,
- const domain_enum domain) const override
- {
- return cp_lookup_symbol_nonlocal (this, name, block, domain);
- }
-
- /* See language.h. */
-
- int parser (struct parser_state *ps) const override
- {
- 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);
- }
-
- /* 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);
- }
-
- /* See language.h. */
-
- void printstr (struct ui_file *stream, struct type *elttype,
- const gdb_byte *string, unsigned int length,
- const char *encoding, int force_ellipses,
- const struct value_print_options *options) const override
- {
- const char *type_encoding = f_get_encoding (elttype);
-
- if (TYPE_LENGTH (elttype) == 4)
- fputs_filtered ("4_", stream);
-
- if (!encoding || !*encoding)
- encoding = type_encoding;
-
- generic_printstr (stream, elttype, string, length, encoding,
- force_ellipses, '\'', 0, options);
- }
-
- /* See language.h. */
-
- void print_typedef (struct type *type, struct symbol *new_symbol,
- struct ui_file *stream) const override
- {
- f_print_typedef (type, new_symbol, stream);
- }
-
- /* See language.h. */
-
- bool is_string_type_p (struct type *type) const override
- {
- type = check_typedef (type);
- return (type->code () == TYPE_CODE_STRING
- || (type->code () == TYPE_CODE_ARRAY
- && TYPE_TARGET_TYPE (type)->code () == TYPE_CODE_CHAR));
- }
-
- /* See language.h. */
-
- const char *struct_too_deep_ellipsis () const override
- { return "(...)"; }
-
- /* See language.h. */
-
- bool c_style_arrays_p () const override
- { return false; }
-
- /* See language.h. */
-
- bool range_checking_on_by_default () const override
- { return true; }
-
- /* See language.h. */
-
- enum case_sensitivity case_sensitivity () const override
- { return case_sensitive_off; }
-
- /* See language.h. */
-
- enum array_ordering array_ordering () const override
- { return array_column_major; }
-
- /* See language.h. */
+ const struct builtin_f_type *builtin = builtin_f_type (gdbarch);
+
+ lai->string_char_type = builtin->builtin_character;
+ lai->primitive_type_vector
+ = GDBARCH_OBSTACK_CALLOC (gdbarch, nr_f_primitive_types + 1,
+ struct type *);
+
+ lai->primitive_type_vector [f_primitive_type_character]
+ = builtin->builtin_character;
+ lai->primitive_type_vector [f_primitive_type_logical]
+ = builtin->builtin_logical;
+ lai->primitive_type_vector [f_primitive_type_logical_s1]
+ = builtin->builtin_logical_s1;
+ lai->primitive_type_vector [f_primitive_type_logical_s2]
+ = builtin->builtin_logical_s2;
+ lai->primitive_type_vector [f_primitive_type_logical_s8]
+ = builtin->builtin_logical_s8;
+ lai->primitive_type_vector [f_primitive_type_real]
+ = builtin->builtin_real;
+ lai->primitive_type_vector [f_primitive_type_real_s8]
+ = builtin->builtin_real_s8;
+ lai->primitive_type_vector [f_primitive_type_real_s16]
+ = builtin->builtin_real_s16;
+ lai->primitive_type_vector [f_primitive_type_complex_s8]
+ = builtin->builtin_complex_s8;
+ lai->primitive_type_vector [f_primitive_type_complex_s16]
+ = builtin->builtin_complex_s16;
+ lai->primitive_type_vector [f_primitive_type_void]
+ = builtin->builtin_void;
+
+ lai->bool_type_symbol = "logical";
+ lai->bool_type_default = builtin->builtin_logical_s2;
+}
- const struct exp_descriptor *expression_ops () const override
- { return &exp_descriptor_f; }
+/* See language.h. */
- /* See language.h. */
+unsigned int
+f_language::search_name_hash (const char *name) const
+{
+ return cp_search_name_hash (name);
+}
- const struct op_print *opcode_print_table () const override
- { return f_op_print_tab; }
+/* See language.h. */
-protected:
+struct block_symbol
+f_language::lookup_symbol_nonlocal (const char *name,
+ const struct block *block,
+ const domain_enum domain) const
+{
+ return cp_lookup_symbol_nonlocal (this, name, block, domain);
+}
- /* See language.h. */
+/* See language.h. */
- symbol_name_matcher_ftype *get_symbol_name_matcher_inner
- (const lookup_name_info &lookup_name) const override
- {
- return cp_get_symbol_name_matcher (lookup_name);
- }
-};
+symbol_name_matcher_ftype *
+f_language::get_symbol_name_matcher_inner
+ (const lookup_name_info &lookup_name) const
+{
+ return cp_get_symbol_name_matcher (lookup_name);
+}
/* Single instance of the Fortran language class. */
diff --git a/gdb/f-lang.h b/gdb/f-lang.h
index 4710b14..e59fdef 100644
--- a/gdb/f-lang.h
+++ b/gdb/f-lang.h
@@ -23,24 +23,276 @@
#ifndef F_LANG_H
#define F_LANG_H
+#include "valprint.h"
+
struct type_print_options;
struct parser_state;
-extern int f_parse (struct parser_state *);
+/* Class representing the Fortran language. */
+
+class f_language : public language_defn
+{
+public:
+ f_language ()
+ : language_defn (language_fortran)
+ { /* Nothing. */ }
+
+ /* See language.h. */
+
+ const char *name () const override
+ { return "fortran"; }
+
+ /* See language.h. */
+
+ const char *natural_name () const override
+ { return "Fortran"; }
+
+ /* See language.h. */
+
+ const std::vector<const char *> &filename_extensions () const override
+ {
+ static const std::vector<const char *> extensions = {
+ ".f", ".F", ".for", ".FOR", ".ftn", ".FTN", ".fpp", ".FPP",
+ ".f90", ".F90", ".f95", ".F95", ".f03", ".F03", ".f08", ".F08"
+ };
+ return extensions;
+ }
+
+ /* See language.h. */
+ void language_arch_info (struct gdbarch *gdbarch,
+ struct language_arch_info *lai) const override;
+
+ /* See language.h. */
+ unsigned int search_name_hash (const char *name) const override;
+
+ /* See language.h. */
+
+ char *demangle_symbol (const char *mangled, int options) const override
+ {
+ /* We could support demangling here to provide module namespaces
+ also for inferiors with only minimal symbol table (ELF symbols).
+ Just the mangling standard is not standardized across compilers
+ and there is no DW_AT_producer available for inferiors with only
+ the ELF symbols to check the mangling kind. */
+ return nullptr;
+ }
+
+ /* See language.h. */
+
+ void print_type (struct type *type, const char *varstring,
+ struct ui_file *stream, int show, int level,
+ const struct type_print_options *flags) const override;
+
+ /* See language.h. This just returns default set of word break
+ characters but with the modules separator `::' removed. */
+
+ const char *word_break_characters (void) const override
+ {
+ static char *retval;
+
+ if (!retval)
+ {
+ char *s;
+
+ retval = xstrdup (language_defn::word_break_characters ());
+ s = strchr (retval, ':');
+ if (s)
+ {
+ char *last_char = &s[strlen (s) - 1];
+
+ *s = *last_char;
+ *last_char = 0;
+ }
+ }
+ return retval;
+ }
+
+
+ /* See language.h. */
+
+ void collect_symbol_completion_matches (completion_tracker &tracker,
+ complete_symbol_mode mode,
+ symbol_name_match_type name_match_type,
+ const char *text, const char *word,
+ enum type_code code) const override
+ {
+ /* Consider the modules separator :: as a valid symbol name character
+ class. */
+ default_collect_symbol_completion_matches_break_on (tracker, mode,
+ name_match_type,
+ text, word, ":",
+ 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;
+
+ /* See language.h. */
+
+ struct block_symbol lookup_symbol_nonlocal
+ (const char *name, const struct block *block,
+ const domain_enum domain) const override;
+
+ /* See language.h. */
+
+ int parser (struct parser_state *ps) const override;
+
+ /* See language.h. */
+
+ void emitchar (int ch, struct type *chtype,
+ struct ui_file *stream, int quoter) const override
+ {
+ const char *encoding = get_encoding (chtype);
+ 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);
+ }
+
+ /* See language.h. */
+
+ void printstr (struct ui_file *stream, struct type *elttype,
+ const gdb_byte *string, unsigned int length,
+ const char *encoding, int force_ellipses,
+ const struct value_print_options *options) const override
+ {
+ const char *type_encoding = get_encoding (elttype);
+
+ if (TYPE_LENGTH (elttype) == 4)
+ fputs_filtered ("4_", stream);
+
+ if (!encoding || !*encoding)
+ encoding = type_encoding;
+
+ generic_printstr (stream, elttype, string, length, encoding,
+ force_ellipses, '\'', 0, options);
+ }
-/* Implement the la_print_typedef language method for Fortran. */
+ /* See language.h. */
-extern void f_print_typedef (struct type *type, struct symbol *new_symbol,
- struct ui_file *stream);
+ void print_typedef (struct type *type, struct symbol *new_symbol,
+ struct ui_file *stream) const override;
-extern void f_print_type (struct type *, const char *, struct ui_file *, int,
- int, const struct type_print_options *);
+ /* See language.h. */
-/* Implement la_value_print_inner for Fortran. */
+ bool is_string_type_p (struct type *type) const override
+ {
+ type = check_typedef (type);
+ return (type->code () == TYPE_CODE_STRING
+ || (type->code () == TYPE_CODE_ARRAY
+ && TYPE_TARGET_TYPE (type)->code () == TYPE_CODE_CHAR));
+ }
-extern void f_value_print_inner (struct value *val, struct ui_file *stream,
- int recurse,
- const struct value_print_options *options);
+ /* See language.h. */
+
+ const char *struct_too_deep_ellipsis () const override
+ { return "(...)"; }
+
+ /* See language.h. */
+
+ bool c_style_arrays_p () const override
+ { return false; }
+
+ /* See language.h. */
+
+ bool range_checking_on_by_default () const override
+ { return true; }
+
+ /* See language.h. */
+
+ enum case_sensitivity case_sensitivity () const override
+ { return case_sensitive_off; }
+
+ /* See language.h. */
+
+ enum array_ordering array_ordering () const override
+ { return array_column_major; }
+
+ /* See language.h. */
+
+ const struct exp_descriptor *expression_ops () const override
+ { return &exp_descriptor_tab; }
+
+ /* See language.h. */
+
+ const struct op_print *opcode_print_table () const override
+ { return op_print_tab; }
+
+protected:
+
+ /* See language.h. */
+
+ symbol_name_matcher_ftype *get_symbol_name_matcher_inner
+ (const lookup_name_info &lookup_name) const override;
+
+private:
+ /* Table of expression handling functions for use by EXPRESSION_OPS
+ member function. */
+
+ static const struct exp_descriptor exp_descriptor_tab;
+
+ /* Table of opcode data for use by OPCODE_PRINT_TABLE member function. */
+
+ static const struct op_print op_print_tab[];
+
+ /* Return the encoding that should be used for the character type
+ TYPE. */
+
+ static const char *get_encoding (struct type *type);
+
+ /* Print any asterisks or open-parentheses needed before the variable
+ name (to describe its type).
+
+ On outermost call, pass 0 for PASSED_A_PTR.
+ On outermost call, SHOW > 0 means should ignore
+ any typename for TYPE and show its details.
+ SHOW is always zero on recursive calls. */
+
+ void f_type_print_varspec_prefix (struct type *type,
+ struct ui_file * stream,
+ int show, int passed_a_ptr) const;
+
+ /* Print any array sizes, function arguments or close parentheses needed
+ after the variable name (to describe its type). Args work like
+ c_type_print_varspec_prefix.
+
+ PRINT_RANK_ONLY is true when TYPE is an array which should be printed
+ without the upper and lower bounds being specified, this will occur
+ when the array is not allocated or not associated and so there are no
+ known upper or lower bounds. */
+
+ void f_type_print_varspec_suffix (struct type *type,
+ struct ui_file *stream,
+ int show, int passed_a_ptr,
+ int demangled_args,
+ int arrayprint_recurse_level,
+ bool print_rank_only) const;
+
+ /* Print the name of the type (or the ultimate pointer target, function
+ value or array element), or the description of a structure or union.
+
+ SHOW nonzero means don't print this type as just its name;
+ show its real definition even if it has a name.
+ SHOW zero means print just typename or struct tag if there is one
+ SHOW negative means abbreviate structure elements.
+ SHOW is decremented for printing of structure elements.
+
+ LEVEL is the depth to indent by. We increase it for some recursive
+ calls. */
+
+ void f_type_print_base (struct type *type, struct ui_file *stream, int show,
+ int level) const;
+};
/* Language-specific data structures */
diff --git a/gdb/f-typeprint.c b/gdb/f-typeprint.c
index 577ed3b..0e8bbd6 100644
--- a/gdb/f-typeprint.c
+++ b/gdb/f-typeprint.c
@@ -33,34 +33,22 @@
#include "typeprint.h"
#include "cli/cli-style.h"
-#if 0 /* Currently unused. */
-static void f_type_print_args (struct type *, struct ui_file *);
-#endif
-
-static void f_type_print_varspec_suffix (struct type *, struct ui_file *, int,
- int, int, int, bool);
-
-void f_type_print_varspec_prefix (struct type *, struct ui_file *,
- int, int);
-
-void f_type_print_base (struct type *, struct ui_file *, int, int);
-
-
-/* See documentation in f-lang.h. */
+/* See f-lang.h. */
void
-f_print_typedef (struct type *type, struct symbol *new_symbol,
- struct ui_file *stream)
+f_language::print_typedef (struct type *type, struct symbol *new_symbol,
+ struct ui_file *stream) const
{
type = check_typedef (type);
- f_print_type (type, "", stream, 0, 0, &type_print_raw_options);
+ print_type (type, "", stream, 0, 0, &type_print_raw_options);
}
-/* LEVEL is the depth to indent lines by. */
+/* See f-lang.h. */
void
-f_print_type (struct type *type, const char *varstring, struct ui_file *stream,
- int show, int level, const struct type_print_options *flags)
+f_language::print_type (struct type *type, const char *varstring,
+ struct ui_file *stream, int show, int level,
+ const struct type_print_options *flags) const
{
enum type_code code;
@@ -99,17 +87,12 @@ f_print_type (struct type *type, const char *varstring, struct ui_file *stream,
}
}
-/* Print any asterisks or open-parentheses needed before the
- variable name (to describe its type).
-
- On outermost call, pass 0 for PASSED_A_PTR.
- On outermost call, SHOW > 0 means should ignore
- any typename for TYPE and show its details.
- SHOW is always zero on recursive calls. */
+/* See f-lang.h. */
void
-f_type_print_varspec_prefix (struct type *type, struct ui_file *stream,
- int show, int passed_a_ptr)
+f_language::f_type_print_varspec_prefix (struct type *type,
+ struct ui_file *stream,
+ int show, int passed_a_ptr) const
{
if (type == 0)
return;
@@ -158,19 +141,15 @@ f_type_print_varspec_prefix (struct type *type, struct ui_file *stream,
}
}
-/* Print any array sizes, function arguments or close parentheses
- needed after the variable name (to describe its type).
- Args work like c_type_print_varspec_prefix.
+/* See f-lang.h. */
- PRINT_RANK_ONLY is true when TYPE is an array which should be printed
- without the upper and lower bounds being specified, this will occur
- when the array is not allocated or not associated and so there are no
- known upper or lower bounds. */
-
-static void
-f_type_print_varspec_suffix (struct type *type, struct ui_file *stream,
- int show, int passed_a_ptr, int demangled_args,
- int arrayprint_recurse_level, bool print_rank_only)
+void
+f_language::f_type_print_varspec_suffix (struct type *type,
+ struct ui_file *stream,
+ int show, int passed_a_ptr,
+ int demangled_args,
+ int arrayprint_recurse_level,
+ bool print_rank_only) const
{
/* No static variables are permitted as an error call may occur during
execution of this function. */
@@ -263,7 +242,7 @@ f_type_print_varspec_suffix (struct type *type, struct ui_file *stream,
fprintf_filtered (stream, ") ");
fprintf_filtered (stream, "(");
if (nfields == 0 && type->is_prototyped ())
- f_print_type (builtin_f_type (get_type_arch (type))->builtin_void,
+ print_type (builtin_f_type (get_type_arch (type))->builtin_void,
"", stream, -1, 0, 0);
else
for (i = 0; i < nfields; i++)
@@ -273,7 +252,7 @@ f_type_print_varspec_suffix (struct type *type, struct ui_file *stream,
fputs_filtered (", ", stream);
wrap_here (" ");
}
- f_print_type (type->field (i).type (), "", stream, -1, 0, 0);
+ print_type (type->field (i).type (), "", stream, -1, 0, 0);
}
fprintf_filtered (stream, ")");
}
@@ -301,22 +280,11 @@ f_type_print_varspec_suffix (struct type *type, struct ui_file *stream,
}
}
-/* Print the name of the type (or the ultimate pointer target,
- function value or array element), or the description of a
- structure or union.
-
- SHOW nonzero means don't print this type as just its name;
- show its real definition even if it has a name.
- SHOW zero means print just typename or struct tag if there is one
- SHOW negative means abbreviate structure elements.
- SHOW is decremented for printing of structure elements.
-
- LEVEL is the depth to indent by.
- We increase it for some recursive calls. */
+/* See f-lang.h. */
void
-f_type_print_base (struct type *type, struct ui_file *stream, int show,
- int level)
+f_language::f_type_print_base (struct type *type, struct ui_file *stream,
+ int show, int level) const
{
int index;
diff --git a/gdb/f-valprint.c b/gdb/f-valprint.c
index e7dc20d..95630a7 100644
--- a/gdb/f-valprint.c
+++ b/gdb/f-valprint.c
@@ -214,8 +214,9 @@ static const struct generic_val_print_decorations f_decorations =
/* See f-lang.h. */
void
-f_value_print_inner (struct value *val, struct ui_file *stream, int recurse,
- const struct value_print_options *options)
+f_language::value_print_inner (struct value *val, struct ui_file *stream,
+ int recurse,
+ const struct value_print_options *options) const
{
struct type *type = check_typedef (value_type (val));
struct gdbarch *gdbarch = get_type_arch (type);
diff --git a/gdb/parse.c b/gdb/parse.c
index 359ab62..ccdbdeb 100644
--- a/gdb/parse.c
+++ b/gdb/parse.c
@@ -39,7 +39,6 @@
#include "value.h"
#include "command.h"
#include "language.h"
-#include "f-lang.h"
#include "parser-defs.h"
#include "gdbcmd.h"
#include "symfile.h" /* for overlay functions */