From patchwork Wed May 23 04:58:42 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom Tromey X-Patchwork-Id: 27454 Received: (qmail 101190 invoked by alias); 23 May 2018 06:16:23 -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 100270 invoked by uid 89); 23 May 2018 06:15:32 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-26.4 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=Hx-languages-length:3285 X-HELO: gateway32.websitewelcome.com Received: from gateway32.websitewelcome.com (HELO gateway32.websitewelcome.com) (192.185.145.111) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 23 May 2018 06:15:25 +0000 Received: from cm10.websitewelcome.com (cm10.websitewelcome.com [100.42.49.4]) by gateway32.websitewelcome.com (Postfix) with ESMTP id C9CAA324C6 for ; Wed, 23 May 2018 01:15:09 -0500 (CDT) Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with SMTP id LN3Ffx2lXBcCXLN3FfrTan; Wed, 23 May 2018 01:15:09 -0500 X-Authority-Reason: nr=8 Received: from 174-29-44-154.hlrn.qwest.net ([174.29.44.154]:56108 helo=bapiya.Home) by box5379.bluehost.com with esmtpsa (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.89_1) (envelope-from ) id 1fLLrh-003S5D-G3; Tue, 22 May 2018 23:59:09 -0500 From: Tom Tromey To: gdb-patches@sourceware.org Cc: Tom Tromey Subject: [RFA 33/42] Remove parameter from record_pending_block Date: Tue, 22 May 2018 22:58:42 -0600 Message-Id: <20180523045851.11660-34-tom@tromey.com> In-Reply-To: <20180523045851.11660-1-tom@tromey.com> References: <20180523045851.11660-1-tom@tromey.com> X-BWhitelist: no X-Source-L: No X-Exim-ID: 1fLLrh-003S5D-G3 X-Source-Sender: 174-29-44-154.hlrn.qwest.net (bapiya.Home) [174.29.44.154]:56108 X-Source-Auth: tom+tromey.com X-Email-Count: 10 X-Source-Cap: ZWx5bnJvYmk7ZWx5bnJvYmk7Ym94NTM3OS5ibHVlaG9zdC5jb20= X-Local-Domain: yes 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-05-22 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 1c7b3de215..c965776d82 100644 --- a/gdb/buildsym.c +++ b/gdb/buildsym.c @@ -289,10 +289,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. */ @@ -366,6 +362,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. */ @@ -560,7 +580,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; } @@ -576,35 +596,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