summaryrefslogtreecommitdiffstats
path: root/extras/checkpatch.pl
diff options
context:
space:
mode:
authorJeff Darcy <jdarcy@redhat.com>2014-09-22 16:48:50 -0400
committerHarshavardhana <harsha@harshavardhana.net>2014-09-23 14:30:13 -0700
commit6e8ad12fbac943336f9eb8d97bf2e0bedb9fb225 (patch)
tree49fcb642be0bb1247c4c70f39c74237c5dfbef6a /extras/checkpatch.pl
parent2288fec13e5fa8f1b2493fd75e35f748460b2039 (diff)
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 <jdarcy@redhat.com> Reviewed-on: http://review.gluster.org/8813 Reviewed-by: Harshavardhana <harsha@harshavardhana.net> Tested-by: Gluster Build System <jenkins@build.gluster.com> Tested-by: Harshavardhana <harsha@harshavardhana.net>
Diffstat (limited to 'extras/checkpatch.pl')
-rwxr-xr-xextras/checkpatch.pl53
1 files changed, 2 insertions, 51 deletions
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