Martin L Roth has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/73515 )
Change subject: util/lint: Ignore braces around single line statements ......................................................................
util/lint: Ignore braces around single line statements
In a recent coreboot leadership meeting, the decision was made to allow (but not require) braces around single line statements if the author wishes to put them in.
This patch removes the checks for single line statement blocks, while still checking for other issues in braces.
Just because they're allowed now, please do not reformat the entire codebase to add them. coreboot has a policy of not making widespread changes to the entire codebase unless something actually violates the style guidelines.
Signed-off-by: Martin Roth gaumless@gmail.com Change-Id: I137b10889ec880959c4c1b035dc54bf8ebf32488 --- M util/lint/checkpatch.pl 1 file changed, 33 insertions(+), 9 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/15/73515/1
diff --git a/util/lint/checkpatch.pl b/util/lint/checkpatch.pl index a8a91e8..c2efdbc 100755 --- a/util/lint/checkpatch.pl +++ b/util/lint/checkpatch.pl @@ -5631,8 +5631,9 @@ $sum_allowed += $_; } if ($sum_allowed == 0) { - WARN("BRACES", - "braces {} are not necessary for any arm of this statement\n" . $herectx); + # coreboot has decided to allow braces around single line statement blocks + #WARN("BRACES", + # "braces {} are not necessary for any arm of this statement\n" . $herectx); } elsif ($sum_allowed != $allow && $seen != $allow) { CHK("BRACES", @@ -5683,13 +5684,14 @@ $allowed = 1; } } - if ($level == 0 && $block =~ /^\s*{/ && !$allowed) { - my $cnt = statement_rawlines($block); - my $herectx = get_stat_here($linenr, $cnt, $here); - - WARN("BRACES", - "braces {} are not necessary for single statement blocks\n" . $herectx); - } + # coreboot has decided to allow braces around single line statement blocks + #if ($level == 0 && $block =~ /^\s*{/ && !$allowed) { + # my $cnt = statement_rawlines($block); + # my $herectx = get_stat_here($linenr, $cnt, $here); + # + # WARN("BRACES", + # "braces {} are not necessary for single statement blocks\n" . $herectx); + #} }
# check for single line unbalanced braces