From patchwork Thu May 10 22:23:44 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom Tromey X-Patchwork-Id: 27229 Received: (qmail 71421 invoked by alias); 10 May 2018 22:25:24 -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 42069 invoked by uid 89); 10 May 2018 22:24:23 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-26.9 required=5.0 tests=BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, SPF_HELO_PASS, TIME_LIMIT_EXCEEDED autolearn=unavailable version=3.3.2 spammy=differentiate, documents X-HELO: gateway24.websitewelcome.com Received: from gateway24.websitewelcome.com (HELO gateway24.websitewelcome.com) (192.185.51.251) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 10 May 2018 22:24:07 +0000 Received: from cm12.websitewelcome.com (cm12.websitewelcome.com [100.42.49.8]) by gateway24.websitewelcome.com (Postfix) with ESMTP id 5C8CB4F681 for ; Thu, 10 May 2018 17:24:05 -0500 (CDT) Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with SMTP id GtynfkVM7lAdrGtynfHgCg; Thu, 10 May 2018 17:24:05 -0500 X-Authority-Reason: nr=8 Received: from 97-122-176-117.hlrn.qwest.net ([97.122.176.117]:54520 helo=bapiya.Home) by box5379.bluehost.com with esmtpsa (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.89_1) (envelope-from ) id 1fGtyn-001ijL-4Y; Thu, 10 May 2018 17:24:05 -0500 From: Tom Tromey To: gdb-patches@sourceware.org Cc: Tom Tromey Subject: [RFA 02/15] Remove some unneeded psymtab initializations Date: Thu, 10 May 2018 16:23:44 -0600 Message-Id: <20180510222357.27332-3-tom@tromey.com> In-Reply-To: <20180510222357.27332-1-tom@tromey.com> References: <20180510222357.27332-1-tom@tromey.com> X-BWhitelist: no X-Source-L: No X-Exim-ID: 1fGtyn-001ijL-4Y X-Source-Sender: 97-122-176-117.hlrn.qwest.net (bapiya.Home) [97.122.176.117]:54520 X-Source-Auth: tom+tromey.com X-Email-Count: 3 X-Source-Cap: ZWx5bnJvYmk7ZWx5bnJvYmk7Ym94NTM3OS5ibHVlaG9zdC5jb20= X-Local-Domain: yes allocate_psymtab has long cleared the new psymtab that is returned. This patch documents this behavior and then removes some redundant initializations. gdb/ChangeLog 2018-05-09 Tom Tromey * xcoffread.c (xcoff_end_psymtab): Remove some initializations. * psymtab.c (allocate_psymtab): Add comment. * psympriv.h (allocate_psymtab): Add comment. * dwarf2read.c (dwarf2_create_include_psymtab): Remove some initializations. * dbxread.c (dbx_end_psymtab): Remove some initializations. --- gdb/ChangeLog | 9 +++++++++ gdb/dbxread.c | 7 ------- gdb/dwarf2read.c | 6 ------ gdb/psympriv.h | 10 ++++++++-- gdb/psymtab.c | 2 ++ gdb/xcoffread.c | 7 ------- 6 files changed, 19 insertions(+), 22 deletions(-) diff --git a/gdb/dbxread.c b/gdb/dbxread.c index 1c4f564f4e..84ade27b4d 100644 --- a/gdb/dbxread.c +++ b/gdb/dbxread.c @@ -2127,13 +2127,6 @@ dbx_end_psymtab (struct objfile *objfile, struct partial_symtab *pst, subpst->dependencies[0] = pst; subpst->number_of_dependencies = 1; - subpst->globals_offset = - subpst->n_global_syms = - subpst->statics_offset = - subpst->n_static_syms = 0; - - subpst->readin = 0; - subpst->compunit_symtab = 0; subpst->read_symtab = pst->read_symtab; } diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c index 8960fdc38d..be477e3d30 100644 --- a/gdb/dwarf2read.c +++ b/gdb/dwarf2read.c @@ -6517,13 +6517,7 @@ dwarf2_create_include_psymtab (const char *name, struct partial_symtab *pst, subpst->dependencies[0] = pst; subpst->number_of_dependencies = 1; - subpst->globals_offset = 0; - subpst->n_global_syms = 0; - subpst->statics_offset = 0; - subpst->n_static_syms = 0; - subpst->compunit_symtab = NULL; subpst->read_symtab = pst->read_symtab; - subpst->readin = 0; /* No private part is necessary for include psymtabs. This property can be used to differentiate between such include psymtabs and diff --git a/gdb/psympriv.h b/gdb/psympriv.h index 487a34f053..2d81c16b40 100644 --- a/gdb/psympriv.h +++ b/gdb/psympriv.h @@ -295,8 +295,14 @@ extern struct partial_symtab *start_psymtab_common (struct objfile *, extern void end_psymtab_common (struct objfile *, struct partial_symtab *); -extern struct partial_symtab *allocate_psymtab (const char *, - struct objfile *) +/* Allocate a new partial symbol table associated with OBJFILE. + FILENAME (which must be non-NULL) is the filename of this partial + symbol table; it is copied into the appropriate storage. A new + partial symbol table is returned; aside from "next" and "filename", + its fields are initialized to zero. */ + +extern struct partial_symtab *allocate_psymtab (const char *filename, + struct objfile *objfile) ATTRIBUTE_NONNULL (1); extern void discard_psymtab (struct objfile *, struct partial_symtab *); diff --git a/gdb/psymtab.c b/gdb/psymtab.c index 28935291e4..ee593494f6 100644 --- a/gdb/psymtab.c +++ b/gdb/psymtab.c @@ -1740,6 +1740,8 @@ init_psymbol_list (struct objfile *objfile, int total_symbols) objfile->static_psymbols.reserve (total_symbols / 10); } +/* See psympriv.h. */ + struct partial_symtab * allocate_psymtab (const char *filename, struct objfile *objfile) { diff --git a/gdb/xcoffread.c b/gdb/xcoffread.c index 611e954a08..a26f4fe88c 100644 --- a/gdb/xcoffread.c +++ b/gdb/xcoffread.c @@ -2109,13 +2109,6 @@ xcoff_end_psymtab (struct objfile *objfile, struct partial_symtab *pst, subpst->dependencies[0] = pst; subpst->number_of_dependencies = 1; - subpst->globals_offset = - subpst->n_global_syms = - subpst->statics_offset = - subpst->n_static_syms = 0; - - subpst->readin = 0; - subpst->compunit_symtab = NULL; subpst->read_symtab = pst->read_symtab; }