Received: by 2002:ac0:aa62:0:0:0:0:0 with SMTP id w31-v6csp2681775ima; Mon, 22 Oct 2018 14:04:52 -0700 (PDT) X-Google-Smtp-Source: AJdET5cSXCA6FB4WvaDSZSzC0joD/MnTY9YKXrZnv4aHDIxH023pbpRzA2b74xmwubmjq8wmqbeq X-Received: by 2002:a63:4617:: with SMTP id t23-v6mr6801374pga.197.1540242292704; Mon, 22 Oct 2018 14:04:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1540242292; cv=none; d=google.com; s=arc-20160816; b=IHE2MNGNLKiEzU5xV3vsWpoOx/jl7YZ2nW/Nnf87npUAb5o2rVZiaCNVlcwEDqF9z6 pL65Ii4X9V6ozbXBsRv7wZtZ8da2zHgvxpOYbWE4Yu0o0VHvBop5gGy0MgR/rerBUtg2 8aZVXltCKyojfgKe4aaU4gbnrJ330uajF+QPqtuBBRsbGhNv3LbubaanjcASdUT3F97m if5kQtstOVcJNf6gZvoUu0ezOJWFw5vS5nwzMChL93MvPvC8OoebC6/4kaVNF7PyMLsw w4QLDeR6PpusZ4UjSckKyyi+IPID9rN8Ck9P75B3S3uxH2vz7KhbBNY2fCvFh103HW+P o1sw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=u/Pwa2TZBmzrAPj1hOKdRFXF6gQtKwbiyfIpLq3cGAI=; b=ExqgoY5y79hNAye7Z5PnRKnJEZKrqdCM3BZPjm0IUU6+uYAHt3haUsSMpCCWvzeNyS C2mjiCEy1XR0fWKA7Ei+e08iungL5rN5w5TLl5LuaXcZiBSNfghVIVGXwfU9r1dOFSOb HLGlL6N3JiS8Z66Xi9lO7u2vPGefIrwRFRgc10ownaey35Dli3WFt0bK4MI94uB4uoFM +Nzg7cGM4eW1IUHWdpZcfb8wtrSdvI2xQkOXzf5gb6E8OM4YvU8aaagn/hN3QM5BDYP1 vZTZhKFa4/6dvLmIiN5uYvWyf5I3K+ItCdiPlrqau3PxU/YjYdvyNhMW+q3tGfhnIFID OHXw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=dc6Hxk1z; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e193-v6si34193296pfc.131.2018.10.22.14.04.36; Mon, 22 Oct 2018 14:04:52 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=dc6Hxk1z; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727625AbeJWEQn (ORCPT + 99 others); Tue, 23 Oct 2018 00:16:43 -0400 Received: from mail-pf1-f193.google.com ([209.85.210.193]:42604 "EHLO mail-pf1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727558AbeJWEQn (ORCPT ); Tue, 23 Oct 2018 00:16:43 -0400 Received: by mail-pf1-f193.google.com with SMTP id f26-v6so20423484pfn.9 for ; Mon, 22 Oct 2018 12:56:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to; bh=u/Pwa2TZBmzrAPj1hOKdRFXF6gQtKwbiyfIpLq3cGAI=; b=dc6Hxk1zk8prs8Augw9kA4QUDytC/6ZeNVoBAjBGla8L7mS3jWNcDQmXswAldkCrKB 7VLK9DKAlYM6IMZEFoTdQCgmoIextS/33wXxdGTHWswlBH/+MPJRETpzt5zb6o4liS9M qwyRRjeZeYougvbvR/l4QN9HrNZECt/P/z+A1iL1CSe65WbijoWLbrUIFHiRDoKHUuMw 9RdRaVs/EXkOsCc/y99cNYiLZxNbVwyTtPvbVe1KO6fLG46fjSOKzNJB5hOoosbApfDo he/E841pBoy5xYBjQhqLfBklLznhBa3xDv4cl+AqTVhe8PXXW9G88J8IsCoJfUE1WGyh 1x1g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to; bh=u/Pwa2TZBmzrAPj1hOKdRFXF6gQtKwbiyfIpLq3cGAI=; b=h8+ir5krwsqbdNakpkuzXobOJg7j6wzklt4HsB000XDz9LzDrHJgkK2UPAkQAijKxa yR0weBwKM4Le+rUyzX/E2q0oyKFMg3OGu1AdRdpycmmD0ySemuTJjlwd3xxzZFeYr64H NK8iNYgzfb5xKKX6UcECAF1o3206D3HQxsxm+FiF+iYB/9QlX2RkXAc82dRTi/7ZaStS ZTN/hwjkK2Kr4bqYP7Hw4YZcT4YYKEgDaoLQBylZRk9fjiSffutEZRUWebg3nEjqplus 995kTCtjzGhVh3/DXJPZckmfA1ogvGF7UZ5p+mj8B/IJyrm7gnC32pGFJGmgLgtC+4hk aTWg== X-Gm-Message-State: AGRZ1gLFkY1ACFy4SQieCbRcxbX0yYziBfXrbRZWoSWPpxHGoEylDTKs xievxllmOtu7ulR5qUoNWOd3xE1sK2bBC3SlpN+koQ== X-Received: by 2002:a63:42c1:: with SMTP id p184mr1824468pga.202.1540238208442; Mon, 22 Oct 2018 12:56:48 -0700 (PDT) MIME-Version: 1.0 References: <20181021171414.22674-1-miguel.ojeda.sandonis@gmail.com> <20181021171414.22674-2-miguel.ojeda.sandonis@gmail.com> <20181021222712.GI1617@thunk.org> <8fb78062-b6d4-6f2d-d943-44bec6b95ff0@petrovitsch.priv.at> <20181022102743.nua5fgbscyeymzal@mwanda> <1474d995-1b5a-2efb-f077-33eb4a5d9e31@petrovitsch.priv.at> <20181022105314.j6djkrpwbnokhai5@mwanda> <3cbb5345-0270-5575-7563-6ad37d888e42@petrovitsch.priv.at> <9c52827b-4783-8f39-9030-a166d5436f05@petrovitsch.priv.at> In-Reply-To: <9c52827b-4783-8f39-9030-a166d5436f05@petrovitsch.priv.at> From: Nick Desaulniers Date: Mon, 22 Oct 2018 12:56:37 -0700 Message-ID: Subject: Re: [PATCH 1/2] Compiler Attributes: add support for __fallthrough (gcc >= 7.1) To: bernd@petrovitsch.priv.at Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Oct 22, 2018 at 11:15 AM Bernd Petrovitsch wrote: > > Hi all! > > On 22/10/18 19:54, Nick Desaulniers wrote: > > On Mon, Oct 22, 2018 at 10:50 AM Bernd Petrovitsch > > wrote: > [...] > >> PS: clang++ errors with "fallthrough annotation in unreachable code" if > >> [[fallthrough]] is after an assert(). clang-devs there, please, the > >> fallthrough doesn't really generated code (I hope;-). > [...] > > Can you send me a link to a simple reproducer in godbolt (godbolt.org) > > and we'll take a look? > > Does https://godbolt.org/z/2Y4zIo do it - I'm a godbolt-newbie? Moving the kernel folks to bcc, since we don't need to be discussing C++ on LKML. https://godbolt.org/z/B1fo9Z shows that this works as intended, for cases that cannot be statically proven. I guess I'm looking for a more realistic code sample to show why putting a `break;` statement there is untenable? > > For > ---- snip ---- > #include > > int main(void) > { > switch (1) { > default: > assert(0); > [[fallthrough]]; > case 1: > ; > } > return 0; > } > ---- snip ---- > Just "clang++ -Wimplicit-fallthrough -Werror" it ..... > > MfG, > Bernd > -- > "I dislike type abstraction if it has no real reason. And saving > on typing is not a good reason - if your typing speed is the main > issue when you're coding, you're doing something seriously wrong." > - Linus Torvalds -- Thanks, ~Nick Desaulniers