[PATCH] checkpatch.pl: Fix wrong curly bracket position reporting

From: Jean-Baptiste Theou
Date: Tue Dec 17 2013 - 22:02:32 EST


This patch fixes wrong curly bracket position reporting when function
declarations have only one void argument.

Missing error (ERROR: space required before the open brace '{') on this
situation :

int foo(void){
...
}

Signed-off-by: Jean-Baptiste Theou <jtheou@xxxxxxxxxxxxxxxxxx>
---
scripts/checkpatch.pl | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index 8f3aecd..3a18c5e 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -3159,7 +3159,7 @@ sub process {
## }

#need space before brace following if, while, etc
- if (($line =~ /\(.*\){/ && $line !~ /\($Type\){/) ||
+ if (($line =~ /\(.*\){/ && ($line =~ /\(void\){/ || $line !~ /\($Type\){/)) ||
$line =~ /do{/) {
if (ERROR("SPACING",
"space required before the open brace '{'\n" . $herecurr) &&
--
1.8.4.2

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/