From 4753d33b404f07e749f648c57ae61e3984d40029 Mon Sep 17 00:00:00 2001 From: Doug Evans Date: Thu, 6 Nov 2014 17:19:06 -0800 Subject: [PATCH] Delete TYPE_CODE_CLASS, it's just an alias of TYPE_CODE_STRUCT. gdb/ChangeLog: * gdbtypes.h (TYPE_CODE_CLASS): Delete. All uses changed to use TYPE_CODE_STRUCT. --- gdb/c-exp.y | 4 ++-- gdb/c-valprint.c | 4 ++-- gdb/cp-support.c | 4 ++-- gdb/d-exp.y | 4 ++-- gdb/dwarf2read.c | 2 +- gdb/eval.c | 2 +- gdb/gdbtypes.c | 1 - gdb/gdbtypes.h | 9 --------- gdb/gnu-v2-abi.c | 2 +- gdb/gnu-v3-abi.c | 7 +++---- gdb/guile/scm-type.c | 2 +- gdb/guile/scm-value.c | 4 ++-- gdb/p-exp.y | 4 ++-- gdb/parse.c | 1 - gdb/python/py-type.c | 2 +- gdb/python/py-value.c | 4 ++-- gdb/symtab.c | 1 - gdb/typeprint.c | 4 ++-- gdb/valops.c | 6 +++--- 19 files changed, 27 insertions(+), 40 deletions(-) diff --git a/gdb/c-exp.y b/gdb/c-exp.y index 7339ee8cb7..242c668bb3 100644 --- a/gdb/c-exp.y +++ b/gdb/c-exp.y @@ -1353,12 +1353,12 @@ typebase /* Implements (approximately): (type-qualifier)* type-specifier */ expression_context_block); } | CLASS COMPLETE { - mark_completion_tag (TYPE_CODE_CLASS, "", 0); + mark_completion_tag (TYPE_CODE_STRUCT, "", 0); $$ = NULL; } | CLASS name COMPLETE { - mark_completion_tag (TYPE_CODE_CLASS, $2.ptr, + mark_completion_tag (TYPE_CODE_STRUCT, $2.ptr, $2.length); $$ = NULL; } diff --git a/gdb/c-valprint.c b/gdb/c-valprint.c index 17963f089e..c61e18e925 100644 --- a/gdb/c-valprint.c +++ b/gdb/c-valprint.c @@ -495,7 +495,7 @@ c_value_print (struct value *val, struct ui_file *stream, /* Print nothing. */ } else if (options->objectprint - && (TYPE_CODE (TYPE_TARGET_TYPE (type)) == TYPE_CODE_CLASS)) + && (TYPE_CODE (TYPE_TARGET_TYPE (type)) == TYPE_CODE_STRUCT)) { int is_ref = TYPE_CODE (type) == TYPE_CODE_REF; @@ -545,7 +545,7 @@ c_value_print (struct value *val, struct ui_file *stream, if (!value_initialized (val)) fprintf_filtered (stream, " [uninitialized] "); - if (options->objectprint && (TYPE_CODE (type) == TYPE_CODE_CLASS)) + if (options->objectprint && (TYPE_CODE (type) == TYPE_CODE_STRUCT)) { /* Attempt to determine real type of object. */ real_type = value_rtti_type (val, &full, &top, &using_enc); diff --git a/gdb/cp-support.c b/gdb/cp-support.c index b475491ad6..d35920cf83 100644 --- a/gdb/cp-support.c +++ b/gdb/cp-support.c @@ -1297,7 +1297,7 @@ make_symbol_overload_list_adl_namespace (struct type *type, } /* Check public base type */ - if (TYPE_CODE (type) == TYPE_CODE_CLASS) + if (TYPE_CODE (type) == TYPE_CODE_STRUCT) for (i = 0; i < TYPE_N_BASECLASSES (type); i++) { if (BASETYPE_VIA_PUBLIC (type, i)) @@ -1463,7 +1463,7 @@ cp_lookup_rtti_type (const char *name, struct block *block) switch (TYPE_CODE (rtti_type)) { - case TYPE_CODE_CLASS: + case TYPE_CODE_STRUCT: break; case TYPE_CODE_NAMESPACE: /* chastain/2003-11-26: the symbol tables often contain fake diff --git a/gdb/d-exp.y b/gdb/d-exp.y index cae3419e9a..62348b1eb5 100644 --- a/gdb/d-exp.y +++ b/gdb/d-exp.y @@ -605,10 +605,10 @@ BasicType: { $$ = lookup_struct (copy_name ($2), expression_context_block); } | CLASS_KEYWORD COMPLETE - { mark_completion_tag (TYPE_CODE_CLASS, "", 0); + { mark_completion_tag (TYPE_CODE_STRUCT, "", 0); $$ = NULL; } | CLASS_KEYWORD IdentifierExp COMPLETE - { mark_completion_tag (TYPE_CODE_CLASS, $2.ptr, $2.length); + { mark_completion_tag (TYPE_CODE_STRUCT, $2.ptr, $2.length); $$ = NULL; } | STRUCT_KEYWORD IdentifierExp { $$ = lookup_struct (copy_name ($2), diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c index 3f2a127089..76f62b506e 100644 --- a/gdb/dwarf2read.c +++ b/gdb/dwarf2read.c @@ -12965,7 +12965,7 @@ read_structure_type (struct die_info *die, struct dwarf2_cu *cu) } else { - TYPE_CODE (type) = TYPE_CODE_CLASS; + TYPE_CODE (type) = TYPE_CODE_STRUCT; } if (cu->language == language_cplus && die->tag == DW_TAG_class_type) diff --git a/gdb/eval.c b/gdb/eval.c index ab431c64b7..c49f7b63eb 100644 --- a/gdb/eval.c +++ b/gdb/eval.c @@ -1870,7 +1870,7 @@ evaluate_subexp_standard (struct type *expect_type, get_user_print_options (&opts); if (opts.objectprint && TYPE_TARGET_TYPE(type) - && (TYPE_CODE (TYPE_TARGET_TYPE (type)) == TYPE_CODE_CLASS)) + && (TYPE_CODE (TYPE_TARGET_TYPE (type)) == TYPE_CODE_STRUCT)) { real_type = value_rtti_indirect_type (arg1, &full, &top, &using_enc); diff --git a/gdb/gdbtypes.c b/gdb/gdbtypes.c index ee33d77365..8e44b7c5f2 100644 --- a/gdb/gdbtypes.c +++ b/gdb/gdbtypes.c @@ -3414,7 +3414,6 @@ rank_one_type (struct type *parm, struct type *arg, struct value *value) } break; case TYPE_CODE_STRUCT: - /* currently same as TYPE_CODE_CLASS. */ switch (TYPE_CODE (arg)) { case TYPE_CODE_STRUCT: diff --git a/gdb/gdbtypes.h b/gdb/gdbtypes.h index bd1a0ab2fe..14a1f081ef 100644 --- a/gdb/gdbtypes.h +++ b/gdb/gdbtypes.h @@ -184,15 +184,6 @@ enum type_code TYPE_CODE_XMETHOD }; -/* * For now allow source to use TYPE_CODE_CLASS for C++ classes, as - an alias for TYPE_CODE_STRUCT. This is for DWARF, which has a - distinct "class" attribute. Perhaps we should actually have a - separate TYPE_CODE so that we can print "class" or "struct" - depending on what the debug info said. It's not clear we should - bother. */ - -#define TYPE_CODE_CLASS TYPE_CODE_STRUCT - /* * Some constants representing each bit field in the main_type. See the bit-field-specific macros, below, for documentation of each constant in this enum. These enum values are only used with diff --git a/gdb/gnu-v2-abi.c b/gdb/gnu-v2-abi.c index 2929b896e1..5b73c92df3 100644 --- a/gdb/gnu-v2-abi.c +++ b/gdb/gnu-v2-abi.c @@ -206,7 +206,7 @@ gnuv2_value_rtti_type (struct value *v, int *full, int *top, int *using_enc) known_type = value_type (v); CHECK_TYPEDEF (known_type); /* RTTI works only or class objects. */ - if (TYPE_CODE (known_type) != TYPE_CODE_CLASS) + if (TYPE_CODE (known_type) != TYPE_CODE_STRUCT) return NULL; /* Plan on this changing in the future as i get around to setting diff --git a/gdb/gnu-v3-abi.c b/gdb/gnu-v3-abi.c index b960aa38bf..d673e77629 100644 --- a/gdb/gnu-v3-abi.c +++ b/gdb/gnu-v3-abi.c @@ -288,7 +288,7 @@ gnuv3_rtti_type (struct value *value, char *atsign; /* We only have RTTI for class objects. */ - if (TYPE_CODE (values_type) != TYPE_CODE_CLASS) + if (TYPE_CODE (values_type) != TYPE_CODE_STRUCT) return NULL; /* Java doesn't have RTTI following the C++ ABI. */ @@ -406,7 +406,7 @@ gnuv3_virtual_fn_field (struct value **value_p, struct gdbarch *gdbarch; /* Some simple sanity checks. */ - if (TYPE_CODE (values_type) != TYPE_CODE_CLASS) + if (TYPE_CODE (values_type) != TYPE_CODE_STRUCT) error (_("Only classes can have virtual functions.")); /* Determine architecture. */ @@ -1101,7 +1101,7 @@ gnuv3_get_typeid (struct value *value) /* We check for lval_memory because in the "typeid (type-id)" case, the type is passed via a not_lval value object. */ - if (TYPE_CODE (type) == TYPE_CODE_CLASS + if (TYPE_CODE (type) == TYPE_CODE_STRUCT && value_lval_const (value) == lval_memory && gnuv3_dynamic_class (type)) { @@ -1277,7 +1277,6 @@ gnuv3_pass_by_reference (struct type *type) /* We're only interested in things that can have methods. */ if (TYPE_CODE (type) != TYPE_CODE_STRUCT - && TYPE_CODE (type) != TYPE_CODE_CLASS && TYPE_CODE (type) != TYPE_CODE_UNION) return 0; diff --git a/gdb/guile/scm-type.c b/gdb/guile/scm-type.c index 78b5863bd4..45b0750d35 100644 --- a/gdb/guile/scm-type.c +++ b/gdb/guile/scm-type.c @@ -1199,7 +1199,7 @@ gdbscm_field_baseclass_p (SCM self) struct field *field = tyscm_field_smob_to_field (f_smob); struct type *type = tyscm_field_smob_containing_type (f_smob); - if (TYPE_CODE (type) == TYPE_CODE_CLASS) + if (TYPE_CODE (type) == TYPE_CODE_STRUCT) return scm_from_bool (f_smob->field_num < TYPE_N_BASECLASSES (type)); return SCM_BOOL_F; } diff --git a/gdb/guile/scm-value.c b/gdb/guile/scm-value.c index 5d88059696..dc70e2c9d0 100644 --- a/gdb/guile/scm-value.c +++ b/gdb/guile/scm-value.c @@ -565,7 +565,7 @@ gdbscm_value_dynamic_type (SCM self) if (((TYPE_CODE (type) == TYPE_CODE_PTR) || (TYPE_CODE (type) == TYPE_CODE_REF)) - && (TYPE_CODE (TYPE_TARGET_TYPE (type)) == TYPE_CODE_CLASS)) + && (TYPE_CODE (TYPE_TARGET_TYPE (type)) == TYPE_CODE_STRUCT)) { struct value *target; int was_pointer = TYPE_CODE (type) == TYPE_CODE_PTR; @@ -584,7 +584,7 @@ gdbscm_value_dynamic_type (SCM self) type = lookup_reference_type (type); } } - else if (TYPE_CODE (type) == TYPE_CODE_CLASS) + else if (TYPE_CODE (type) == TYPE_CODE_STRUCT) type = value_rtti_type (value, NULL, NULL, NULL); else { diff --git a/gdb/p-exp.y b/gdb/p-exp.y index 0aa6f20e53..f128fcb2f6 100644 --- a/gdb/p-exp.y +++ b/gdb/p-exp.y @@ -410,8 +410,8 @@ exp : type '(' exp ')' %prec UNARY { /* Allow automatic dereference of classes. */ if ((TYPE_CODE (current_type) == TYPE_CODE_PTR) - && (TYPE_CODE (TYPE_TARGET_TYPE (current_type)) == TYPE_CODE_CLASS) - && (TYPE_CODE ($1) == TYPE_CODE_CLASS)) + && (TYPE_CODE (TYPE_TARGET_TYPE (current_type)) == TYPE_CODE_STRUCT) + && (TYPE_CODE ($1) == TYPE_CODE_STRUCT)) write_exp_elt_opcode (pstate, UNOP_IND); } write_exp_elt_opcode (pstate, UNOP_CAST); diff --git a/gdb/parse.c b/gdb/parse.c index 27947e79ff..7a6c1ee943 100644 --- a/gdb/parse.c +++ b/gdb/parse.c @@ -583,7 +583,6 @@ mark_completion_tag (enum type_code tag, const char *ptr, int length) && expout_last_struct == -1); gdb_assert (tag == TYPE_CODE_UNION || tag == TYPE_CODE_STRUCT - || tag == TYPE_CODE_CLASS || tag == TYPE_CODE_ENUM); expout_tag_completion_type = tag; expout_completion_name = xmalloc (length + 1); diff --git a/gdb/python/py-type.c b/gdb/python/py-type.c index 29a3500fdf..6d5ff8583d 100644 --- a/gdb/python/py-type.c +++ b/gdb/python/py-type.c @@ -232,7 +232,7 @@ convert_field (struct type *type, int field) goto failarg; Py_DECREF (arg); - if (TYPE_CODE (type) == TYPE_CODE_CLASS) + if (TYPE_CODE (type) == TYPE_CODE_STRUCT) arg = field < TYPE_N_BASECLASSES (type) ? Py_True : Py_False; else arg = Py_False; diff --git a/gdb/python/py-value.c b/gdb/python/py-value.c index 4313170e60..a1a7a1dd3c 100644 --- a/gdb/python/py-value.c +++ b/gdb/python/py-value.c @@ -302,7 +302,7 @@ valpy_get_dynamic_type (PyObject *self, void *closure) if (((TYPE_CODE (type) == TYPE_CODE_PTR) || (TYPE_CODE (type) == TYPE_CODE_REF)) - && (TYPE_CODE (TYPE_TARGET_TYPE (type)) == TYPE_CODE_CLASS)) + && (TYPE_CODE (TYPE_TARGET_TYPE (type)) == TYPE_CODE_STRUCT)) { struct value *target; int was_pointer = TYPE_CODE (type) == TYPE_CODE_PTR; @@ -321,7 +321,7 @@ valpy_get_dynamic_type (PyObject *self, void *closure) type = lookup_reference_type (type); } } - else if (TYPE_CODE (type) == TYPE_CODE_CLASS) + else if (TYPE_CODE (type) == TYPE_CODE_STRUCT) type = value_rtti_type (val, NULL, NULL, NULL); else { diff --git a/gdb/symtab.c b/gdb/symtab.c index ed164f7d23..01ddb91f6e 100644 --- a/gdb/symtab.c +++ b/gdb/symtab.c @@ -4720,7 +4720,6 @@ make_symbol_completion_type (const char *text, const char *word, { gdb_assert (code == TYPE_CODE_UNION || code == TYPE_CODE_STRUCT - || code == TYPE_CODE_CLASS || code == TYPE_CODE_ENUM); return current_language->la_make_symbol_completion_list (text, word, code); } diff --git a/gdb/typeprint.c b/gdb/typeprint.c index f97901d608..06501779ef 100644 --- a/gdb/typeprint.c +++ b/gdb/typeprint.c @@ -461,9 +461,9 @@ whatis_exp (char *exp, int show) { if (((TYPE_CODE (type) == TYPE_CODE_PTR) || (TYPE_CODE (type) == TYPE_CODE_REF)) - && (TYPE_CODE (TYPE_TARGET_TYPE (type)) == TYPE_CODE_CLASS)) + && (TYPE_CODE (TYPE_TARGET_TYPE (type)) == TYPE_CODE_STRUCT)) real_type = value_rtti_indirect_type (val, &full, &top, &using_enc); - else if (TYPE_CODE (type) == TYPE_CODE_CLASS) + else if (TYPE_CODE (type) == TYPE_CODE_STRUCT) real_type = value_rtti_type (val, &full, &top, &using_enc); } diff --git a/gdb/valops.c b/gdb/valops.c index c09e4fd0fc..4b84eba886 100644 --- a/gdb/valops.c +++ b/gdb/valops.c @@ -735,7 +735,7 @@ value_dynamic_cast (struct type *type, struct value *arg) && TYPE_CODE (resolved_type) != TYPE_CODE_REF) error (_("Argument to dynamic_cast must be a pointer or reference type")); if (TYPE_CODE (TYPE_TARGET_TYPE (resolved_type)) != TYPE_CODE_VOID - && TYPE_CODE (TYPE_TARGET_TYPE (resolved_type)) != TYPE_CODE_CLASS) + && TYPE_CODE (TYPE_TARGET_TYPE (resolved_type)) != TYPE_CODE_STRUCT) error (_("Argument to dynamic_cast must be pointer to class or `void *'")); class_type = check_typedef (TYPE_TARGET_TYPE (resolved_type)); @@ -748,7 +748,7 @@ value_dynamic_cast (struct type *type, struct value *arg) if (TYPE_CODE (arg_type) == TYPE_CODE_PTR) { arg_type = check_typedef (TYPE_TARGET_TYPE (arg_type)); - if (TYPE_CODE (arg_type) != TYPE_CODE_CLASS) + if (TYPE_CODE (arg_type) != TYPE_CODE_STRUCT) error (_("Argument to dynamic_cast does " "not have pointer to class type")); } @@ -761,7 +761,7 @@ value_dynamic_cast (struct type *type, struct value *arg) } else { - if (TYPE_CODE (arg_type) != TYPE_CODE_CLASS) + if (TYPE_CODE (arg_type) != TYPE_CODE_STRUCT) error (_("Argument to dynamic_cast does not have class type")); } -- 2.34.1