Message ID | 3090ae2157c8eae596b1bf5989c1853b865fdacf.1664093762.git.research_trasio@irq.a4lg.com |
---|---|
State | Committed |
Commit | f3700471469ac0f395961e92892bc5d6e17ca177 |
Headers |
Return-Path: <gdb-patches-bounces+patchwork=sourceware.org@sourceware.org> X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 6679238582B2 for <patchwork@sourceware.org>; Sun, 25 Sep 2022 08:18:24 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 6679238582B2 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1664093904; bh=2s8TkIo5jjviJlnP78kK3BLaGAJj8ZUEEXoQrPVyVdg=; h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:Cc:From; b=pMp5i7fjm+b2j62xpcPatFiXKDYmYr2tbAn2wP9d3We5PzhKB/Zc9cBSlXJnEnT5O QOtdufQ6qVlZHm5wzaFtljP1MBL+5tUQalEHn8GODBNRH1fewDzamOqr7ZhSTrtMxC N2tdkPL6My03zUwpndBECrAiKFcgrw7O8UXuyUG0= X-Original-To: gdb-patches@sourceware.org Delivered-To: gdb-patches@sourceware.org Received: from mail-sender-0.a4lg.com (mail-sender.a4lg.com [153.120.152.154]) by sourceware.org (Postfix) with ESMTPS id C62E73858C50 for <gdb-patches@sourceware.org>; Sun, 25 Sep 2022 08:17:55 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org C62E73858C50 Received: from [127.0.0.1] (localhost [127.0.0.1]) by mail-sender-0.a4lg.com (Postfix) with ESMTPSA id 05F5E300089; Sun, 25 Sep 2022 08:17:52 +0000 (UTC) To: Tsukasa OI <research_trasio@irq.a4lg.com> Subject: [PATCH] gdb: Remove unused extra_lines variable Date: Sun, 25 Sep 2022 08:17:42 +0000 Message-Id: <3090ae2157c8eae596b1bf5989c1853b865fdacf.1664093762.git.research_trasio@irq.a4lg.com> Mime-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-12.1 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, GIT_PATCH_0, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list <gdb-patches.sourceware.org> List-Unsubscribe: <https://sourceware.org/mailman/options/gdb-patches>, <mailto:gdb-patches-request@sourceware.org?subject=unsubscribe> List-Archive: <https://sourceware.org/pipermail/gdb-patches/> List-Post: <mailto:gdb-patches@sourceware.org> List-Help: <mailto:gdb-patches-request@sourceware.org?subject=help> List-Subscribe: <https://sourceware.org/mailman/listinfo/gdb-patches>, <mailto:gdb-patches-request@sourceware.org?subject=subscribe> From: Tsukasa OI via Gdb-patches <gdb-patches@sourceware.org> Reply-To: Tsukasa OI <research_trasio@irq.a4lg.com> Cc: gdb-patches@sourceware.org Errors-To: gdb-patches-bounces+patchwork=sourceware.org@sourceware.org Sender: "Gdb-patches" <gdb-patches-bounces+patchwork=sourceware.org@sourceware.org> |
Series |
gdb: Remove unused extra_lines variable
|
|
Commit Message
Tsukasa OI
Sept. 25, 2022, 8:17 a.m. UTC
Clang generates a warning if there is a variable that is set but not used otherwise ("-Wunused-but-set-variable"). On the default configuration, it causes a build failure (unless "--disable-werror" is specified). The only extra_lines use in arrange_linetable function is removed on the commit 558802e4d1c5dcbd0df7d2c6ef62a6deac247a2f ("gdb: change subfile::line_vector to an std::vector"). So, this variable should be removed to prevent a build failure. gdb/ChangeLog: * xcoffread.c (arrange_linetable): Remove unused extra_lines. --- gdb/xcoffread.c | 8 -------- 1 file changed, 8 deletions(-) base-commit: 58d69206b8173b9d027a6c65f56cdaf045ae6e64
Comments
On 25/09/2022 10:17, Tsukasa OI via Gdb-patches wrote: > Clang generates a warning if there is a variable that is set but not used > otherwise ("-Wunused-but-set-variable"). On the default configuration, it > causes a build failure (unless "--disable-werror" is specified). > > The only extra_lines use in arrange_linetable function is removed on the > commit 558802e4d1c5dcbd0df7d2c6ef62a6deac247a2f > ("gdb: change subfile::line_vector to an std::vector"). So, this variable > should be removed to prevent a build failure. Hi Tsukasa! This patch looks pretty safe. The point at which extra_lines would be used has the exact same check used to set it, instead of using the variable, so I think there is no need for it after all. That said, I can't approve the patch for pushing, so I hope a maintainer looks at this soon. > > gdb/ChangeLog: > > * xcoffread.c (arrange_linetable): Remove unused extra_lines. side note, GDB doesn't require changelogs anymore, but there are no rules against it, so you can leave it here if you'd like. Cheers, Bruno > --- > gdb/xcoffread.c | 8 -------- > 1 file changed, 8 deletions(-) > > diff --git a/gdb/xcoffread.c b/gdb/xcoffread.c > index b7d65771115..aa88cbc724d 100644 > --- a/gdb/xcoffread.c > +++ b/gdb/xcoffread.c > @@ -419,8 +419,6 @@ add_stab_to_list (char *stabname, struct pending_stabs **stabvector) > static void > arrange_linetable (std::vector<linetable_entry> &old_linetable) > { > - int extra_lines = 0; > - > std::vector<linetable_entry> fentries; > > for (int ii = 0; ii < old_linetable.size (); ++ii) > @@ -436,12 +434,6 @@ arrange_linetable (std::vector<linetable_entry> &old_linetable) > e.line = ii; > e.is_stmt = 1; > e.pc = old_linetable[ii].pc; > - > - /* If the function was compiled with XLC, we may have to add an > - extra line entry later. Reserve space for that. */ > - if (ii + 1 < old_linetable.size () > - && old_linetable[ii].pc != old_linetable[ii + 1].pc) > - extra_lines++; > } > } > > > base-commit: 58d69206b8173b9d027a6c65f56cdaf045ae6e64
>>>>> Tsukasa OI via Gdb-patches <gdb-patches@sourceware.org> writes: > Clang generates a warning if there is a variable that is set but not used > otherwise ("-Wunused-but-set-variable"). On the default configuration, it > causes a build failure (unless "--disable-werror" is specified). > The only extra_lines use in arrange_linetable function is removed on the > commit 558802e4d1c5dcbd0df7d2c6ef62a6deac247a2f > ("gdb: change subfile::line_vector to an std::vector"). So, this variable > should be removed to prevent a build failure. Thanks, this is ok. Tom
On 2022/09/26 18:00, Bruno Larsen wrote: > On 25/09/2022 10:17, Tsukasa OI via Gdb-patches wrote: >> Clang generates a warning if there is a variable that is set but not used >> otherwise ("-Wunused-but-set-variable"). On the default >> configuration, it >> causes a build failure (unless "--disable-werror" is specified). >> >> The only extra_lines use in arrange_linetable function is removed on the >> commit 558802e4d1c5dcbd0df7d2c6ef62a6deac247a2f >> ("gdb: change subfile::line_vector to an std::vector"). So, this >> variable >> should be removed to prevent a build failure. > > Hi Tsukasa! > > This patch looks pretty safe. The point at which extra_lines would be > used has the exact same check used to set it, instead of using the > variable, so I think there is no need for it after all. > > That said, I can't approve the patch for pushing, so I hope a maintainer > looks at this soon. > >> >> gdb/ChangeLog: >> >> * xcoffread.c (arrange_linetable): Remove unused extra_lines. > side note, GDB doesn't require changelogs anymore, but there are no > rules against it, so you can leave it here if you'd like. Thanks for letting me know! A maintainer (Tom) approved the patch and I removed the ChangeLog in the commit message (as an obvious change) and then pushed. The original intent of ChangeLog was to keep formatting as common as Binutils but it required extra work (contrib/mklog.py does not work properly on GDB files) and I think I looked pretty old version of contribution guide or something when I decided to do so. Thanks, Tsukasa > > Cheers, > Bruno > >> --- >> gdb/xcoffread.c | 8 -------- >> 1 file changed, 8 deletions(-) >> >> diff --git a/gdb/xcoffread.c b/gdb/xcoffread.c >> index b7d65771115..aa88cbc724d 100644 >> --- a/gdb/xcoffread.c >> +++ b/gdb/xcoffread.c >> @@ -419,8 +419,6 @@ add_stab_to_list (char *stabname, struct >> pending_stabs **stabvector) >> static void >> arrange_linetable (std::vector<linetable_entry> &old_linetable) >> { >> - int extra_lines = 0; >> - >> std::vector<linetable_entry> fentries; >> for (int ii = 0; ii < old_linetable.size (); ++ii) >> @@ -436,12 +434,6 @@ arrange_linetable (std::vector<linetable_entry> >> &old_linetable) >> e.line = ii; >> e.is_stmt = 1; >> e.pc = old_linetable[ii].pc; >> - >> - /* If the function was compiled with XLC, we may have to add an >> - extra line entry later. Reserve space for that. */ >> - if (ii + 1 < old_linetable.size () >> - && old_linetable[ii].pc != old_linetable[ii + 1].pc) >> - extra_lines++; >> } >> } >> >> base-commit: 58d69206b8173b9d027a6c65f56cdaf045ae6e64 >
diff --git a/gdb/xcoffread.c b/gdb/xcoffread.c index b7d65771115..aa88cbc724d 100644 --- a/gdb/xcoffread.c +++ b/gdb/xcoffread.c @@ -419,8 +419,6 @@ add_stab_to_list (char *stabname, struct pending_stabs **stabvector) static void arrange_linetable (std::vector<linetable_entry> &old_linetable) { - int extra_lines = 0; - std::vector<linetable_entry> fentries; for (int ii = 0; ii < old_linetable.size (); ++ii) @@ -436,12 +434,6 @@ arrange_linetable (std::vector<linetable_entry> &old_linetable) e.line = ii; e.is_stmt = 1; e.pc = old_linetable[ii].pc; - - /* If the function was compiled with XLC, we may have to add an - extra line entry later. Reserve space for that. */ - if (ii + 1 < old_linetable.size () - && old_linetable[ii].pc != old_linetable[ii + 1].pc) - extra_lines++; } }