Return-Path: Received: from imap.thunk.org ([74.207.234.97]:43514 "EHLO imap.thunk.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726784AbeJVPQP (ORCPT ); Mon, 22 Oct 2018 11:16:15 -0400 Date: Mon, 22 Oct 2018 02:58:00 -0400 From: "Theodore Y. Ts'o" To: Matthew Wilcox Cc: Miguel Ojeda , Greg Kroah-Hartman , linux-kernel@vger.kernel.org, Dan Carpenter , Andreas Dilger , Masahiro Yamada , Michal Marek , Steven Rostedt , Mauro Carvalho Chehab , Olof Johansson , Konstantin Ryabitsev , "David S . Miller" , Andrey Ryabinin , Kees Cook , 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@vger.kernel.org, linux-ext4@vger.kernel.org, linux-sparse@vger.kernel.org, linux-kbuild@vger.kernel.org Subject: Re: [PATCH 1/2] Compiler Attributes: add support for __fallthrough (gcc >= 7.1) Message-ID: <20181022065800.GK1617@thunk.org> References: <20181021171414.22674-1-miguel.ojeda.sandonis@gmail.com> <20181021171414.22674-2-miguel.ojeda.sandonis@gmail.com> <20181022004217.GA4941@bombadil.infradead.org> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="ikeVEW9yuYc//A+q" Content-Disposition: inline In-Reply-To: <20181022004217.GA4941@bombadil.infradead.org> Sender: linux-ext4-owner@vger.kernel.org List-ID: --ikeVEW9yuYc//A+q Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Sun, Oct 21, 2018 at 05:42:18PM -0700, Matthew Wilcox wrote: > On Sun, Oct 21, 2018 at 07:14:13PM +0200, Miguel Ojeda wrote: > > +#if __has_attribute(__fallthrough__) > > +# define __fallthrough __attribute__((__fallthrough__)) > > +#else > > +# define __fallthrough > > +#endif > > Why is the #else not: > > # define __fallthrough /* fallthrough */ > > Would this solve the Coverity problem, or does Coverity look at the raw > source code before preprocessing? Wouldn't the "/* ... */" be eaten by the preprocessor before defining the __fallthrough cpp macro? (e.g., try running the attached script) - Ted --ikeVEW9yuYc//A+q Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=foo #!/bin/bash cat << EOF > /tmp/test$$.c #define foobar quux /* foobar */ foobar EOF gcc -E /tmp/test$$.c rm -f /tmp/test$$.c --ikeVEW9yuYc//A+q--