From: "Gustavo A. R. Silva" <gustavo@embeddedor.com>
To: Peter Zijlstra <peterz@infradead.org>, Joe Perches <joe@perches.com>
Cc: Ingo Molnar <mingo@redhat.com>,
Arnaldo Carvalho de Melo <acme@kernel.org>,
Alexander Shishkin <alexander.shishkin@linux.intel.com>,
Jiri Olsa <jolsa@redhat.com>, Namhyung Kim <namhyung@kernel.org>,
Thomas Gleixner <tglx@linutronix.de>,
Borislav Petkov <bp@alien8.de>, "H. Peter Anvin" <hpa@zytor.com>,
x86@kernel.org, Kan Liang <kan.liang@linux.intel.com>,
linux-kernel@vger.kernel.org, Kees Cook <keescook@chromium.org>,
Miguel Ojeda <miguel.ojeda.sandonis@gmail.com>,
Shawn Landden <shawn@git.icu>
Subject: Re: [PATCH] perf/x86/intel: Mark expected switch fall-throughs
Date: Mon, 24 Jun 2019 15:53:04 -0500 [thread overview]
Message-ID: <3dc75cd4-9a8d-f454-b5fb-64c3e6d1f416@embeddedor.com> (raw)
In-Reply-To: <20190624203737.GL3436@hirez.programming.kicks-ass.net>
On 6/24/19 3:37 PM, Peter Zijlstra wrote:
> On Mon, Jun 24, 2019 at 12:45:54PM -0700, Joe Perches wrote:
>> On Mon, 2019-06-24 at 21:31 +0200, Peter Zijlstra wrote:
>>> On Mon, Jun 24, 2019 at 11:19:13AM -0500, Gustavo A. R. Silva wrote:
>>>> In preparation to enabling -Wimplicit-fallthrough, mark switch
>>>> cases where we are expecting to fall through.
>>>>
>>>> This patch fixes the following warnings:
>>>>
>>>> arch/x86/events/intel/core.c: In function ‘intel_pmu_init’:
>>>> arch/x86/events/intel/core.c:4959:8: warning: this statement may fall through [-Wimplicit-fallthrough=]
>>>> pmem = true;
>>>> ~~~~~^~~~~~
>>>> arch/x86/events/intel/core.c:4960:2: note: here
>>>> case INTEL_FAM6_SKYLAKE_MOBILE:
>>>> ^~~~
>>>> arch/x86/events/intel/core.c:5008:8: warning: this statement may fall through [-Wimplicit-fallthrough=]
>>>> pmem = true;
>>>> ~~~~~^~~~~~
>>>> arch/x86/events/intel/core.c:5009:2: note: here
>>>> case INTEL_FAM6_ICELAKE_MOBILE:
>>>> ^~~~
>>>>
>>>> Warning level 3 was used: -Wimplicit-fallthrough=3
>>>>
>>>> This patch is part of the ongoing efforts to enable
>>>> -Wimplicit-fallthrough.
>>>>
>>>> Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
>>>
>>> I still consider it an abomination that the C parser looks at comments
>>> -- other than to delete them, but OK I suppose, I'll take it.
>>
>> I still believe Arnaldo's/Miguel's/Shawn's/my et al. suggestion of
>>
>> #define __fallthrough __attribute__((fallthrough))
>>
>> is far better.
>>
>> https://lkml.org/lkml/2017/2/9/845
>> https://lkml.org/lkml/2017/2/10/485
>> https://lore.kernel.org/lkml/20181021171414.22674-2-miguel.ojeda.sandonis@gmail.com/
>> https://lore.kernel.org/lkml/20190617155643.GA32544@amd/
>
> Oh yes, worlds better. Please, can we haz that instead?
>
Once the C++17 `__attribute__((fallthrough))` is more widely handled by C compilers,
static analyzers, and IDEs, we can switch to using that instead. Also, we are a few
warnings away (less than five) from being able to enable -Wimplicit-fallthrough. After
this option has been finally enabled (in v5.3) we can easily go and replace the comments
to whatever we agree upon.
Thanks
--
Gustavo
next prev parent reply other threads:[~2019-06-24 20:53 UTC|newest]
Thread overview: 52+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-06-24 16:19 Gustavo A. R. Silva
2019-06-24 19:31 ` Peter Zijlstra
2019-06-24 19:45 ` Joe Perches
2019-06-24 20:37 ` Peter Zijlstra
2019-06-24 20:53 ` Gustavo A. R. Silva [this message]
2019-06-24 20:57 ` Joe Perches
2019-06-25 7:20 ` Peter Zijlstra
2019-06-24 22:28 ` Miguel Ojeda
2019-06-25 7:18 ` Peter Zijlstra
2019-06-25 12:47 ` Miguel Ojeda
2019-06-25 18:15 ` Nick Desaulniers
2019-06-25 22:29 ` Joe Perches
2019-06-25 22:57 ` Nick Desaulniers
2019-06-25 23:25 ` Joe Perches
2019-06-26 8:49 ` Peter Zijlstra
2019-06-26 22:14 ` Nick Desaulniers
2019-06-27 7:12 ` Peter Zijlstra
2019-06-28 13:31 ` Peter Zijlstra
2019-06-28 18:44 ` Nick Desaulniers
2019-06-29 7:10 ` Peter Zijlstra
2019-06-25 17:12 ` Kees Cook
2019-06-25 18:05 ` Nathan Chancellor
2019-06-25 19:53 ` Thomas Gleixner
2019-06-25 20:27 ` Nathan Chancellor
2019-06-25 20:37 ` Nick Desaulniers
2019-06-25 21:47 ` Thomas Gleixner
2019-06-26 5:10 ` Nathan Chancellor
2019-06-26 15:18 ` Thomas Gleixner
2019-06-26 19:00 ` Nathan Chancellor
2019-06-26 19:46 ` Thomas Gleixner
2019-06-26 20:03 ` Nathan Chancellor
2019-06-26 9:24 ` Peter Zijlstra
2019-06-26 9:55 ` Peter Zijlstra
2019-06-26 22:23 ` Nick Desaulniers
2019-06-27 7:35 ` Peter Zijlstra
2019-06-26 10:43 ` Peter Zijlstra
2019-06-26 22:15 ` Nick Desaulniers
2019-06-27 7:16 ` Peter Zijlstra
2019-06-26 16:30 ` Peter Zijlstra
2019-06-26 22:33 ` Nick Desaulniers
2019-06-26 23:11 ` Thomas Gleixner
2019-06-27 7:11 ` Peter Zijlstra
2019-06-25 23:46 ` Arnaldo Carvalho de Melo
2019-06-26 5:14 ` Nathan Chancellor
2019-06-25 20:09 ` Kees Cook
2019-06-26 8:06 ` Peter Zijlstra
2019-06-25 7:15 ` Peter Zijlstra
2019-07-25 16:27 ` [tip:perf/urgent] " tip-bot for Gustavo A. R. Silva
2019-07-25 17:06 ` Borislav Petkov
2019-07-25 17:35 ` Peter Zijlstra
2019-07-25 23:18 ` Joe Perches
2019-07-25 23:28 ` Kees Cook
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=3dc75cd4-9a8d-f454-b5fb-64c3e6d1f416@embeddedor.com \
--to=gustavo@embeddedor.com \
--cc=acme@kernel.org \
--cc=alexander.shishkin@linux.intel.com \
--cc=bp@alien8.de \
--cc=hpa@zytor.com \
--cc=joe@perches.com \
--cc=jolsa@redhat.com \
--cc=kan.liang@linux.intel.com \
--cc=keescook@chromium.org \
--cc=linux-kernel@vger.kernel.org \
--cc=miguel.ojeda.sandonis@gmail.com \
--cc=mingo@redhat.com \
--cc=namhyung@kernel.org \
--cc=peterz@infradead.org \
--cc=shawn@git.icu \
--cc=tglx@linutronix.de \
--cc=x86@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®