All of lore.kernel.org
 help / color / mirror / Atom feed
From: Stefan Weil <sw@weilnetz.de>
To: Peter Maydell <peter.maydell@linaro.org>,
	QEMU Developer <qemu-devel@nongnu.org>
Cc: qemu-arm@nongnu.org
Subject: Re: [Qemu-devel] [PATCH] disas/libvixl: Fix VIXL_FALLTHROUGH macro for QEMU
Date: Sun, 13 May 2018 11:57:51 +0200	[thread overview]
Message-ID: <cc3f26a7-a8b7-35a8-9ffa-c5940c9c1927@weilnetz.de> (raw)
In-Reply-To: <20180513090613.27960-1-sw@weilnetz.de>

Am 13.05.2018 um 11:06 schrieb Stefan Weil:
> It now prevents compiler warnings (enabled with -Wimplicit-fallthrough=
> or -Wextra) as intended.
> 
> Signed-off-by: Stefan Weil <sw@weilnetz.de>
> ---
> 
> I suggest to add and use a similar macro QEMU_FALLTHROUGH()
> for the rest of the code and can provide a patch if that's
> fine for everyone.
> 
> Regards
> Stefan
> 
>  disas/libvixl/vixl/globals.h | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/disas/libvixl/vixl/globals.h b/disas/libvixl/vixl/globals.h
> index 61dc9f7f7e..33c4231d91 100644
> --- a/disas/libvixl/vixl/globals.h
> +++ b/disas/libvixl/vixl/globals.h
> @@ -112,6 +112,8 @@ inline void USE(T1, T2, T3, T4) {}
>  // C++11(201103L).
>  #if __has_warning("-Wimplicit-fallthrough") && __cplusplus >= 201103L
>    #define VIXL_FALLTHROUGH() [[clang::fallthrough]] //NOLINT
> +#elif defined(__GNUC__)
> +  #define VIXL_FALLTHROUGH() __attribute__((fallthrough))
>  #else
>    #define VIXL_FALLTHROUGH() do {} while (0)
>  #endif


Even with the above patch, disas/libvixl raises a compiler warning for a
fall through case. The patch below fixes that warning, but I am not sure
whether a fall through is correct there.

Stefan


diff --git a/disas/libvixl/vixl/a64/disasm-a64.cc
b/disas/libvixl/vixl/a64/disasm-a64.cc
index 7a58a5c087..5481d94209 100644
--- a/disas/libvixl/vixl/a64/disasm-a64.cc
+++ b/disas/libvixl/vixl/a64/disasm-a64.cc
@@ -2986,6 +2986,7 @@ int Disassembler::SubstituteImmediateField(const
Instruction* instr,
           return 3;
         }
       }
+      VIXL_FALLTHROUGH(); // ???
     }
     case 'C': {  // ICondB - Immediate Conditional Branch.
       int64_t offset = instr->ImmCondBranch() << 2;

  reply	other threads:[~2018-05-13  9:58 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-13  9:06 [Qemu-devel] [PATCH] disas/libvixl: Fix VIXL_FALLTHROUGH macro for QEMU Stefan Weil
2018-05-13  9:57 ` Stefan Weil [this message]
2018-05-13 14:44   ` Peter Maydell
2018-05-15 12:13   ` Peter Maydell
2018-05-15 13:13     ` Stefan Weil
2018-05-15 13:25       ` Peter Maydell
2018-05-15 14:46         ` Richard Henderson
2018-05-15 14:51           ` Peter Maydell
2018-05-18 10:34           ` Peter Maydell
2018-05-18 15:57             ` Richard Henderson
2018-05-17 16:15       ` Peter Maydell

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=cc3f26a7-a8b7-35a8-9ffa-c5940c9c1927@weilnetz.de \
    --to=sw@weilnetz.de \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-arm@nongnu.org \
    --cc=qemu-devel@nongnu.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.