qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Zenghui Yu <yuzenghui@huawei.com>
To: Richard Henderson <richard.henderson@linaro.org>,
	<pbonzini@redhat.com>, <tony.nguyen@bt.com>
Cc: wanghaibin.wang@huawei.com, qemu-devel@nongnu.org,
	Euler Robot <euler.robot@huawei.com>
Subject: Re: [PATCH] memory: Use QEMU_ALWAYS_INLINE to silence compile-time warning
Date: Wed, 5 Feb 2020 21:47:07 +0800	[thread overview]
Message-ID: <4921c341-0af5-013e-0bc2-7f3a1295a03f@huawei.com> (raw)
In-Reply-To: <d4c5fcd1-480e-d763-4a23-a4b145ace793@linaro.org>

Hi Richard,

On 2020/2/5 18:31, Richard Henderson wrote:
> On 2/5/20 10:01 AM, Richard Henderson wrote:
>> On 2/5/20 8:17 AM, Zenghui Yu wrote:
>>> Our robot reported the following compile-time warning while compiling
>>> Qemu with -fno-inline cflags:
>>
>> Why are you doing this?

I'm not sure why it was added in the building test. As you said,
there's just a arbitrary combination of compile flags.

>>
>>>
>>> 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();
>>>           ^~~~~~~~~~~~~~~~~~~~~~~~
>>>      [...]
>>
>> Of course, the assert is compiled out when optimization is off, which is the
>> only time we expect inlining to be off.
>>
>> The patch isn't wrong, exactly, but I question whether we want to support
>> completely arbitrary combinations of compile flags.

It doesn't hurt to do the right thing, and you already have the
good approach :)

> 
> To follow up: if you *really* need to support -fno-inline, then perhaps the
> correct patch is to change
> 
> - #ifdef __OPTIMIZE__
> + #if defined(__OPTIMIZE__) && !defined(__NO_INLINE__)
>    extern void QEMU_NORETURN QEMU_ERROR("code path is reachable")
>        qemu_build_not_reached(void);
>    #else
>    #define qemu_build_not_reached()  g_assert_not_reached()
>    #endif
> 
> within include/qemu/compiler.h.

Thanks for this. I've tested it with -fno-inlie and it indeed works.
I will send it as v2.


Thanks,
Zenghui



      reply	other threads:[~2020-02-05 13:48 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-05  8:17 [PATCH] memory: Use QEMU_ALWAYS_INLINE to silence compile-time warning Zenghui Yu
2020-02-05 10:01 ` Richard Henderson
2020-02-05 10:31   ` Richard Henderson
2020-02-05 13:47     ` Zenghui Yu [this message]

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=4921c341-0af5-013e-0bc2-7f3a1295a03f@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).