From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from barracuda.ebox.ca (barracuda.ebox.ca [96.127.255.19]) by sourceware.org (Postfix) with ESMTPS id 823F13857C7E for ; Thu, 21 Jan 2021 03:24:12 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 823F13857C7E X-ASG-Debug-ID: 1611199451-0c856e67e2482280001-fS2M51 Received: from smtp.ebox.ca (smtp.ebox.ca [96.127.255.82]) by barracuda.ebox.ca with ESMTP id DOBA0NL41kibZ2nm (version=TLSv1 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Wed, 20 Jan 2021 22:24:11 -0500 (EST) X-Barracuda-Envelope-From: simon.marchi@polymtl.ca X-Barracuda-RBL-Trusted-Forwarder: 96.127.255.82 Received: from simark.localdomain (192-222-157-6.qc.cable.ebox.net [192.222.157.6]) by smtp.ebox.ca (Postfix) with ESMTP id 8A914441D64; Wed, 20 Jan 2021 22:24:11 -0500 (EST) From: Simon Marchi X-Barracuda-RBL-IP: 192.222.157.6 X-Barracuda-Effective-Source-IP: 192-222-157-6.qc.cable.ebox.net[192.222.157.6] X-Barracuda-Apparent-Source-IP: 192.222.157.6 To: gdb-patches@sourceware.org Subject: [PATCH 2/3] gdb: remove TYPE_OBJFILE_OWNED macro Date: Wed, 20 Jan 2021 22:24:09 -0500 X-ASG-Orig-Subj: [PATCH 2/3] gdb: remove TYPE_OBJFILE_OWNED macro Message-Id: <20210121032410.97525-2-simon.marchi@polymtl.ca> X-Mailer: git-send-email 2.30.0 In-Reply-To: <20210121032410.97525-1-simon.marchi@polymtl.ca> References: <20210121032410.97525-1-simon.marchi@polymtl.ca> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Barracuda-Connect: smtp.ebox.ca[96.127.255.82] X-Barracuda-Start-Time: 1611199451 X-Barracuda-Encrypted: DHE-RSA-AES256-SHA X-Barracuda-URL: https://96.127.255.19:443/cgi-mod/mark.cgi X-Virus-Scanned: by bsmtpd at ebox.ca X-Barracuda-Scan-Msg-Size: 7153 X-Barracuda-BRTS-Status: 1 X-Barracuda-Spam-Score: 0.50 X-Barracuda-Spam-Status: No, SCORE=0.50 using global scores of TAG_LEVEL=1000.0 QUARANTINE_LEVEL=1000.0 KILL_LEVEL=8.0 tests=BSF_RULE7568M X-Barracuda-Spam-Report: Code version 3.2, rules version 3.2.3.87396 Rule breakdown below pts rule name description ---- ---------------------- -------------------------------------------------- 0.50 BSF_RULE7568M Custom Rule 7568M X-Spam-Status: No, score=-23.0 required=5.0 tests=BAYES_00, GIT_PATCH_0, KAM_DMARC_QUARANTINE, KAM_DMARC_STATUS, RCVD_IN_DNSWL_LOW, SPF_HELO_NONE, SPF_SOFTFAIL, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Jan 2021 03:24:14 -0000 Update all users to use the type::is_objfile_owned method. gdb/ChangeLog: * gdbtypes.h (TYPE_OBJFILE_OWNED): Remove, update all users to use the type::is_objfile_owned method. Change-Id: Icae84d136393ab9f756f50a33ac3cedda13c5ba2 --- gdb/compile/compile-c-types.c | 4 ++-- gdb/compile/compile-cplus-types.c | 2 +- gdb/gdbtypes.c | 18 +++++++++--------- gdb/gdbtypes.h | 9 ++++----- gdb/language.c | 2 +- 5 files changed, 17 insertions(+), 18 deletions(-) diff --git a/gdb/compile/compile-c-types.c b/gdb/compile/compile-c-types.c index 90de2084c85c..104e619f16d3 100644 --- a/gdb/compile/compile-c-types.c +++ b/gdb/compile/compile-c-types.c @@ -164,7 +164,7 @@ convert_func (compile_c_instance *context, struct type *type) GDB's parser used to do. */ if (target_type == NULL) { - if (TYPE_OBJFILE_OWNED (type)) + if (type->is_objfile_owned ()) target_type = objfile_type (type->objfile ())->builtin_int; else target_type = builtin_type (type->arch ())->builtin_int; @@ -323,7 +323,7 @@ convert_type_basic (compile_c_instance *context, struct type *type) built-in parser does. For now, assume "int" like GDB's built-in parser used to do, but at least warn. */ struct type *fallback; - if (TYPE_OBJFILE_OWNED (type)) + if (type->is_objfile_owned ()) fallback = objfile_type (type->objfile ())->builtin_int; else fallback = builtin_type (type->arch ())->builtin_int; diff --git a/gdb/compile/compile-cplus-types.c b/gdb/compile/compile-cplus-types.c index ddb0d8a03682..0f32b0e1adea 100644 --- a/gdb/compile/compile-cplus-types.c +++ b/gdb/compile/compile-cplus-types.c @@ -970,7 +970,7 @@ compile_cplus_convert_func (compile_cplus_instance *instance, GDB's parser used to do. */ if (target_type == nullptr) { - if (TYPE_OBJFILE_OWNED (type)) + if (type->is_objfile_owned ()) target_type = objfile_type (type->objfile ())->builtin_int; else target_type = builtin_type (type->arch ())->builtin_int; diff --git a/gdb/gdbtypes.c b/gdb/gdbtypes.c index e2f8837dcb4d..a4ae0d7a1a61 100644 --- a/gdb/gdbtypes.c +++ b/gdb/gdbtypes.c @@ -226,7 +226,7 @@ alloc_type_arch (struct gdbarch *gdbarch) struct type * alloc_type_copy (const struct type *type) { - if (TYPE_OBJFILE_OWNED (type)) + if (type->is_objfile_owned ()) return alloc_type (type->objfile ()); else return alloc_type_arch (type->arch ()); @@ -240,7 +240,7 @@ get_type_arch (const struct type *type) { struct gdbarch *arch; - if (TYPE_OBJFILE_OWNED (type)) + if (type->is_objfile_owned ()) arch = type->objfile ()->arch (); else arch = type->arch (); @@ -290,7 +290,7 @@ alloc_type_instance (struct type *oldtype) /* Allocate the structure. */ - if (! TYPE_OBJFILE_OWNED (oldtype)) + if (!oldtype->is_objfile_owned ()) type = GDBARCH_OBSTACK_ZALLOC (get_type_arch (oldtype), struct type); else type = OBSTACK_ZALLOC (&TYPE_OBJFILE (oldtype)->objfile_obstack, @@ -1429,7 +1429,7 @@ lookup_array_range_type (struct type *element_type, struct type *index_type; struct type *range_type; - if (TYPE_OBJFILE_OWNED (element_type)) + if (element_type->is_objfile_owned ()) index_type = objfile_type (element_type->objfile ())->builtin_int; else index_type = builtin_type (element_type->arch ())->builtin_int; @@ -2798,7 +2798,7 @@ type::add_dyn_prop (dynamic_prop_node_kind prop_kind, dynamic_prop prop) { struct dynamic_prop_list *temp; - gdb_assert (TYPE_OBJFILE_OWNED (this)); + gdb_assert (this->is_objfile_owned ()); temp = XOBNEW (&TYPE_OBJFILE (this)->objfile_obstack, struct dynamic_prop_list); @@ -5189,7 +5189,7 @@ recursive_dump_type (struct type *type, int spaces) puts_filtered ("\n"); printf_filtered ("%*slength %s\n", spaces, "", pulongest (TYPE_LENGTH (type))); - if (TYPE_OBJFILE_OWNED (type)) + if (type->is_objfile_owned ()) { printf_filtered ("%*sobjfile ", spaces, ""); gdb_print_host_address (type->objfile (), gdb_stdout); @@ -5492,7 +5492,7 @@ copy_type_recursive (struct objfile *objfile, void **slot; struct type *new_type; - if (! TYPE_OBJFILE_OWNED (type)) + if (!type->is_objfile_owned ()) return type; /* This type shouldn't be pointing to any types in other objfiles; @@ -5658,7 +5658,7 @@ copy_type (const struct type *type) { struct type *new_type; - gdb_assert (TYPE_OBJFILE_OWNED (type)); + gdb_assert (type->is_objfile_owned ()); new_type = alloc_type_copy (type); new_type->set_instance_flags (type->instance_flags ()); @@ -5960,7 +5960,7 @@ allocate_fixed_point_type_info (struct type *type) std::unique_ptr up (new fixed_point_type_info); fixed_point_type_info *info; - if (TYPE_OBJFILE_OWNED (type)) + if (type->is_objfile_owned ()) { fixed_point_type_storage *storage = fixed_point_objfile_key.get (TYPE_OBJFILE (type)); diff --git a/gdb/gdbtypes.h b/gdb/gdbtypes.h index 51f603157ba7..9037f41b6dba 100644 --- a/gdb/gdbtypes.h +++ b/gdb/gdbtypes.h @@ -224,7 +224,6 @@ DEF_ENUM_FLAGS_TYPE (enum type_instance_flag_value, type_instance_flags); the objfile retrieved as TYPE_OBJFILE. Otherwise, the type is owned by an architecture; TYPE_OBJFILE is NULL in this case. */ -#define TYPE_OBJFILE_OWNED(t) ((t)->is_objfile_owned ()) #define TYPE_OBJFILE(t) ((t)->objfile ()) /* * True if this type was declared using the "class" keyword. This is @@ -1274,14 +1273,14 @@ struct type return this->main_type->m_owner.objfile; } + /* Return the gdbarch owner of this type. + + Return nullptr if this type is not gdbarch-owned. */ gdbarch *arch () const { if (this->is_objfile_owned ()) return nullptr; - /* Return the gdbarch owner of this type. - - Return nullptr if this type is not gdbarch-owned. */ return this->main_type->m_owner.gdbarch; } @@ -2242,7 +2241,7 @@ extern const struct floatformat *floatformats_bfloat16[BFD_ENDIAN_UNKNOWN]; when it is no longer needed. */ #define TYPE_ALLOC(t,size) \ - (obstack_alloc ((TYPE_OBJFILE_OWNED (t) \ + (obstack_alloc (((t)->is_objfile_owned () \ ? &((t)->objfile ()->objfile_obstack) \ : gdbarch_obstack ((t)->arch ())), \ size)) diff --git a/gdb/language.c b/gdb/language.c index d4b84911f8b5..6b4be71c3f25 100644 --- a/gdb/language.c +++ b/gdb/language.c @@ -1036,7 +1036,7 @@ language_arch_info::type_and_symbol::alloc_type_symbol { struct symbol *symbol; struct gdbarch *gdbarch; - gdb_assert (!TYPE_OBJFILE_OWNED (type)); + gdb_assert (!type->is_objfile_owned ()); gdbarch = type->arch (); symbol = new (gdbarch_obstack (gdbarch)) struct symbol (); symbol->m_name = type->name (); -- 2.30.0