staging : lustre : Remove braces from single-line body.
Subsystems (2)
PATCH 1/1 staging : lustre : Remove braces from single-line body.
Remove unnecessary braces {} from single line if statement. This warning is found using checkpatch.pl.
--- drivers/staging/lustre/lustre/ptlrpc/import.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/staging/lustre/lustre/ptlrpc/import.c +2 -2
@@ -1134,9 +1134,9 @@ static int ptlrpc_connect_interpret(const struct lu_env *env, }/* Sanity checks for a reconnected import. */ -if (!(imp->imp_replayable) != !(msg_flags &MSG_CONNECT_REPLAYABLE )) { +if (!(imp->imp_replayable) != !(msg_flags &MSG_CONNECT_REPLAYABLE ))CERROR ("imp_replayable flag does not match server after reconnect. We should LBUG right here.\n" ); - } +if (lustre_msg_get_last_committed (request->rq_repmsg) >0 && lustre_msg_get_last_committed(request->rq_repmsg) <
Signature · 1 line
2.7.4
Joe Perches
maintainerQuoted 2 lines · Tabrez khan
Remove unnecessary braces {} from single line if statement. This warning is found using checkpatch.pl.
[]
drivers/staging/lustre/lustre/ptlrpc/import.c
Quoted 1 line
drivers/staging/lustre/lustre/ptlrpc/import.c +0
-0
[]
drivers/staging/lustre/lustre/ptlrpc/import.c static int ptlrpc_connect_interpret(const struct lu_env *env, · line 1139
Quoted 9 lines
drivers/staging/lustre/lustre/ptlrpc/import.c +2
-2@@ -1134,9 +1134,9 @@ static int ptlrpc_connect_interpret(const struct lu_env *env, }/* Sanity checks for a reconnected import. */ -if (!(imp->imp_replayable) != !(msg_flags &MSG_CONNECT_REPLAYABLE )) { +if (!(imp->imp_replayable) != !(msg_flags &MSG_CONNECT_REPLAYABLE ))CERROR ("imp_replayable flag does not match server after reconnect. We should LBUG right here.\n" ); - } +
There are one too many blank lines now.
And that's an awful lot of !s.
Generically, it might make simpler reading code to cast to bool instead of using !.
Most code uses !! to make sure whatever value is either 0 or 1 without changing the logic/polarity.
Quoted 9 lines · Joe Perches
Quoted 2 lines · Tabrez khan
Remove unnecessary braces {} from single line if statement. This warning is found using checkpatch.pl.
[]
drivers/staging/lustre/lustre/ptlrpc/import.c
Quoted 1 line
drivers/staging/lustre/lustre/ptlrpc/import.c +0
-0[]
Quoted 3 lines
drivers/staging/lustre/lustre/ptlrpc/import.c +0
-0@@ -1134,9 +1134,9 @@ static int ptlrpc_connect_interpret(const struct lu_env *env, }
Quoted 8 lines
drivers/staging/lustre/lustre/ptlrpc/import.c static int ptlrpc_connect_interpret(const struct lu_env *env, · line 1139
Quoted 6 lines
drivers/staging/lustre/lustre/ptlrpc/import.c +2
-2/* Sanity checks for a reconnected import. */ -if (!(imp->imp_replayable) != !(msg_flags &MSG_CONNECT_REPLAYABLE )) { +if (!(imp->imp_replayable) != !(msg_flags &MSG_CONNECT_REPLAYABLE ))CERROR ("imp_replayable flag does not match server after reconnect. We should LBUG right here.\n" ); - } +There are one too many blank lines now.
I was expecting checkpatch.pl to catch the extra blank. It was there in the last patch as well. Apparently it doesn't.
regards,
dan carpenter
Joe Perches
maintainerQuoted 21 lines · Dan Carpenter
Quoted 11 lines · Joe Perches
Quoted 2 lines · Tabrez khan
Remove unnecessary braces {} from single line if statement. This warning is found using checkpatch.pl.
[]
drivers/staging/lustre/lustre/ptlrpc/import.c
Quoted 1 line
drivers/staging/lustre/lustre/ptlrpc/import.c +0
-0[]
Quoted 3 lines
drivers/staging/lustre/lustre/ptlrpc/import.c +0
-0@@ -1134,9 +1134,9 @@ static int ptlrpc_connect_interpret(const struct lu_env *env, }Quoted 8 lines
drivers/staging/lustre/lustre/ptlrpc/import.c static int ptlrpc_connect_interpret(const struct lu_env *env, · line 1139
Quoted 6 lines
drivers/staging/lustre/lustre/ptlrpc/import.c +2
-2/* Sanity checks for a reconnected import. */ -if (!(imp->imp_replayable) != !(msg_flags &MSG_CONNECT_REPLAYABLE )) { +if (!(imp->imp_replayable) != !(msg_flags &MSG_CONNECT_REPLAYABLE ))CERROR ("imp_replayable flag does not match server after reconnect. We should LBUG right here.\n" ); - } +There are one too many blank lines now.
Quoted 2 lines
I was expecting checkpatch.pl to catch the extra blank. It was there in the last patch as well. Apparently it doesn't.
checkpatch is imperfect and always will be.
checkpatch is a stupid little script.
It mostly works on added lines and generally only looks for style defects on lines that precede those added lines.
Here the now unnecessary blank line follows the added blank line.
Oh well.
Anyway, here's an almost completely untested possible patch to checkpatch.
(also attached because evolution is a terrible
email client, but I seem to be stuck with it)
--- scripts/checkpatch.pl | 13 +++++++++++++ 1 file changed, 13 insertions(+)
scripts/checkpatch.pl +13 -0
@@ -3063,6 +3063,19 @@ sub process { $last_blank_line = $linenr; } +# Another check for multiple consecutive blank lines where the following +# line is part of the context and is also blank + if ($line =~ /^\+\s*$/ && + defined $rawlines[$linenr] && + $rawlines[$linenr] =~ /^ \s*$/) { + if (CHK("LINE_SPACING", + "Please don't use multiple blank lines\n" . $hereprev) && + $fix) { + fix_delete_line($fixlinenr, $rawline); + } + $last_blank_line = $linenr; + } + # check for missing blank lines after declarations if ($sline =~ /^\+\s+\S/ && #Not at char 1 # actual declarations
-------------- next part --------------
A non-text attachment was scrubbed...
Name: cp_trailing_context_blank.diff
Type: text/x-patch
Size: 860 bytes
Desc: not available
URL: <http://lists.lustre.org/pipermail/lustre-devel-lustre.org/attachments/20161216/63a30696/attachment.bin>