Received: by 2002:ac0:aa62:0:0:0:0:0 with SMTP id w31-v6csp2238847ima; Mon, 22 Oct 2018 06:41:52 -0700 (PDT) X-Google-Smtp-Source: ACcGV61qC1IU2IOXyvLnb6Yd8BQ4qgD7dHH7r9WM8PvmrNG/yBObMHxp5d0nD7+uClKg7LKiLcEG X-Received: by 2002:a62:1316:: with SMTP id b22-v6mr45731640pfj.37.1540215712919; Mon, 22 Oct 2018 06:41:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1540215712; cv=none; d=google.com; s=arc-20160816; b=oZcILBpcK7G0Ri0Epsgpxcii/bHHSwpEvF1XbFCrVctNQCU8gpYsjT1xdcnJesBDOJ tTuQ/BAuHNgfkVQa40VHYkeUO+/LhqD7eKda73lg4J1niXWOVuer2wdV68w+BwCT7ejY fXqIvAZw3ksUHWg67Dy5D3cVuUmJBHtZx1w754yWa5P7fwFMfvKMlzxBFbpn7GZOu57i oPPgmyNgQZ9Afxl+lHf7U0TvOtragBBbJfU4iStH+UEzqmo0ji36kkwqc5KepmsbSIjT +BeSCN5jjQjJ3ICK2r6a204evaY+XREvoJ0P3LdFJWyzL8Z+mwcIDcb+XoqVr8C+5Cyy fmpQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=C8sQfTUcLqE8TApD3u96Q2vEEW2OfQeFAA+2Uyiw28k=; b=LQFH8AkAfRk6tC2kwBqLJ9KTaR0cXlYYX1kw1GilMDqjXls8D6KA7ukRJ53S9gKo6m OPPdzqGJEFvONUIKZm4U3oY0aslL3Mc6FWavdiYyGQ5iPWGW23zTSJYwX1/M6xzmlE3M RLyQsobKuIbsWnaJ6x0dF+LEtUuCC5JMYL7RJjeevPO33zLN4X9MOIQ4QI7L52/SCsHe r2jJOgpkQPPoRjiDLOT2E+HSuOxmvQNLDMXqJnPRkr3VigvrdBWnrHK9dJJGRyfgDgJD MnyTxXQA2grhmlFQNJ7zBNtH+riDJGFqfqri6l+Eq9vbk3Nx2Pn4reldKooNYvfhhe+6 juAw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=QNV+Rb8m; 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=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g16-v6si4893046pfd.86.2018.10.22.06.41.36; Mon, 22 Oct 2018 06:41: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=@gmail.com header.s=20161025 header.b=QNV+Rb8m; 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=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728030AbeJVV6j (ORCPT + 99 others); Mon, 22 Oct 2018 17:58:39 -0400 Received: from mail-lf1-f65.google.com ([209.85.167.65]:39184 "EHLO mail-lf1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727210AbeJVV6j (ORCPT ); Mon, 22 Oct 2018 17:58:39 -0400 Received: by mail-lf1-f65.google.com with SMTP id p11-v6so3979338lfc.6; Mon, 22 Oct 2018 06:39:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=C8sQfTUcLqE8TApD3u96Q2vEEW2OfQeFAA+2Uyiw28k=; b=QNV+Rb8mbd8RR9TR0kmkIsA4awKsTC6rLUIYmb8YNk9PiJtpkWrSFlPGV93GEvQR/b MOe4yx++K+9FYqaoG9IiWD5jYohQJeNrZjBzHx4ys/ToJrd4xQ4VT6eSqKhpggV9RLl1 mGalG7Ty0J8qJEriXY0WptLIhSU6iSrpFCwdLmHgPmD8q9EXaDh9j5ap//NPjkd80BZc krQ541rKPQTtEkus5EGm6bZWbbXgjSrr1N8gQ4i5W8r1slGavX+kXEaCPelnwOw/ofwZ 7RQdX1srDOGiA8K+gf8H5YQhc73cyVDswNflrQhhpobEx+wDMqgOp5XZLllDEnqjDmgp ofeg== 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:cc; bh=C8sQfTUcLqE8TApD3u96Q2vEEW2OfQeFAA+2Uyiw28k=; b=aqxoMdP03JKQJ1oQuLwF3JjfIjZptYMXHv+MKO1BKWNMdBQLx/fs7z4lOmGGM4sqoj UV92krHFzwhQ/sMSvTW3kXkbmVadtur1SYI9OQidwhWFMx1GeSn0S01sCQaLtibemq7B IJ3XS1HbPYe50TvN1aiHi82zEoQ/cvIAd5cmVm0XKJkK/r9uUZ7DYC9JQxoJc7i/MxzW c8sYtlS+Z11z3GORpmC2K76uS8orE9tCoh49ugaGBx8prNuwte3SilnjazX7nkvg+xuG vxC65ESNcK+5dCcSDerjYWT/DDB8oaGjH1owOdMuHH3l964SSDHwowqV8K901h4LaWBo HK4g== X-Gm-Message-State: ABuFfohMumVnMZ13yggc56KQTRtCq2H6aPBbWfqAYWbnPbx3AtjtJb8C luHHuVnMD+Y8Svb6kevAUwtC0BWsHze2vmUzPSI= X-Received: by 2002:a19:11c2:: with SMTP id 63mr9060920lfr.131.1540215598557; Mon, 22 Oct 2018 06:39:58 -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> In-Reply-To: From: Miguel Ojeda Date: Mon, 22 Oct 2018 15:39:47 +0200 Message-ID: Subject: Re: [PATCH 1/2] Compiler Attributes: add support for __fallthrough (gcc >= 7.1) To: Kees Cook Cc: "Gustavo A. R. Silva" , "Ted Ts'o" , Greg KH , linux-kernel , Dan , Andreas Dilger , Masahiro Yamada , Michal Marek , Steven Rostedt , Mauro Carvalho Chehab , Olof Johansson , Konstantin Ryabitsev , David Miller , Andrey Ryabinin , Thomas Gleixner , Ingo Molnar , Paul Lawrence , Sandipan Das , Andrey Konovalov , David Woodhouse , Will Deacon , Philippe Ombredanne , Paul Burton , David Rientjes , Willy Tarreau , Martin Sebor , Christopher Li , Jonathan Corbet , Geert Uytterhoeven , Rasmus Villemoes , Joe Perches , Arnd Bergmann , Dominique Martinet , Stefan Agner , Luc Van Oostenryck , Nick Desaulniers , Andrew Morton , Linus Torvalds , Linux Doc Mailing List , Ext4 Developers List , linux-sparse@vger.kernel.org, linux-kbuild@vger.kernel.org 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 1:24 PM Miguel Ojeda wrote: > > On Mon, Oct 22, 2018 at 12:53 PM Kees Cook wrote: > > > > On Mon, Oct 22, 2018 at 2:41 AM, Miguel Ojeda > > wrote: > > > > > * clang does *not* support the attribute in C. > > > > Well that's not good. :) > > I will see with clang if they plan to add it. > So I have looked in the clang sources and I have seen that clang is already preparing for C2x: since clang >= 6 we can actually enable the C++-like attributes with "-fdouble-square-bracket-attributes" in C mode, which in turn makes the warning work in C mode and can be suppressed with [[fallthrough]]. This would give us the warning also in clang, which would be a win vs. the comments. Nick? However, I don't see a way to enable [[fallthrough]] in C mode for gcc >= 7.1 -- from a quick look, the C parser does not know about [[]] attributes, so I don't think we can use [[fallthrough]] for both compilers (yet). Cheers, Miguel