From patchwork Fri May 3 23:12:28 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom Tromey X-Patchwork-Id: 32536 Received: (qmail 3161 invoked by alias); 3 May 2019 23:13:01 -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 788 invoked by uid 89); 3 May 2019 23:12:47 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-19.8 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, SPF_HELO_PASS autolearn=ham version=3.3.1 spammy=6000 X-HELO: gateway30.websitewelcome.com Received: from gateway30.websitewelcome.com (HELO gateway30.websitewelcome.com) (50.116.126.1) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 03 May 2019 23:12:42 +0000 Received: from cm17.websitewelcome.com (cm17.websitewelcome.com [100.42.49.20]) by gateway30.websitewelcome.com (Postfix) with ESMTP id 33E935A76 for ; Fri, 3 May 2019 18:12:41 -0500 (CDT) Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with SMTP id MhM9hJkax90onMhM9hResG; Fri, 03 May 2019 18:12:41 -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=fapqzrY2F6XBaqYVnLnjfqhDUj4hJYjSZQH9yzch2Ns=; b=x9PSCRaZ/YZCVFTY2xY2xXA58o 62rDHh9AJJZ1134hTNVtBzuq/FMPsqONjXOTnly6k8hWufo60YFo/ScmH0aVQxsXN4Oy4floff1ui bncAlgcqZcg4IstWbGARNb2Vv; 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-0Y; Fri, 03 May 2019 18:12:41 -0500 From: Tom Tromey To: gdb-patches@sourceware.org Cc: Tom Tromey Subject: [PATCH v2 28/31] Convert stabsread.c to type-safe registry API Date: Fri, 3 May 2019 17:12:28 -0600 Message-Id: <20190503231231.8954-29-tom@tromey.com> In-Reply-To: <20190503231231.8954-1-tom@tromey.com> References: <20190503231231.8954-1-tom@tromey.com> This changes stabsread.c to use the type-safe registry API. 2019-05-01 Tom Tromey * stabsread.c (rs6000_builtin_type_data): Change type. (rs6000_builtin_type, _initialize_stabsread): Update. --- gdb/ChangeLog | 5 +++++ gdb/stabsread.c | 11 +++++------ 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/gdb/stabsread.c b/gdb/stabsread.c index 3f340dbf20d..27414a9812a 100644 --- a/gdb/stabsread.c +++ b/gdb/stabsread.c @@ -2075,13 +2075,14 @@ again: /* RS/6000 xlc/dbx combination uses a set of builtin types, starting from -1. Return the proper type node for a given builtin type number. */ -static const struct objfile_data *rs6000_builtin_type_data; +static const struct objfile_key> + rs6000_builtin_type_data; static struct type * rs6000_builtin_type (int typenum, struct objfile *objfile) { - struct type **negative_types - = (struct type **) objfile_data (objfile, rs6000_builtin_type_data); + struct type **negative_types = rs6000_builtin_type_data.get (objfile); /* We recognize types numbered from -NUMBER_RECOGNIZED to -1. */ #define NUMBER_RECOGNIZED 34 @@ -2098,7 +2099,7 @@ rs6000_builtin_type (int typenum, struct objfile *objfile) /* This includes an empty slot for type number -0. */ negative_types = OBSTACK_CALLOC (&objfile->objfile_obstack, NUMBER_RECOGNIZED + 1, struct type *); - set_objfile_data (objfile, rs6000_builtin_type_data, negative_types); + rs6000_builtin_type_data.set (objfile, negative_types); } if (negative_types[-typenum] != NULL) @@ -4800,8 +4801,6 @@ hashname (const char *name) void _initialize_stabsread (void) { - rs6000_builtin_type_data = register_objfile_data (); - undef_types_allocated = 20; undef_types_length = 0; undef_types = XNEWVEC (struct type *, undef_types_allocated);