On Fri, 2019-08-16 at 11:36 +0100, David Howells wrote: > Joe Perches <j...@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: