mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Shuah Khan <skhan@linuxfoundation.org>
To: Julia Lawall <julia.lawall@inria.fr>, Joe Perches <joe@perches.com>
Cc: "Gustavo A. R. Silva" <gustavoars@kernel.org>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Valentina Manea <valentina.manea.m@gmail.com>,
	Shuah Khan <shuah@kernel.org>,
	linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org,
	Shuah Khan <skhan@linuxfoundation.org>
Subject: Re: [PATCH] usbip: Use fallthrough pseudo-keyword
Date: Wed, 8 Jul 2020 08:42:26 -0600	[thread overview]
Message-ID: <486d9450-21a9-fb35-3473-4e589005d1c7@linuxfoundation.org> (raw)
In-Reply-To: <alpine.DEB.2.22.394.2007081209500.2558@hadrien>

On 7/8/20 4:16 AM, Julia Lawall wrote:
> 
> 
> On Tue, 7 Jul 2020, Joe Perches wrote:
> 
>> On Tue, 2020-07-07 at 14:06 -0600, Shuah Khan wrote:
>>> On 7/7/20 1:52 PM, Gustavo A. R. Silva wrote:
>>>> Replace the existing /* fall through */ comments and its variants with
>>>> the new pseudo-keyword macro fallthrough[1]. Also, remove unnecessary
>>>> fall-through markings when it is the case.
>>>>
>>>> [1] https://www.kernel.org/doc/html/latest/process/deprecated.html?highlight=fallthrough#implicit-switch-case-fall-through
>>>>
>>>
>>> Is fallthrough syntax supported on our min gcc version?
>>
>> No.  Introduced in gcc 7.
>>
>>> Does checkpatch or coccicheck catch these cases?
>>
>> Kinda.  checkpatch isn't very good at it.
>> I _believe_, though I'm not at all sure,
>> that coccinelle can find these.
> 
> I would not guarantee anything about the support of Coccinelle for switch.
> Coccinelle does now have the ability to match on comments.  So since there
> is a distinct comment that it is to be removed, it might be possible to do
> that part automatically.
> 
> Maybe it would have to look something like this:
> 
> @r1@
> comments c : script:python() { code to recognize the comment };
> statement S;
> @@
> 
> S@c
> + fallthrough(); //or whatever is wanted
> 
> @@
> statement r1.S;
> @@
> 
> - S
> - fallthrough();
> + S
> + fallthrough();
> 
> The second rule probably looks pretty strange, but the goal is to remove
> the comments between S and fallthrough();
> 
> There is an example demos/comments.cocci that shows how to access the
> comment information using both ocaml and python.
> 

Thanks Julia. Maybe this is a way to address all of the cases. I am a
bit concerned about min gcc which is 4.8 and the fallthrough syntax
support is in gcc 7

-- Shuah


  reply	other threads:[~2020-07-08 14:42 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-07 19:52 Gustavo A. R. Silva
2020-07-07 20:06 ` Shuah Khan
2020-07-08  1:56   ` Joe Perches
2020-07-08 10:16     ` Julia Lawall
2020-07-08 14:42       ` Shuah Khan [this message]
2020-07-08 14:35     ` Shuah Khan
2020-07-08 15:39       ` Joe Perches
2020-07-08 16:39         ` Shuah Khan
2020-07-08 18:11   ` Gustavo A. R. Silva
2024-02-15  9:26 [PATCH] USBIP: " Pairman Guo
2024-02-15 10:14 ` Greg KH

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=486d9450-21a9-fb35-3473-4e589005d1c7@linuxfoundation.org \
    --to=skhan@linuxfoundation.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=gustavoars@kernel.org \
    --cc=joe@perches.com \
    --cc=julia.lawall@inria.fr \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=shuah@kernel.org \
    --cc=valentina.manea.m@gmail.com \
    /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®