[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <7e2471ed71a42d74c0dbd9f2197034f5163d0eda.camel@perches.com>
Date: Tue, 10 Mar 2020 04:10:29 -0700
From: Joe Perches <joe@...ches.com>
To: Sergey Senozhatsky <sergey.senozhatsky.work@...il.com>
Cc: Sergey Senozhatsky <sergey.senozhatsky@...il.com>,
Andrew Morton <akpm@...ux-foundation.org>,
Johannes Weiner <hannes@...xchg.org>,
Michal Hocko <mhocko@...nel.org>,
Vladimir Davydov <vdavydov.dev@...il.com>,
Hugh Dickins <hughd@...gle.com>,
Minchan Kim <minchan@...nel.org>,
Nitin Gupta <ngupta@...are.org>, linux-mm@...ck.org,
linux-kernel@...r.kernel.org, cgroups@...r.kernel.org
Subject: Re: [PATCH] mm: Use fallthrough;
On Mon, 2020-03-09 at 15:48 +0900, Sergey Senozhatsky wrote:
> On (20/03/09 15:20), Sergey Senozhatsky wrote:
> [..]
> > > <shrug, maybe> I've no real opinion about that necessity.
> > >
> > > fallthrough commments are relatively rarely used as a
> > > separating element between case labels.
> > >
> > > It's by far most common to just have consecutive case labels
> > > without any other content.
> > >
> > > It's somewhere between 500:1 to 1000:1 in the kernel.
> >
> > I thought that those labels were used by some static code analysis
> > tools, so that the removal of some labels raised questions. But I
> > don't think I have opinions otherwise.
>
> ... I guess GCC counts as a static code analysis tool :)
>
> Looking at previous commits, people wanted to have proper 'fall through'
>
>
> Replace "fallthru" with a proper "fall through" annotation.
> This fix is part of the ongoing efforts to enabling
> -Wimplicit-fallthrough
>
> ---
>
> - case ZPOOL_MM_RW: /* fallthru */
> + case ZPOOL_MM_RW: /* fall through */
That conversion was unnecessary.
(there are still 6 /* fallthru */ comments in today's kernel)
There are tens of thousands of consecutive case labels without
interleaving fallthrough comments in the kernel like:
switch (foo) {
case BAR:
case BAZ:
do_something();
break;
default:
something_else();
break;
}
So gcc and clang handle consecutive cases without fallthrough
without uselessly emitting warnings just fine.
Powered by blists - more mailing lists