From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp.gentoo.org (smtp.gentoo.org [IPv6:2001:470:ea4a:1:5054:ff:fec7:86e4]) by sourceware.org (Postfix) with ESMTP id 607433857C76 for ; Sun, 23 Oct 2022 15:20:05 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 607433857C76 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gentoo.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gentoo.org Received: by smtp.gentoo.org (Postfix, from userid 559) id E70EE340D22; Sun, 23 Oct 2022 15:20:04 +0000 (UTC) Date: Sun, 23 Oct 2022 19:50:39 +0545 From: Mike Frysinger To: Tsukasa OI Cc: Andrew Burgess , Nick Clifton , gdb-patches@sourceware.org Subject: Re: [PATCH 15/40] sim/h8300: Add "+ 0x0" to avoid self-assignments Message-ID: Mail-Followup-To: Tsukasa OI , Andrew Burgess , Nick Clifton , gdb-patches@sourceware.org References: <5ab303a5bdfc1da7832f8fa22f57678c9ef1a5fa.1666258361.git.research_trasio@irq.a4lg.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="x4ZGELYVn8Ch1BZb" Content-Disposition: inline In-Reply-To: <5ab303a5bdfc1da7832f8fa22f57678c9ef1a5fa.1666258361.git.research_trasio@irq.a4lg.com> X-Spam-Status: No, score=-5.2 required=5.0 tests=BAYES_00,JMQ_SPF_NEUTRAL,KAM_DMARC_STATUS,SPF_HELO_PASS,SPF_PASS,TXREP autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: --x4ZGELYVn8Ch1BZb Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable 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 failu= re > (unless "--disable-werror" is specified). >=20 > However, removing self-assignments in step_once function makes the code l= ess > readable. Instead, this commit inserts dummy addition to match the comme= nts > "Value added =3D=3D 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(-) >=20 > --- a/sim/h8300/compile.c > +++ b/sim/h8300/compile.c > @@ -4141,7 +4141,7 @@ step_once (SIM_DESC sd, SIM_CPU *cpu) > res =3D GET_B_REG (code->src.reg); /* FIXME fetch? */ > if (!c && (0 <=3D (res >> 4) && (res >> 4) <=3D 9) &&=20 > !h && (0 <=3D (res & 0xf) && (res & 0xf) <=3D 9)) > - res =3D res; /* Value added =3D=3D 0. */ > + res =3D res + 0x0; /* Value added =3D=3D 0. */ Andrew posted a patch to just delete the assignment. either is fine with m= e. -mike --x4ZGELYVn8Ch1BZb Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCAAdFiEEuQK1JxMl+JKsJRrUQWM7n+g39YEFAmNVSjMACgkQQWM7n+g3 9YFPgg/+MO33oCJ0Xj3uy0+509pUsfrke8sKdSiNIMfvpjsbJJ8cIhz/dPcny0KE OYQHgKESzlItX1vuTMxrsW4SMdmXYSfGB9SRUnJ+PxcLfHnAvcyfIh6o0kobOBnb JfPcrIsvOcnaosh12PD2ih5D6xbIR5pcg35cvhowhpmx6M8D10GamgO3U1o7zl4e 6BupLJL69FHr9Mw/AYUf0aFctwX7WGa2luDNr0lFpDaEX5JJjQVa3ylf4tix2Ls7 6riuQ86RUnsqHc8F8upAupEcdiK5DM67aPrj86hCXajhqz2qCRqznA5zkDHao9jA 1Y/x0Ff6oMXXzqr1Af7XOi/0RFWp4p3d/xeON/kyc2abbNX9psb7P8C8tHYcve0K ldnm2cEGpfxad+y07DDAfigpsWOYVsKpqeoJDsIln0iQtd1M8ov96ejiFa2LFYDI CAbeb+pckYAMUNQCMBf54Rw+cjn2E0aivTW6SABiTDAs9K0iLFJAyfhNBcJnURHD oztdG486X8VYsbWxAOC8XzmVoA+1plIEijCMQkr5jgiz72H3K6TQuh6T/0CR+LHP TjgwEj8Ep7UKlDwTIRjKHqgwIo7Jf2bU9TXB63vauwdxCiydwpVlubMenQP408qw Arda5a0S2ohb7Hst/w9ThkyVQOtov/4rf7/fCRMCch6JxcX6f5k= =x8D6 -----END PGP SIGNATURE----- --x4ZGELYVn8Ch1BZb--