Message ID | 5ab303a5bdfc1da7832f8fa22f57678c9ef1a5fa.1666258361.git.research_trasio@irq.a4lg.com |
---|---|
State | Committed |
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 44096396E42B for <patchwork@sourceware.org>; Thu, 20 Oct 2022 09:37:40 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 44096396E42B DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1666258660; bh=cqjVfRw22ZK50iTwDmJFzzfAC5M71DRek8GtIBTQibQ=; h=To:Subject:Date:In-Reply-To:References:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=eOq5izxeVVQ4wDAuIuBNeUq+kS7gCVlExW86IMad15Dbc8wLCDK7CLp2fR9AlFyek 78/sYGsO6XV8pzV71xnpH8gMYJksgH2ZVd+/9FDIq58ux5e40zwvBYwwfpePk+S7TB 0cGGOM9WY9NUMXDZNBdjRaRsYHsbo3aCXkQZUnLQ= X-Original-To: gdb-patches@sourceware.org Delivered-To: gdb-patches@sourceware.org Received: from mail-sender-0.a4lg.com (mail-sender-0.a4lg.com [IPv6:2401:2500:203:30b:4000:6bfe:4757:0]) by sourceware.org (Postfix) with ESMTPS id 579103834822 for <gdb-patches@sourceware.org>; Thu, 20 Oct 2022 09:35:33 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 579103834822 Received: from [127.0.0.1] (localhost [127.0.0.1]) by mail-sender-0.a4lg.com (Postfix) with ESMTPSA id A97E4300089; Thu, 20 Oct 2022 09:35:31 +0000 (UTC) To: Tsukasa OI <research_trasio@irq.a4lg.com>, Andrew Burgess <aburgess@redhat.com>, Mike Frysinger <vapier@gentoo.org>, Nick Clifton <nickc@redhat.com> Subject: [PATCH 15/40] sim/h8300: Add "+ 0x0" to avoid self-assignments Date: Thu, 20 Oct 2022 09:32:20 +0000 Message-Id: <5ab303a5bdfc1da7832f8fa22f57678c9ef1a5fa.1666258361.git.research_trasio@irq.a4lg.com> In-Reply-To: <cover.1666258361.git.research_trasio@irq.a4lg.com> References: <cover.1666258361.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 |
sim+gdb: Suppress warnings if built with Clang (big batch 1)
|
|
Commit Message
Tsukasa OI
Oct. 20, 2022, 9:32 a.m. UTC
Clang generates a warning if there is a redundant self-assignment ("-Wself-assign"). On the default configuration, it causes a build failure (unless "--disable-werror" is specified). However, removing self-assignments in step_once function makes the code less readable. Instead, this commit inserts dummy addition to match the comments "Value added == 0". This is redundant but will suppress warnings and matches with other branches better. It will be also optimized away so we can ignore performance impact on this. --- sim/h8300/compile.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
Comments
On 20 Oct 2022 09:32, Tsukasa OI wrote: > Clang generates a warning if there is a redundant self-assignment > ("-Wself-assign"). On the default configuration, it causes a build failure > (unless "--disable-werror" is specified). > > However, removing self-assignments in step_once function makes the code less > readable. Instead, this commit inserts dummy addition to match the comments > "Value added == 0". This is redundant but will suppress warnings and > matches with other branches better. It will be also optimized away so we > can ignore performance impact on this. > --- > sim/h8300/compile.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > --- a/sim/h8300/compile.c > +++ b/sim/h8300/compile.c > @@ -4141,7 +4141,7 @@ step_once (SIM_DESC sd, SIM_CPU *cpu) > res = GET_B_REG (code->src.reg); /* FIXME fetch? */ > if (!c && (0 <= (res >> 4) && (res >> 4) <= 9) && > !h && (0 <= (res & 0xf) && (res & 0xf) <= 9)) > - res = res; /* Value added == 0. */ > + res = res + 0x0; /* Value added == 0. */ Andrew posted a patch to just delete the assignment. either is fine with me. -mike
On 2022/10/23 23:05, Mike Frysinger wrote: > On 20 Oct 2022 09:32, Tsukasa OI wrote: >> Clang generates a warning if there is a redundant self-assignment >> ("-Wself-assign"). On the default configuration, it causes a build failure >> (unless "--disable-werror" is specified). >> >> However, removing self-assignments in step_once function makes the code less >> readable. Instead, this commit inserts dummy addition to match the comments >> "Value added == 0". This is redundant but will suppress warnings and >> matches with other branches better. It will be also optimized away so we >> can ignore performance impact on this. >> --- >> sim/h8300/compile.c | 4 ++-- >> 1 file changed, 2 insertions(+), 2 deletions(-) >> >> --- a/sim/h8300/compile.c >> +++ b/sim/h8300/compile.c >> @@ -4141,7 +4141,7 @@ step_once (SIM_DESC sd, SIM_CPU *cpu) >> res = GET_B_REG (code->src.reg); /* FIXME fetch? */ >> if (!c && (0 <= (res >> 4) && (res >> 4) <= 9) && >> !h && (0 <= (res & 0xf) && (res & 0xf) <= 9)) >> - res = res; /* Value added == 0. */ >> + res = res + 0x0; /* Value added == 0. */ > > Andrew posted a patch to just delete the assignment. either is fine with me. > -mike I'll leave it for Andrew and I will withdraw following patches from my patchset: - PATCH 03/40 - PATCH 15/40 - PATCH 16/40 (wrote by Andrew) - PATCH 28/40 - PATCH 30/40 - PATCH 36/40 Because this patchset (intended to be a RFC PATCH) is a mere copy of my working branch, I need to sync with Andrew's work. Thanks, Tsukasa
diff --git a/sim/h8300/compile.c b/sim/h8300/compile.c index 9be7dd565a9..f7d8d590b69 100644 --- a/sim/h8300/compile.c +++ b/sim/h8300/compile.c @@ -4141,7 +4141,7 @@ step_once (SIM_DESC sd, SIM_CPU *cpu) res = GET_B_REG (code->src.reg); /* FIXME fetch? */ if (!c && (0 <= (res >> 4) && (res >> 4) <= 9) && !h && (0 <= (res & 0xf) && (res & 0xf) <= 9)) - res = res; /* Value added == 0. */ + res = res + 0x0; /* Value added == 0. */ else if (!c && (0 <= (res >> 4) && (res >> 4) <= 8) && !h && (10 <= (res & 0xf) && (res & 0xf) <= 15)) res = res + 0x6; /* Value added == 6. */ @@ -4174,7 +4174,7 @@ step_once (SIM_DESC sd, SIM_CPU *cpu) res = GET_B_REG (code->src.reg); /* FIXME fetch, fetch2... */ if (!c && (0 <= (res >> 4) && (res >> 4) <= 9) && !h && (0 <= (res & 0xf) && (res & 0xf) <= 9)) - res = res; /* Value added == 0. */ + res = res + 0x0; /* Value added == 0. */ else if (!c && (0 <= (res >> 4) && (res >> 4) <= 8) && h && (6 <= (res & 0xf) && (res & 0xf) <= 15)) res = res + 0xfa; /* Value added == 0xfa. */