diff options
author | Joe Perches <joe@perches.com> | 2012-11-08 18:53:29 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2012-11-09 00:41:46 -0500 |
commit | c24f9f195edf8c7f78eff1081cdadd26bd272ee3 (patch) | |
tree | 27063fcac4f5fd20054b3ca45fe15d6c39762876 /scripts | |
parent | 3d70f8c617a436c7146ecb81df2265b4626dfe89 (diff) |
checkpatch: improve network block comment style checking
Some comment styles in net and drivers/net are flagged inappropriately.
Avoid proclaiming inline comments like:
int a = b; /* some comment */
and block comments like:
/*********************
* some comment
********************/
are defective.
Tested with
$ cat drivers/net/t.c
/* foo */
/*
* foo
*/
/* foo
*/
/* foo
* bar */
/****************************
* some long block comment
***************************/
struct foo {
int bar; /* another test */
};
$
Signed-off-by: Joe Perches <joe@perches.com>
Reported-by: Larry Finger <Larry.Finger@lwfinger.net>
Cc: David Miller <davem@davemloft.net>
Cc: Stephen Hemminger <shemminger@vyatta.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'scripts')
-rwxr-xr-x | scripts/checkpatch.pl | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl index 21a9f5de0a21..f18750e3bd6c 100755 --- a/scripts/checkpatch.pl +++ b/scripts/checkpatch.pl | |||
@@ -1890,8 +1890,10 @@ sub process { | |||
1890 | } | 1890 | } |
1891 | 1891 | ||
1892 | if ($realfile =~ m@^(drivers/net/|net/)@ && | 1892 | if ($realfile =~ m@^(drivers/net/|net/)@ && |
1893 | $rawline !~ m@^\+[ \t]*(\/\*|\*\/)@ && | 1893 | $rawline !~ m@^\+[ \t]*\*/[ \t]*$@ && #trailing */ |
1894 | $rawline =~ m@^\+[ \t]*.+\*\/[ \t]*$@) { | 1894 | $rawline !~ m@^\+.*/\*.*\*/[ \t]*$@ && #inline /*...*/ |
1895 | $rawline !~ m@^\+.*\*{2,}/[ \t]*$@ && #trailing **/ | ||
1896 | $rawline =~ m@^\+[ \t]*.+\*\/[ \t]*$@) { #non blank */ | ||
1895 | WARN("NETWORKING_BLOCK_COMMENT_STYLE", | 1897 | WARN("NETWORKING_BLOCK_COMMENT_STYLE", |
1896 | "networking block comments put the trailing */ on a separate line\n" . $herecurr); | 1898 | "networking block comments put the trailing */ on a separate line\n" . $herecurr); |
1897 | } | 1899 | } |