From patchwork Fri Jul 20 04:27:37 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom Tromey X-Patchwork-Id: 28513 Received: (qmail 14650 invoked by alias); 20 Jul 2018 04:28:18 -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 13840 invoked by uid 89); 20 Jul 2018 04:28:11 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-25.6 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.2 spammy=START X-HELO: gateway36.websitewelcome.com Received: from gateway36.websitewelcome.com (HELO gateway36.websitewelcome.com) (192.185.186.5) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 20 Jul 2018 04:28:08 +0000 Received: from cm15.websitewelcome.com (cm15.websitewelcome.com [100.42.49.9]) by gateway36.websitewelcome.com (Postfix) with ESMTP id DB398400C84D9 for ; Thu, 19 Jul 2018 22:29:45 -0500 (CDT) Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with SMTP id gN1GfPxehbXuJgN1LfXQ6V; Thu, 19 Jul 2018 23:28:02 -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=9uBMm9cxH/lw9qGTu9oeXjfkQsUtH03Z63W0JvcsFqw=; b=A4u/Viu4HAwgu1QJJpprnmBKX7 rKmHBg6TA2nFwlhPGCPO5Giykk7QsYveaxRXnLdi4xwx2q24ETwQ7z2U3CyOgSPNCCe3zRJz+ZMq+ e5AvZI0EfDkY0S5/1ciogLq0J; Received: from 75-166-85-72.hlrn.qwest.net ([75.166.85.72]:39336 helo=bapiya.Home) by box5379.bluehost.com with esmtpsa (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.91) (envelope-from ) id 1fgN1F-003pgz-KI; Thu, 19 Jul 2018 23:27:53 -0500 From: Tom Tromey To: gdb-patches@sourceware.org Cc: Tom Tromey Subject: [RFA v2 13/23] Remove parameter from record_pending_block Date: Thu, 19 Jul 2018 22:27:37 -0600 Message-Id: <20180720042747.18473-14-tom@tromey.com> In-Reply-To: <20180720042747.18473-1-tom@tromey.com> References: <20180720042747.18473-1-tom@tromey.com> This removes a redundant parameter from record_pending_block. It also moves record_pending_block earlier in the file, so that a forward declaration is no longer needed. gdb/ChangeLog 2018-07-19 Tom Tromey * buildsym.c (record_pending_block): Move earlier. Remove objfile parameter. (finish_block_internal): Update. --- gdb/ChangeLog | 6 ++++++ gdb/buildsym.c | 59 +++++++++++++++++++++++++--------------------------------- 2 files changed, 31 insertions(+), 34 deletions(-) diff --git a/gdb/buildsym.c b/gdb/buildsym.c index dffd077ed69..5cad1fd00c2 100644 --- a/gdb/buildsym.c +++ b/gdb/buildsym.c @@ -282,10 +282,6 @@ static void free_buildsym_compunit (void); static int compare_line_numbers (const void *ln1p, const void *ln2p); -static void record_pending_block (struct objfile *objfile, - struct block *block, - struct pending_block *opblock); - /* Initial sizes of data structures. These are realloc'd larger if needed, and realloc'd down to the size actually used, when completed. */ @@ -355,6 +351,30 @@ scoped_free_pendings::~scoped_free_pendings () free_buildsym_compunit (); } +/* Record BLOCK on the list of all blocks in the file. Put it after + OPBLOCK, or at the beginning if opblock is NULL. This puts the + block in the list after all its subblocks. */ + +static void +record_pending_block (struct block *block, struct pending_block *opblock) +{ + struct pending_block *pblock; + + pblock = XOBNEW (&buildsym_compunit->m_pending_block_obstack, + struct pending_block); + pblock->block = block; + if (opblock) + { + pblock->next = opblock->next; + opblock->next = pblock; + } + else + { + pblock->next = buildsym_compunit->m_pending_blocks; + buildsym_compunit->m_pending_blocks = pblock; + } +} + /* Take one of the lists of symbols and make a block from it. Keep the order the symbols have in the list (reversed from the input file). Put the block on the list of pending blocks. */ @@ -545,7 +565,7 @@ finish_block_internal (struct symbol *symbol, else buildsym_compunit->m_local_using_directives = NULL; - record_pending_block (objfile, block, opblock); + record_pending_block (block, opblock); return block; } @@ -561,35 +581,6 @@ finish_block (struct symbol *symbol, start, end, 0, 0); } -/* Record BLOCK on the list of all blocks in the file. Put it after - OPBLOCK, or at the beginning if opblock is NULL. This puts the - block in the list after all its subblocks. - - Allocate the pending block struct in the objfile_obstack to save - time. This wastes a little space. FIXME: Is it worth it? */ - -static void -record_pending_block (struct objfile *objfile, struct block *block, - struct pending_block *opblock) -{ - struct pending_block *pblock; - - pblock = XOBNEW (&buildsym_compunit->m_pending_block_obstack, - struct pending_block); - pblock->block = block; - if (opblock) - { - pblock->next = opblock->next; - opblock->next = pblock; - } - else - { - pblock->next = buildsym_compunit->m_pending_blocks; - buildsym_compunit->m_pending_blocks = pblock; - } -} - - /* Record that the range of addresses from START to END_INCLUSIVE (inclusive, like it says) belongs to BLOCK. BLOCK's start and end addresses must be set already. You must apply this function to all