X-Git-Url: http://git.openwrt.org/?p=openwrt%2Fstaging%2Fwigyori.git;a=blobdiff_plain;f=scripts%2Fcheckpatch.pl;h=5224ea49c3b27985c3d15928c2748467dce4fdd4;hp=5e2c0b9f1ccd859cc1bba33e546ced91be61b27e;hb=aa66aa0c9a77c115de0efcaf6ee59650b969b90d;hpb=e532d653738fc7a45d6fe4b485ab39ee33730283 diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl index 5e2c0b9f1c..5224ea49c3 100755 --- a/scripts/checkpatch.pl +++ b/scripts/checkpatch.pl @@ -1,4 +1,4 @@ -#!/usr/bin/perl -w +#!/usr/bin/env perl # (c) 2001, Dave Jones. (the file handling bit) # (c) 2005, Joel Schopp (the ugly bit) # (c) 2007,2008, Andy Whitcroft (new conditions, test suite) @@ -7,6 +7,7 @@ # Licensed under the terms of the GNU GPL License version 2 use strict; +use warnings; my $P = $0; $P =~ s@.*/@@g; @@ -391,7 +392,7 @@ sub top_of_openwrt_tree { my @tree_check = ( "BSDmakefile", "Config.in", "LICENSE", "Makefile", "README", - "docs", "feeds.conf.default", "include", "package", "rules.mk", + "feeds.conf.default", "include", "package", "rules.mk", "scripts", "target", "toolchain", "tools" ); @@ -2354,8 +2355,8 @@ sub process { # function brace can't be on same line, except for #defines of do while, # or if closed on same line - if (($line=~/$Type\s*$Ident\(.*\).*\s{/) and - !($line=~/\#\s*define.*do\s{/) and !($line=~/}/)) { + if (($line=~/$Type\s*$Ident\(.*\).*\s\{/) and + !($line=~/\#\s*define.*do\s\{/) and !($line=~/}/)) { ERROR("OPEN_BRACE", "open brace '{' following function declarations go on the next line\n" . $herecurr); } @@ -2623,8 +2624,8 @@ sub process { ## } #need space before brace following if, while, etc - if (($line =~ /\(.*\){/ && $line !~ /\($Type\){/) || - $line =~ /do{/) { + if (($line =~ /\(.*\)\{/ && $line !~ /\($Type\)\{/) || + $line =~ /do\{/) { ERROR("SPACING", "space required before the open brace '{'\n" . $herecurr); } @@ -2914,7 +2915,7 @@ sub process { $dstat !~ /^for\s*$Constant$/ && # for (...) $dstat !~ /^for\s*$Constant\s+(?:$Ident|-?$Constant)$/ && # for (...) bar() $dstat !~ /^do\s*{/ && # do {... - $dstat !~ /^\({/) # ({... + $dstat !~ /^\(\{/) # ({... { $ctx =~ s/\n*$//; my $herectx = $here . "\n";