diff options
-rw-r--r-- | gdb/ChangeLog | 5 | ||||
-rw-r--r-- | gdb/ada-lang.c | 8 | ||||
-rw-r--r-- | gdb/ada-typeprint.c | 2 | ||||
-rw-r--r-- | gdb/c-typeprint.c | 4 | ||||
-rw-r--r-- | gdb/dwarf2/read.c | 2 | ||||
-rw-r--r-- | gdb/gdbtypes.c | 10 | ||||
-rw-r--r-- | gdb/gdbtypes.h | 12 | ||||
-rw-r--r-- | gdb/m2-valprint.c | 2 | ||||
-rw-r--r-- | gdb/p-typeprint.c | 2 | ||||
-rw-r--r-- | gdb/p-valprint.c | 2 | ||||
-rw-r--r-- | gdb/python/py-type.c | 2 | ||||
-rw-r--r-- | gdb/stabsread.c | 6 | ||||
-rw-r--r-- | gdb/valprint.c | 2 |
13 files changed, 31 insertions, 28 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 1b58171..aac62fc 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,5 +1,10 @@ 2020-09-14 Simon Marchi <simon.marchi@efficios.com> + * gdbtypes.h (TYPE_STUB): Remove, replace all + uses with type::is_stub. + +2020-09-14 Simon Marchi <simon.marchi@efficios.com> + * gdbtypes.h (struct type) <is_stub, set_is_stub>: New methods. (TYPE_STUB): Use type::is_stub, change all write call sites to use type::set_is_stub. diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c index c126f98..4aaf862 100644 --- a/gdb/ada-lang.c +++ b/gdb/ada-lang.c @@ -1592,7 +1592,7 @@ desc_bounds (struct value *arr) { struct type *target_type = TYPE_TARGET_TYPE (p_bounds_type); - if (TYPE_STUB (target_type)) + if (target_type->is_stub ()) p_bounds = value_cast (lookup_pointer_type (ada_check_typedef (target_type)), p_bounds); @@ -5010,13 +5010,13 @@ remove_extra_symbols (std::vector<struct block_symbol> *syms) /* If two symbols have the same name and one of them is a stub type, the get rid of the stub. */ - if (TYPE_STUB (SYMBOL_TYPE ((*syms)[i].symbol)) + if (SYMBOL_TYPE ((*syms)[i].symbol)->is_stub () && (*syms)[i].symbol->linkage_name () != NULL) { for (j = 0; j < syms->size (); j++) { if (j != i - && !TYPE_STUB (SYMBOL_TYPE ((*syms)[j].symbol)) + && !SYMBOL_TYPE ((*syms)[j].symbol)->is_stub () && (*syms)[j].symbol->linkage_name () != NULL && strcmp ((*syms)[i].symbol->linkage_name (), (*syms)[j].symbol->linkage_name ()) == 0) @@ -8762,7 +8762,7 @@ ada_check_typedef (struct type *type) type = check_typedef (type); if (type == NULL || type->code () != TYPE_CODE_ENUM - || !TYPE_STUB (type) + || !type->is_stub () || type->name () == NULL) return type; else diff --git a/gdb/ada-typeprint.c b/gdb/ada-typeprint.c index 062b9d8..8ee620c 100644 --- a/gdb/ada-typeprint.c +++ b/gdb/ada-typeprint.c @@ -623,7 +623,7 @@ print_selected_record_field_types (struct type *type, struct type *outer_type, flds = 0; - if (fld0 > fld1 && TYPE_STUB (type)) + if (fld0 > fld1 && type->is_stub ()) return -1; for (i = fld0; i <= fld1; i += 1) diff --git a/gdb/c-typeprint.c b/gdb/c-typeprint.c index 91d9ef8..ef16f2b 100644 --- a/gdb/c-typeprint.c +++ b/gdb/c-typeprint.c @@ -1118,7 +1118,7 @@ c_type_print_base_struct_union (struct type *type, struct ui_file *stream, if (type->num_fields () == 0 && TYPE_NFN_FIELDS (type) == 0 && TYPE_TYPEDEF_FIELD_COUNT (type) == 0) { - if (TYPE_STUB (type)) + if (type->is_stub ()) fprintfi_filtered (level + 4, stream, _("%p[<incomplete type>%p]\n"), metadata_style.style ().ptr (), nullptr); @@ -1629,7 +1629,7 @@ c_type_print_base_1 (struct type *type, struct ui_file *stream, fprintf_filtered (stream, "{\n"); if (type->num_fields () == 0) { - if (TYPE_STUB (type)) + if (type->is_stub ()) fprintfi_filtered (level + 4, stream, _("%p[<incomplete type>%p]\n"), metadata_style.style ().ptr (), nullptr); diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c index f17401e..b935833 100644 --- a/gdb/dwarf2/read.c +++ b/gdb/dwarf2/read.c @@ -16640,7 +16640,7 @@ read_enumeration_type (struct die_info *die, struct dwarf2_cu *cu) can tell us the reality. However, we defer to a local size attribute if one exists, because this lets the compiler override the underlying type if needed. */ - if (TYPE_TARGET_TYPE (type) != NULL && !TYPE_STUB (TYPE_TARGET_TYPE (type))) + if (TYPE_TARGET_TYPE (type) != NULL && !TYPE_TARGET_TYPE (type)->is_stub ()) { struct type *underlying_type = TYPE_TARGET_TYPE (type); underlying_type = check_typedef (underlying_type); diff --git a/gdb/gdbtypes.c b/gdb/gdbtypes.c index 687cfe0..492061f 100644 --- a/gdb/gdbtypes.c +++ b/gdb/gdbtypes.c @@ -934,7 +934,7 @@ create_range_type (struct type *result_type, struct type *index_type, result_type = alloc_type_copy (index_type); result_type->set_code (TYPE_CODE_RANGE); TYPE_TARGET_TYPE (result_type) = index_type; - if (TYPE_STUB (index_type)) + if (index_type->is_stub ()) TYPE_TARGET_STUB (result_type) = 1; else TYPE_LENGTH (result_type) = TYPE_LENGTH (check_typedef (index_type)); @@ -1388,7 +1388,7 @@ create_set_type (struct type *result_type, struct type *domain_type) result_type->set_fields ((struct field *) TYPE_ZALLOC (result_type, sizeof (struct field))); - if (!TYPE_STUB (domain_type)) + if (!domain_type->is_stub ()) { LONGEST low_bound, high_bound, bit_length; @@ -2837,7 +2837,7 @@ check_typedef (struct type *type) } /* Otherwise, rely on the stub flag being set for opaque/stubbed types. */ - else if (TYPE_STUB (type) && !currently_reading_symtab) + else if (type->is_stub () && !currently_reading_symtab) { const char *name = type->name (); /* FIXME: shouldn't we look in STRUCT_DOMAIN and/or VAR_DOMAIN @@ -2868,7 +2868,7 @@ check_typedef (struct type *type) { struct type *target_type = check_typedef (TYPE_TARGET_TYPE (type)); - if (TYPE_STUB (target_type) || TYPE_TARGET_STUB (target_type)) + if (target_type->is_stub () || TYPE_TARGET_STUB (target_type)) { /* Nothing we can do. */ } @@ -5076,7 +5076,7 @@ recursive_dump_type (struct type *type, int spaces) { puts_filtered (" TYPE_ENDIANITY_NOT_DEFAULT"); } - if (TYPE_STUB (type)) + if (type->is_stub ()) { puts_filtered (" TYPE_STUB"); } diff --git a/gdb/gdbtypes.h b/gdb/gdbtypes.h index 7739757..bceb1b8 100644 --- a/gdb/gdbtypes.h +++ b/gdb/gdbtypes.h @@ -216,12 +216,6 @@ DEF_ENUM_FLAGS_TYPE (enum type_instance_flag_value, type_instance_flags); #define TYPE_ENDIANITY_NOT_DEFAULT(t) (TYPE_MAIN_TYPE (t)->flag_endianity_not_default) -/* * This appears in a type's flags word if it is a stub type (e.g., - if someone referenced a type that wasn't defined in a source file - via (struct sir_not_appearing_in_this_film *)). */ - -#define TYPE_STUB(t) ((t)->is_stub ()) - /* * The target type of this type is a stub type, and this type needs to be updated if it gets un-stubbed in check_typedef. Used for arrays and ranges, in which TYPE_LENGTH of the array/range gets set @@ -1084,6 +1078,10 @@ struct type this->main_type->m_flag_nosign = has_no_signedness; } + /* This appears in a type's flags word if it is a stub type (e.g., + if someone referenced a type that wasn't defined in a source file + via (struct sir_not_appearing_in_this_film *)). */ + bool is_stub () const { return this->main_type->m_flag_stub; @@ -1841,7 +1839,7 @@ extern void set_type_vptr_basetype (struct type *, struct type *); && ((thistype)->num_fields () == 0) \ && (!HAVE_CPLUS_STRUCT (thistype) \ || TYPE_NFN_FIELDS (thistype) == 0) \ - && (TYPE_STUB (thistype) || !TYPE_STUB_SUPPORTED (thistype))) + && ((thistype)->is_stub () || !TYPE_STUB_SUPPORTED (thistype))) /* * A helper macro that returns the name of a type or "unnamed type" if the type has no name. */ diff --git a/gdb/m2-valprint.c b/gdb/m2-valprint.c index b0a3ce3..9f5ce7e 100644 --- a/gdb/m2-valprint.c +++ b/gdb/m2-valprint.c @@ -383,7 +383,7 @@ m2_value_print_inner (struct value *val, struct ui_file *stream, int recurse, case TYPE_CODE_SET: elttype = type->index_type (); elttype = check_typedef (elttype); - if (TYPE_STUB (elttype)) + if (elttype->is_stub ()) { fprintf_styled (stream, metadata_style.style (), _("<incomplete type>")); diff --git a/gdb/p-typeprint.c b/gdb/p-typeprint.c index 7842b63..6a6f3dd 100644 --- a/gdb/p-typeprint.c +++ b/gdb/p-typeprint.c @@ -561,7 +561,7 @@ pascal_type_print_base (struct type *type, struct ui_file *stream, int show, fprintf_filtered (stream, "\n"); if ((type->num_fields () == 0) && (TYPE_NFN_FIELDS (type) == 0)) { - if (TYPE_STUB (type)) + if (type->is_stub ()) fprintfi_filtered (level + 4, stream, "<incomplete type>\n"); else fprintfi_filtered (level + 4, stream, "<no data fields>\n"); diff --git a/gdb/p-valprint.c b/gdb/p-valprint.c index c98f3c5..096a75e 100644 --- a/gdb/p-valprint.c +++ b/gdb/p-valprint.c @@ -330,7 +330,7 @@ pascal_value_print_inner (struct value *val, struct ui_file *stream, case TYPE_CODE_SET: elttype = type->index_type (); elttype = check_typedef (elttype); - if (TYPE_STUB (elttype)) + if (elttype->is_stub ()) { fprintf_styled (stream, metadata_style.style (), "<incomplete type>"); break; diff --git a/gdb/python/py-type.c b/gdb/python/py-type.c index d0dfb52..2e175b6 100644 --- a/gdb/python/py-type.c +++ b/gdb/python/py-type.c @@ -1363,7 +1363,7 @@ type_to_type_object (struct type *type) try { /* Try not to let stub types leak out to Python. */ - if (TYPE_STUB (type)) + if (type->is_stub ()) type = check_typedef (type); } catch (...) diff --git a/gdb/stabsread.c b/gdb/stabsread.c index ce4c6f1..33a23cb 100644 --- a/gdb/stabsread.c +++ b/gdb/stabsread.c @@ -2336,7 +2336,7 @@ read_member_functions (struct stab_field_info *fip, const char **pp, == TYPE_CODE_METHOD); /* If this is just a stub, then we don't have the real name here. */ - if (TYPE_STUB (new_sublist->fn_field.type)) + if (new_sublist->fn_field.type->is_stub ()) { if (!TYPE_SELF_TYPE (new_sublist->fn_field.type)) set_type_self_type (new_sublist->fn_field.type, type); @@ -3429,7 +3429,7 @@ read_struct_type (const char **pp, struct type *type, enum type_code type_code, scribbling on existing structure type objects when new definitions appear. */ if (! (type->code () == TYPE_CODE_UNDEF - || TYPE_STUB (type))) + || type->is_stub ())) { complain_about_struct_wipeout (type); @@ -4453,7 +4453,7 @@ cleanup_undefined_types_1 (void) as well as in check_typedef to deal with the (legitimate in C though not C++) case of several types with the same name in different source files. */ - if (TYPE_STUB (*type)) + if ((*type)->is_stub ()) { struct pending *ppt; int i; diff --git a/gdb/valprint.c b/gdb/valprint.c index 676bdd6..d16e9b8 100644 --- a/gdb/valprint.c +++ b/gdb/valprint.c @@ -947,7 +947,7 @@ do_val_print (struct value *value, struct ui_file *stream, int recurse, only a stub and we can't find and substitute its complete type, then print appropriate string and return. */ - if (TYPE_STUB (real_type)) + if (real_type->is_stub ()) { fprintf_styled (stream, metadata_style.style (), _("<incomplete type>")); return; |