From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:33132) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bmMXf-0001Tq-5B for qemu-devel@nongnu.org; Tue, 20 Sep 2016 11:01:04 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bmMXa-0007by-CJ for qemu-devel@nongnu.org; Tue, 20 Sep 2016 11:01:02 -0400 Received: from mail-wm0-f51.google.com ([74.125.82.51]:35304) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bmMXa-0007bb-5m for qemu-devel@nongnu.org; Tue, 20 Sep 2016 11:00:58 -0400 Received: by mail-wm0-f51.google.com with SMTP id l132so213984233wmf.0 for ; Tue, 20 Sep 2016 08:00:57 -0700 (PDT) References: <20160919155139.28371-1-alex.bennee@linaro.org> <20160919155139.28371-2-alex.bennee@linaro.org> <0f874df1-b508-9587-09f6-798c466c3e73@redhat.com> From: Alex =?utf-8?Q?Benn=C3=A9e?= In-reply-to: <0f874df1-b508-9587-09f6-798c466c3e73@redhat.com> Date: Tue, 20 Sep 2016 15:59:55 +0100 Message-ID: <87oa3ibor8.fsf@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Subject: Re: [Qemu-devel] [RFC 1/8] ui/vnc-enc-tight: add abort() for unexpected default List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Paolo Bonzini Cc: =?utf-8?Q?Marc-Andr=C3=A9?= Lureau , qemu-devel@nongnu.org, cota@braap.org, stefanha@redhat.com, kwolf@redhat.com, mttcg@greensocs.com, peter.maydell@linaro.org, claudio.fontana@huawei.com, nikunj@linux.vnet.ibm.com, jan.kiszka@siemens.com, mark.burton@greensocs.com, a.rigo@virtualopensystems.com, Gerd Hoffmann , serge.fdrv@gmail.com, bobby.prani@gmail.com, rth@twiddle.net, fred.konrad@greensocs.com Paolo Bonzini writes: > On 20/09/2016 10:02, Marc-André Lureau wrote: >> Hi >> >> On Mon, Sep 19, 2016 at 7:58 PM Alex Bennée > > 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 > > >> --- >> 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 > > >> >> 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) :) I'll do that! > > Paolo > >> -- >> Marc-André Lureau -- Alex Bennée