[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [RFC 1/8] ui/vnc-enc-tight: add abort() for unexpected
From: |
Paolo Bonzini |
Subject: |
Re: [Qemu-devel] [RFC 1/8] ui/vnc-enc-tight: add abort() for unexpected default |
Date: |
Tue, 20 Sep 2016 10:24:59 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.2.0 |
On 20/09/2016 10:02, Marc-André Lureau wrote:
> Hi
>
> On Mon, Sep 19, 2016 at 7:58 PM Alex Bennée <address@hidden
> <mailto:address@hidden>> wrote:
>
> When enabling the sanitizer build it will complain about control
> reaching a non-void function. Normally the compiler should detect that
> there is only one possible exit given a static VNC_SERVER_FB_BYTES.
>
> As we should never get here I added an abort() rather than a default
> return value.
>
> Signed-off-by: Alex Bennée <address@hidden
> <mailto:address@hidden>>
> ---
> ui/vnc-enc-tight.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/ui/vnc-enc-tight.c b/ui/vnc-enc-tight.c
> index 49df85e..9e4d254 100644
> --- a/ui/vnc-enc-tight.c
> +++ b/ui/vnc-enc-tight.c
> @@ -710,6 +710,8 @@ static bool check_solid_tile(VncState *vs, int
> x, int y, int w, int h,
> switch (VNC_SERVER_FB_BYTES) {
> case 4:
> return check_solid_tile32(vs, x, y, w, h, color, samecolor);
> + default:
> + abort();
> }
> }
>
>
>
> Reviewed-by: Marc-André Lureau <address@hidden
> <mailto:address@hidden>>
>
> Looks fine. Would it make sense to use a
> G_STATIC_ASSERT(VNC_SERVER_FB_BYTES == 4) above instead?
Or QEMU_BUILD_BUG_ON(VNC_SERVER_FB_BYTES != 4) :)
Paolo
> --
> Marc-André Lureau
[Qemu-devel] [RFC 3/8] new: blacklist.tsan, Alex Bennée, 2016/09/19
[Qemu-devel] [RFC 4/8] seqlock: use atomic writes for the sequence, Alex Bennée, 2016/09/19
[Qemu-devel] [RFC 8/8] .travis.yml: add gcc sanitizer build, Alex Bennée, 2016/09/19
[Qemu-devel] [RFC 7/8] util/qht: atomically set b->hashes, Alex Bennée, 2016/09/19