From 6e8ad12fbac943336f9eb8d97bf2e0bedb9fb225 Mon Sep 17 00:00:00 2001 From: Jeff Darcy Date: Mon, 22 Sep 2014 16:48:50 -0400 Subject: build: remove warnings for recommended style Specifically: * space before function arguments * brace around single statement Ideally we would *reverse* these tests so they warn under the exact opposite conditions, but that would mean learning the internals of a script written in a defective language with cryptic variable names and too few comments. Life's too short. For now, just cutting down on some of the spam (which might obscure more serious issues) should suffice. BUG: 1120646 Change-Id: I5ec684d0d788a34f29af9b1761743c8860973993 Signed-off-by: Jeff Darcy Reviewed-on: http://review.gluster.org/8813 Reviewed-by: Harshavardhana Tested-by: Gluster Build System Tested-by: Harshavardhana --- extras/checkpatch.pl | 53 ++-------------------------------------------------- 1 file changed, 2 insertions(+), 51 deletions(-) (limited to 'extras/checkpatch.pl') diff --git a/extras/checkpatch.pl b/extras/checkpatch.pl index 5077f9adfb7..02c2c2e02ee 100755 --- a/extras/checkpatch.pl +++ b/extras/checkpatch.pl @@ -2794,41 +2794,6 @@ sub process { } } -# check for spaces between functions and their parentheses. - while ($line =~ /($Ident)\s+\(/g) { - my $name = $1; - my $ctx_before = substr($line, 0, $-[1]); - my $ctx = "$ctx_before$name"; - - # Ignore those directives where spaces _are_ permitted. - if ($name =~ /^(?: - if|for|while|switch|return|case| - volatile|__volatile__| - __attribute__|format|__extension__| - asm|__asm__)$/x) - { - # cpp #define statements have non-optional spaces, ie - # if there is a space between the name and the open - # parenthesis it is simply not a parameter group. - } elsif ($ctx_before =~ /^.\s*\#\s*define\s*$/) { - - # cpp #elif statement condition may start with a ( - } elsif ($ctx =~ /^.\s*\#\s*elif\s*$/) { - - # If this whole things ends with a type its most - # likely a typedef for a function. - } elsif ($ctx =~ /$Type$/) { - - } else { - if (WARN("SPACING", - "space prohibited between function name and open parenthesis '('\n" . $herecurr) && - $fix) { - $fixed[$linenr - 1] =~ - s/\b$name\s+\(/$name\(/; - } - } - } - # Check operator spacing. if (!($line=~/\#\s*include/)) { my $fixed_line = ""; @@ -3665,11 +3630,8 @@ sub process { foreach (@allowed) { $sum_allowed += $_; } - if ($sum_allowed == 0) { - WARN("BRACES", - "braces {} are not necessary for any arm of this statement\n" . $herectx); - } elsif ($sum_allowed != $allow && - $seen != $allow) { + if ($sum_allowed != 0 && $sum_allowed != $allow + && $seen != $allow) { CHK("BRACES", "braces {} should be used on all arms of this statement\n" . $herectx); } @@ -3718,17 +3680,6 @@ sub process { $allowed = 1; } } - if ($level == 0 && $block =~ /^\s*\{/ && !$allowed) { - my $herectx = $here . "\n"; - my $cnt = statement_rawlines($block); - - for (my $n = 0; $n < $cnt; $n++) { - $herectx .= raw_line($linenr, $n) . "\n"; - } - - WARN("BRACES", - "braces {} are not necessary for single statement blocks\n" . $herectx); - } } # check for unnecessary blank lines around braces -- cgit