From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 114232 invoked by alias); 23 May 2018 04:59:15 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 113552 invoked by uid 89); 23 May 2018 04:59:08 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-24.9 required=5.0 tests=AWL,BAYES_00,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3,KAM_STOCKGEN,RCVD_IN_DNSWL_NONE,SPF_HELO_PASS autolearn=ham version=3.3.2 spammy=arrange X-HELO: gateway34.websitewelcome.com Received: from gateway34.websitewelcome.com (HELO gateway34.websitewelcome.com) (192.185.148.196) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 23 May 2018 04:59:05 +0000 Received: from cm13.websitewelcome.com (cm13.websitewelcome.com [100.42.49.6]) by gateway34.websitewelcome.com (Postfix) with ESMTP id 5F89A2DAE8D for ; Tue, 22 May 2018 23:59:04 -0500 (CDT) Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with SMTP id LLrcfw7aa79N3LLrcfSj3W; Tue, 22 May 2018 23:59:04 -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 1fLLrc-003S5D-5B; Tue, 22 May 2018 23:59:04 -0500 From: Tom Tromey To: gdb-patches@sourceware.org Cc: Tom Tromey Subject: [RFA 18/42] Make free_pending_blocks static Date: Wed, 23 May 2018 04:59:00 -0000 Message-Id: <20180523045851.11660-19-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: 1fLLrc-003S5D-5B 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: 19 X-Source-Cap: ZWx5bnJvYmk7ZWx5bnJvYmk7Ym94NTM3OS5ibHVlaG9zdC5jb20= X-Local-Domain: yes X-SW-Source: 2018-05/txt/msg00601.txt.bz2 free_pending_blocks can be static because scoped_free_pendings (et al) arrange for it to be NULL in the "steady state". This removes a couple of unnecessary calls to free_pending_blocks and changes it to be static. gdb/ChangeLog 2018-05-22 Tom Tromey * xcoffread.c (xcoff_initial_scan): Don't call free_pending_blocks. * dbxread.c (dbx_symfile_read): Don't call free_pending_blocks. * buildsym.h (class scoped_free_pendings): Add constructor. (free_pending_blocks): Don't declare. * buildsym.c (scoped_free_pendings::scoped_free_pendings): New. (free_pending_blocks): Now static. --- gdb/ChangeLog | 10 ++++++++++ gdb/buildsym.c | 11 +++++++++-- gdb/buildsym.h | 4 +--- gdb/dbxread.c | 1 - gdb/xcoffread.c | 2 -- 5 files changed, 20 insertions(+), 8 deletions(-) diff --git a/gdb/buildsym.c b/gdb/buildsym.c index f828fceb72..5d3d1f2942 100644 --- a/gdb/buildsym.c +++ b/gdb/buildsym.c @@ -264,6 +264,8 @@ static void record_pending_block (struct objfile *objfile, struct block *block, struct pending_block *opblock); +static void free_pending_blocks (); + /* Initial sizes of data structures. These are realloc'd larger if needed, and realloc'd down to the size actually used, when completed. */ @@ -332,6 +334,11 @@ find_symbol_in_list (struct pending *list, char *name, int length) return (NULL); } +scoped_free_pendings::scoped_free_pendings () +{ + gdb_assert (pending_blocks == nullptr); +} + /* At end of reading syms, or in case of quit, ensure everything associated with building symtabs is freed. @@ -374,8 +381,8 @@ scoped_free_pendings::~scoped_free_pendings () /* This function is called to discard any pending blocks. */ -void -free_pending_blocks (void) +static void +free_pending_blocks () { if (pending_blocks != NULL) { diff --git a/gdb/buildsym.h b/gdb/buildsym.h index b5ea63d3f4..512d926dcb 100644 --- a/gdb/buildsym.h +++ b/gdb/buildsym.h @@ -176,7 +176,7 @@ class scoped_free_pendings { public: - scoped_free_pendings () = default; + scoped_free_pendings (); ~scoped_free_pendings (); DISABLE_COPY_AND_ASSIGN (scoped_free_pendings); @@ -222,8 +222,6 @@ extern struct compunit_symtab *start_symtab (struct objfile *objfile, extern void restart_symtab (struct compunit_symtab *cust, const char *name, CORE_ADDR start_addr); -extern void free_pending_blocks (void); - /* Record the name of the debug format in the current pending symbol table. FORMAT must be a string with a lifetime at least as long as the symtab's objfile. */ diff --git a/gdb/dbxread.c b/gdb/dbxread.c index 52241f620d..127ae5bdf8 100644 --- a/gdb/dbxread.c +++ b/gdb/dbxread.c @@ -546,7 +546,6 @@ dbx_symfile_read (struct objfile *objfile, symfile_add_flags symfile_flags) symbol_size = DBX_SYMBOL_SIZE (objfile); symbol_table_offset = DBX_SYMTAB_OFFSET (objfile); - free_pending_blocks (); scoped_free_pendings free_pending; minimal_symbol_reader reader (objfile); diff --git a/gdb/xcoffread.c b/gdb/xcoffread.c index e9bb79c87a..21d107f78d 100644 --- a/gdb/xcoffread.c +++ b/gdb/xcoffread.c @@ -3028,8 +3028,6 @@ xcoff_initial_scan (struct objfile *objfile, symfile_add_flags symfile_flags) include N_SLINE. */ init_psymbol_list (objfile, num_symbols); - free_pending_blocks (); - scoped_free_pendings free_pending; minimal_symbol_reader reader (objfile); -- 2.13.6