[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <3cbb5345-0270-5575-7563-6ad37d888e42@petrovitsch.priv.at>
Date: Mon, 22 Oct 2018 19:49:21 +0200
From: Bernd Petrovitsch <bernd@...rovitsch.priv.at>
To: Miguel Ojeda <miguel.ojeda.sandonis@...il.com>,
Dan <dan.carpenter@...cle.com>
Cc: "Ted Ts'o" <tytso@....edu>, Greg KH <gregkh@...uxfoundation.org>,
linux-kernel <linux-kernel@...r.kernel.org>,
Andreas Dilger <adilger.kernel@...ger.ca>,
Masahiro Yamada <yamada.masahiro@...ionext.com>,
Michal Marek <michal.lkml@...kovi.net>,
Steven Rostedt <rostedt@...dmis.org>,
Mauro Carvalho Chehab <mchehab+samsung@...nel.org>,
Olof Johansson <olof@...m.net>,
Konstantin Ryabitsev <konstantin@...uxfoundation.org>,
David Miller <davem@...emloft.net>,
Andrey Ryabinin <aryabinin@...tuozzo.com>,
Kees Cook <keescook@...omium.org>,
Thomas Gleixner <tglx@...utronix.de>,
Ingo Molnar <mingo@...nel.org>,
Paul Lawrence <paullawrence@...gle.com>,
Sandipan Das <sandipan@...ux.vnet.ibm.com>,
Andrey Konovalov <andreyknvl@...gle.com>,
David Woodhouse <dwmw2@...radead.org>,
Will Deacon <will.deacon@....com>,
Philippe Ombredanne <pombredanne@...b.com>,
Paul Burton <paul.burton@...s.com>,
David Rientjes <rientjes@...gle.com>, Willy Tarreau <w@....eu>,
Martin Sebor <msebor@...il.com>,
Christopher Li <sparse@...isli.org>,
Jonathan Corbet <corbet@....net>,
Geert Uytterhoeven <geert@...ux-m68k.org>,
Rasmus Villemoes <linux@...musvillemoes.dk>,
Joe Perches <joe@...ches.com>, Arnd Bergmann <arnd@...db.de>,
Dominique Martinet <asmadeus@...ewreck.org>,
Stefan Agner <stefan@...er.ch>,
Luc Van Oostenryck <luc.vanoostenryck@...il.com>,
Nick Desaulniers <ndesaulniers@...gle.com>,
Andrew Morton <akpm@...ux-foundation.org>,
Linus Torvalds <torvalds@...ux-foundation.org>,
Linux Doc Mailing List <linux-doc@...r.kernel.org>,
Ext4 Developers List <linux-ext4@...r.kernel.org>,
linux-sparse@...r.kernel.org, linux-kbuild@...r.kernel.org,
ndesaulniers@...gle.com
Subject: Re: [PATCH 1/2] Compiler Attributes: add support for __fallthrough
(gcc >= 7.1)
Hi all!
On 22/10/18 13:07, Miguel Ojeda wrote:
> On Mon, Oct 22, 2018 at 12:54 PM Dan Carpenter <dan.carpenter@...cle.com> wrote:
>>
>> Doing both is super ugly. Let's just do comments until Eclipse gets
>> updated.
Yes, "Eclipse" as the IDE.
And yes but IMHO better super ugly than loosing the warning - YMMV.
For the archives: I have Eclipse Photon/June 2016 here. And "no break"
is the (default) string in a comment used by Eclipse (it can be
customized and is actually a regexp but it must be in a comment).
>> I had wanted to move to the attribute because that would simplify things
>> in Smatch but it's not a huge deal to delay for another year.
>
> I can re-send them later on, no problem. On the other hand, doing the
> changes will push tools to get updated sooner ;-)
>
> If tools were doing something as fancy as comment parsing for
> diagnostics, they should have been updated with the attribute support
> (either gcc's or C++17's) -- it has been more than a year now since
> gcc 7.1 and the C++17 final draft. (Note that this does not apply for
> things like clang, since they weren't doing comment parsing to begin
> with.)
That would be nice. And if they agree on the same texts (or accept per
default all somewhat widely used and/or old ones).
After stumbling over
https://stackoverflow.com/questions/16935935/how-do-i-turn-off-a-static-code-analysis-warning-on-a-line-by-line-warning-in-cd,
looking into Eclipses Window -> Preferences -> C/C++ -> Code Analysis ->
"No break at the end of case" screen (that's the screenshot there) and I
tried various things:
Preface:
I have
---- snip ----
#define __fallthrough __attribute__((fallthrough))
---- snip ----
for gcc >= 7 (because clang doesn't know it and I had also older
gcc's in use before).
So:
- Adding a comment to the #define doesn't change anything for Eclipse.
- Eclipse looks *only* in comments for the string/regexp given
the warnings configuration (and that comment must be on the line
directly before the "case").
- Eclipse understands [[fallthrough]] out-of-the-box though (which
is C++11 AFAIK) as does g++-7 (I use -std=gnu++17 - most of the
sources are C++, but not all) and clang++-6 (all the current standard
Ubuntu-18.06/Bionic packages).
Eclipse "accepts" [[fallthrough]] only in C++ sources (and not in C
sources).
- Neither gcc nor clang understand [[fallthrough]] (so it's probably a
no-go for the Kernel with C89 anyways).
MfG,
Bernd
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;-).
I have lots of switch()es which catch undefined values (for enums
et. al.) with "default"+assert() and fall through to the most safe
case (for the deployed version).
--
"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
Download attachment "pEpkey.asc" of type "application/pgp-keys" (2473 bytes)
Powered by blists - more mailing lists