LKML Archive on lore.kernel.org
 help / color / Atom feed
From: Joe Perches <joe@perches.com>
To: David Howells <dhowells@redhat.com>
Cc: Nathan Chancellor <natechancellor@gmail.com>,
	Nick Desaulniers <ndesaulniers@google.com>,
	Nathan Huckleberry <nhuck@google.com>,
	linux-afs@lists.infradead.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] afs: Move comments after /* fallthrough */
Date: Fri, 16 Aug 2019 04:07:58 -0700
Message-ID: <af4cbaaeb54589a5255bd39baf6bacc2b07bf7b5.camel@perches.com> (raw)
In-Reply-To: <13106.1565951791@warthog.procyon.org.uk>

On Fri, 2019-08-16 at 11:36 +0100, David Howells wrote:
> Joe Perches <joe@perches.com> wrote:
> 
> > Here the script would not convert the /* Fall through */
> > because the next non-blank line does not start with
> > case or default
> 
> Convert the "/* Fall through */" to what?
> 
> You said "for a script to appropriately convert case statement blocks with /*
> fallthrough */ comments to a macro".  Can you give an example of what the code
> would look like with this macro emplaced?

Sure.

The basic idea is to use a macro for __attribute__((__fallthrough__))
like:

#define fallthrough __attribute__((__fallthrough__))

though some would prefer __fallthrough to be more similar to
other attribute macros.  I prefer fallthrough; to be more
similar to break;

So it would end up like (just an example, won't apply)

diff --git a/fs/afs/cmservice.c b/fs/afs/cmservice.c
index b86195e4dc6c..d962332008aa 100644
--- a/fs/afs/cmservice.c
+++ b/fs/afs/cmservice.c
@@ -284,7 +284,7 @@ static int afs_deliver_cb_callback(struct afs_call *call)
                call->unmarshall++;
 
                /* extract the FID array and its count in two steps */
-               /* fall through */
+               fallthrough;
        case 1:
                _debug("extract FID count");
                ret = afs_extract_data(call, true);
@@ -303,8 +303,7 @@ static int afs_deliver_cb_callback(struct afs_call *call)
                        return -ENOMEM;
                afs_extract_to_buf(call, call->count * 3 * 4);
                call->unmarshall++;
-
-               /* Fall through */
+               fallthrough;
        case 2:


  reply index

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-08-15  2:36 Joe Perches
2019-08-15 13:40 ` David Howells
2019-08-15 23:46   ` Joe Perches
2019-08-16 10:36   ` David Howells
2019-08-16 11:07     ` Joe Perches [this message]
2019-08-19 21:03     ` David Howells
2019-08-19 21:50       ` Joe Perches
2019-08-15 22:34 ` Nick Desaulniers
2019-08-15 22:55   ` Joe Perches

Reply instructions:

You may reply publically 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=af4cbaaeb54589a5255bd39baf6bacc2b07bf7b5.camel@perches.com \
    --to=joe@perches.com \
    --cc=dhowells@redhat.com \
    --cc=linux-afs@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=natechancellor@gmail.com \
    --cc=ndesaulniers@google.com \
    --cc=nhuck@google.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

LKML Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/lkml/0 lkml/git/0.git
	git clone --mirror https://lore.kernel.org/lkml/1 lkml/git/1.git
	git clone --mirror https://lore.kernel.org/lkml/2 lkml/git/2.git
	git clone --mirror https://lore.kernel.org/lkml/3 lkml/git/3.git
	git clone --mirror https://lore.kernel.org/lkml/4 lkml/git/4.git
	git clone --mirror https://lore.kernel.org/lkml/5 lkml/git/5.git
	git clone --mirror https://lore.kernel.org/lkml/6 lkml/git/6.git
	git clone --mirror https://lore.kernel.org/lkml/7 lkml/git/7.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 lkml lkml/ https://lore.kernel.org/lkml \
		linux-kernel@vger.kernel.org linux-kernel@archiver.kernel.org
	public-inbox-index lkml


Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-kernel


AGPL code for this site: git clone https://public-inbox.org/ public-inbox