From: Zenghui Yu <yuzenghui@huawei.com>
To: <pbonzini@redhat.com>, <richard.henderson@linaro.org>,
<tony.nguyen@bt.com>
Cc: Zenghui Yu <yuzenghui@huawei.com>,
wanghaibin.wang@huawei.com, qemu-devel@nongnu.org,
Euler Robot <euler.robot@huawei.com>
Subject: [PATCH] memory: Use QEMU_ALWAYS_INLINE to silence compile-time warning
Date: Wed, 5 Feb 2020 16:17:03 +0800 [thread overview]
Message-ID: <20200205081703.631-1-yuzenghui@huawei.com> (raw)
Our robot reported the following compile-time warning while compiling
Qemu with -fno-inline cflags:
In function 'load_memop',
inlined from 'load_helper' at /qemu/accel/tcg/cputlb.c:1578:20,
inlined from 'full_ldub_mmu' at /qemu/accel/tcg/cputlb.c:1624:12:
/qemu/accel/tcg/cputlb.c:1502:9: error: call to 'qemu_build_not_reached' declared with attribute error: code path is reachable
qemu_build_not_reached();
^~~~~~~~~~~~~~~~~~~~~~~~
[...]
It looks like a false-positive because only (MO_UB ^ MO_BSWAP) will
hit the default case in load_memop() while need_swap (size > 1) has
already ensured that MO_UB is not involved.
Apply QEMU_ALWAYS_INLINE on memop_size() to make sure it will always
be inlined while we're using the compile-time assert, so that the
compilers won't get confused.
Reported-by: Euler Robot <euler.robot@huawei.com>
Signed-off-by: Zenghui Yu <yuzenghui@huawei.com>
---
Not sure if it's the right fix, but seems works fine to me :)
include/exec/memop.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/include/exec/memop.h b/include/exec/memop.h
index 529d07b02d..5403f960e0 100644
--- a/include/exec/memop.h
+++ b/include/exec/memop.h
@@ -110,7 +110,7 @@ typedef enum MemOp {
} MemOp;
/* MemOp to size in bytes. */
-static inline unsigned memop_size(MemOp op)
+static inline unsigned QEMU_ALWAYS_INLINE memop_size(MemOp op)
{
return 1 << (op & MO_SIZE);
}
--
2.19.1
next reply other threads:[~2020-02-05 8:19 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-02-05 8:17 Zenghui Yu [this message]
2020-02-05 10:01 ` [PATCH] memory: Use QEMU_ALWAYS_INLINE to silence compile-time warning Richard Henderson
2020-02-05 10:31 ` Richard Henderson
2020-02-05 13:47 ` Zenghui Yu
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=20200205081703.631-1-yuzenghui@huawei.com \
--to=yuzenghui@huawei.com \
--cc=euler.robot@huawei.com \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=richard.henderson@linaro.org \
--cc=tony.nguyen@bt.com \
--cc=wanghaibin.wang@huawei.com \
/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;
as well as URLs for NNTP newsgroup(s).