aboutsummaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorJoe Perches <joe@perches.com>2012-10-04 20:13:35 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2012-10-05 14:04:59 -0400
commit058806007450489bb8f457b275e5cb5c946320c1 (patch)
tree7c99dc9728618bec0eccd7578ad493ff312e7dc1 /scripts
parent8f26b8376faad26372a579606ecbd77b20e99dd8 (diff)
checkpatch: check networking specific block comment style
In an effort to get fewer checkpatch reviewer corrections, add a networking specific style test for the preferred networking comment style. /* The preferred style for block comments in * drivers/net/... and net/... is like this */ These tests are only used in net/ and drivers/net/ Tested with: $ cat drivers/net/t.c /* foo */ /* * foo */ /* foo */ /* foo * bar */ $ ./scripts/checkpatch.pl -f drivers/net/t.c WARNING: networking block comments don't use an empty /* line, use /* Comment... #4: FILE: net/t.c:4: + +/* WARNING: networking block comments put the trailing */ on a separate line #12: FILE: net/t.c:12: + * bar */ total: 0 errors, 2 warnings, 12 lines checked Signed-off-by: Joe Perches <joe@perches.com> Cc: "Allan, Bruce W" <bruce.w.allan@intel.com> Cc: Andy Whitcroft <apw@canonical.com> Cc: David Miller <davem@davemloft.net> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/checkpatch.pl14
1 files changed, 14 insertions, 0 deletions
diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index 844af8b4c078..8e5ac71f42ee 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -1882,6 +1882,20 @@ sub process {
1882 "No space is necessary after a cast\n" . $hereprev); 1882 "No space is necessary after a cast\n" . $hereprev);
1883 } 1883 }
1884 1884
1885 if ($realfile =~ m@^(drivers/net/|net/)@ &&
1886 $rawline =~ /^\+[ \t]*\/\*[ \t]*$/ &&
1887 $prevrawline =~ /^\+[ \t]*$/) {
1888 WARN("NETWORKING_BLOCK_COMMENT_STYLE",
1889 "networking block comments don't use an empty /* line, use /* Comment...\n" . $hereprev);
1890 }
1891
1892 if ($realfile =~ m@^(drivers/net/|net/)@ &&
1893 $rawline !~ m@^\+[ \t]*(\/\*|\*\/)@ &&
1894 $rawline =~ m@^\+[ \t]*.+\*\/[ \t]*$@) {
1895 WARN("NETWORKING_BLOCK_COMMENT_STYLE",
1896 "networking block comments put the trailing */ on a separate line\n" . $herecurr);
1897 }
1898
1885# check for spaces at the beginning of a line. 1899# check for spaces at the beginning of a line.
1886# Exceptions: 1900# Exceptions:
1887# 1) within comments 1901# 1) within comments