From patchwork Sun May 13 09:57:51 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Weil X-Patchwork-Id: 10396149 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 7AB3E602B1 for ; Sun, 13 May 2018 09:59:23 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6076E2906B for ; Sun, 13 May 2018 09:59:23 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 51FB42906D; Sun, 13 May 2018 09:59:23 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00, MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 9E8F22906B for ; Sun, 13 May 2018 09:59:22 +0000 (UTC) Received: from localhost ([::1]:56739 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fHnmj-0001vz-7w for patchwork-qemu-devel@patchwork.kernel.org; Sun, 13 May 2018 05:59:21 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40191) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fHnlT-0002kt-Vk for qemu-devel@nongnu.org; Sun, 13 May 2018 05:58:04 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fHnlT-00076v-6c for qemu-devel@nongnu.org; Sun, 13 May 2018 05:58:04 -0400 Received: from mail.weilnetz.de ([37.120.169.71]:41950 helo=v2201612906741603.powersrv.de) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fHnlM-00073c-Tg; Sun, 13 May 2018 05:57:57 -0400 Received: from localhost (localhost [127.0.0.1]) by v2201612906741603.powersrv.de (Postfix) with ESMTP id 62115DAC719; Sun, 13 May 2018 11:57:54 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at v2201612906741603.powersrv.de Received: from v2201612906741603.powersrv.de ([127.0.0.1]) by localhost (v2201612906741603.powersrv.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id xiyt6Gz6AotQ; Sun, 13 May 2018 11:57:51 +0200 (CEST) Received: from [192.168.178.24] (p5B151186.dip0.t-ipconnect.de [91.21.17.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by v2201612906741603.powersrv.de (Postfix) with ESMTPSA id 7BC33DAC714; Sun, 13 May 2018 11:57:51 +0200 (CEST) To: Peter Maydell , QEMU Developer References: <20180513090613.27960-1-sw@weilnetz.de> From: Stefan Weil Message-ID: Date: Sun, 13 May 2018 11:57:51 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.7.0 MIME-Version: 1.0 In-Reply-To: <20180513090613.27960-1-sw@weilnetz.de> Content-Language: en-GB X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 37.120.169.71 Subject: Re: [Qemu-devel] [PATCH] disas/libvixl: Fix VIXL_FALLTHROUGH macro for QEMU X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: qemu-arm@nongnu.org Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP 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 > --- > > 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 int64_t offset = instr->ImmCondBranch() << 2; 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.