From: Aleksandar Markovic <Aleksandar.Markovic@mips.com>
To: Mathieu Malaterre <malat@debian.org>
Cc: Ralf Baechle <ralf@linux-mips.org>,
Miodrag Dinic <Miodrag.Dinic@mips.com>,
Goran Ferenc <goran.ferenc@imgtec.com>,
James Hogan <jhogan@kernel.org>,
Douglas Leung <douglas.leung@imgtec.com>,
"linux-mips@linux-mips.org" <linux-mips@linux-mips.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: RE: [PATCH 2/2] MIPS: math-emu: Declare ys variable as possibly unused
Date: Tue, 26 Dec 2017 15:12:06 +0000 [thread overview]
Message-ID: <BD3A5F1946F2E540A31AF2CE969BAEEEC28256@MIPSMAIL01.mipstec.com> (raw)
In-Reply-To: <20171226104554.19612-2-malat@debian.org>
> Fix non-fatal warning:
>
> arch/mips/math-emu/sp_fdp.c: In function ‘ieee754sp_fdp’:
> arch/mips/math-emu/ieee754int.h:60:31: warning: variable ‘ys’ set but not used [-Wunused-but-set-variable]
> unsigned int ym; int ye; int ys; int yc
> ^
> arch/mips/math-emu/sp_fdp.c:37:2: note: in expansion of macro ‘COMPYSP’
> COMPYSP;
> ^~~~~~~
>
> Signed-off-by: Mathieu Malaterre <malat@debian.org>
> ---
> arch/mips/math-emu/ieee754int.h | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/arch/mips/math-emu/ieee754int.h b/arch/mips/math-emu/ieee754int.h
> index 06ac0e2ac7ac..cb8f04cd24bf 100644
> --- a/arch/mips/math-emu/ieee754int.h
> +++ b/arch/mips/math-emu/ieee754int.h
> @@ -57,7 +57,7 @@ static inline int ieee754_class_nan(int xc)
> unsigned int xm; int xe; int xs __maybe_unused; int xc
>
> #define COMPYSP \
> - unsigned int ym; int ye; int ys; int yc
> + unsigned int ym; int ye; int ys __maybe_unused; int yc
>
> #define COMPZSP \
> unsigned int zm; int ze; int zs; int zc
This will silence the warning, but will do it for all future cases of unused
ys too - in other words, it may well silence even useful, valid warnings.
Also, this introduces an inconsistency among COMPXSP, COMPYSP, and COMPZSP
macros.
A better solution would be to reduce the scope of ys, so that it is always
used, if declared. Instead of this code segment (in arch/mips/math-emu/sp_fdp.c):
union ieee754sp ieee754sp_fdp(union ieee754dp x)
{
union ieee754sp y;
u32 rm;
COMPXDP;
COMPYSP;
EXPLODEXDP;
ieee754_clearcx();
FLUSHXDP;
switch (xc) {
case IEEE754_CLASS_SNAN:
x = ieee754dp_nanxcpt(x);
EXPLODEXDP;
/* Fall through. */
case IEEE754_CLASS_QNAN:
y = ieee754sp_nan_fdp(xs, xm);
if (!ieee754_csr.nan2008) {
EXPLODEYSP;
if (!ieee754_class_nan(yc))
y = ieee754sp_indef();
}
return y;
.. should be the following: (COMPYSP is moved to a smaller code block)
union ieee754sp ieee754sp_fdp(union ieee754dp x)
{
union ieee754sp y;
u32 rm;
COMPXDP;
EXPLODEXDP;
ieee754_clearcx();
FLUSHXDP;
switch (xc) {
case IEEE754_CLASS_SNAN:
x = ieee754dp_nanxcpt(x);
EXPLODEXDP;
/* Fall through. */
case IEEE754_CLASS_QNAN:
{
COMPYSP;
y = ieee754sp_nan_fdp(xs, xm);
if (!ieee754_csr.nan2008) {
EXPLODEYSP;
if (!ieee754_class_nan(yc))
y = ieee754sp_indef();
}
return y;
}
Regards,
Aleksandar
next prev parent reply other threads:[~2017-12-26 15:13 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-12-26 10:45 [PATCH 1/2] MIPS: math-emu: Do not export function `srl128` Mathieu Malaterre
2017-12-26 10:45 ` [PATCH 2/2] MIPS: math-emu: Declare ys variable as possibly unused Mathieu Malaterre
2017-12-26 15:12 ` Aleksandar Markovic [this message]
2017-12-27 8:40 ` Mathieu Malaterre
2017-12-26 15:14 ` [PATCH 1/2] MIPS: math-emu: Do not export function `srl128` Aleksandar Markovic
2017-12-26 18:10 ` Aleksandar Markovic
2017-12-27 8:26 ` Mathieu Malaterre
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=BD3A5F1946F2E540A31AF2CE969BAEEEC28256@MIPSMAIL01.mipstec.com \
--to=aleksandar.markovic@mips.com \
--cc=Miodrag.Dinic@mips.com \
--cc=douglas.leung@imgtec.com \
--cc=goran.ferenc@imgtec.com \
--cc=jhogan@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mips@linux-mips.org \
--cc=malat@debian.org \
--cc=ralf@linux-mips.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®