From patchwork Fri May 3 23:12:31 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom Tromey X-Patchwork-Id: 32538 Received: (qmail 70418 invoked by alias); 3 May 2019 23:31:28 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 70404 invoked by uid 89); 3 May 2019 23:31:28 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-20.0 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, SPF_HELO_PASS autolearn=ham version=3.3.1 spammy=readers X-HELO: gateway31.websitewelcome.com Received: from gateway31.websitewelcome.com (HELO gateway31.websitewelcome.com) (192.185.143.38) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 03 May 2019 23:31:27 +0000 Received: from cm12.websitewelcome.com (cm12.websitewelcome.com [100.42.49.8]) by gateway31.websitewelcome.com (Postfix) with ESMTP id B865E2CD7 for ; Fri, 3 May 2019 18:31:25 -0500 (CDT) Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with SMTP id MheHhpis8iQerMheHhUybZ; Fri, 03 May 2019 18:31:25 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=tromey.com; s=default; h=References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From: Sender:Reply-To:MIME-Version:Content-Type:Content-Transfer-Encoding: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=7FgXM6u/Y5ZmkyCOivtk2JglxOd5WQSbo21pHp24y1Q=; b=mtKNMaed9p5O9lxLdzPQTzgEyA pImDlDTG0KUnMYmLEBjCoEKKSdSpnMx/0SNPa3YdoWDmPbUr+D5dvyvANb+TWy+Kv6RYsbX5YiL+u T9X5hpFg8qQcP3ysJUjSIxJ0/; Received: from 97-122-168-123.hlrn.qwest.net ([97.122.168.123]:37502 helo=bapiya.Home) by box5379.bluehost.com with esmtpsa (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.91) (envelope-from ) id 1hMhM9-003AAO-Us; Fri, 03 May 2019 18:12:42 -0500 From: Tom Tromey To: gdb-patches@sourceware.org Cc: Tom Tromey Subject: [PATCH v2 31/31] Convert gdbtypes.c to type-safe registry API Date: Fri, 3 May 2019 17:12:31 -0600 Message-Id: <20190503231231.8954-32-tom@tromey.com> In-Reply-To: <20190503231231.8954-1-tom@tromey.com> References: <20190503231231.8954-1-tom@tromey.com> This changes gdbtypes.c to use the type-safe registry API. 2019-05-02 Tom Tromey * gdbtypes.c (objfile_type_data): Change type. (objfile_type, _initialize_gdbtypes): Update. --- gdb/ChangeLog | 5 +++++ gdb/gdbtypes.c | 10 +++++----- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/gdb/gdbtypes.c b/gdb/gdbtypes.c index b3424d81be4..59456f9f3a4 100644 --- a/gdb/gdbtypes.c +++ b/gdb/gdbtypes.c @@ -5458,14 +5458,15 @@ gdbtypes_post_init (struct gdbarch *gdbarch) /* This set of objfile-based types is intended to be used by symbol readers as basic types. */ -static const struct objfile_data *objfile_type_data; +static const struct objfile_key> + objfile_type_data; const struct objfile_type * objfile_type (struct objfile *objfile) { struct gdbarch *gdbarch; - struct objfile_type *objfile_type - = (struct objfile_type *) objfile_data (objfile, objfile_type_data); + struct objfile_type *objfile_type = objfile_type_data.get (objfile); if (objfile_type) return objfile_type; @@ -5570,7 +5571,7 @@ objfile_type (struct objfile *objfile) = init_integer_type (objfile, gdbarch_addr_bit (gdbarch), 1, "__CORE_ADDR"); - set_objfile_data (objfile, objfile_type_data, objfile_type); + objfile_type_data.set (objfile, objfile_type); return objfile_type; } @@ -5578,7 +5579,6 @@ void _initialize_gdbtypes (void) { gdbtypes_data = gdbarch_data_register_post_init (gdbtypes_post_init); - objfile_type_data = register_objfile_data (); add_setshow_zuinteger_cmd ("overload", no_class, &overload_debug, _("Set debugging of C++ overloading."),