X-Git-Url: https://bbs.cooldavid.org/git/?a=blobdiff_plain;f=scripts%2Fcheckpatch.pl;h=2ec5fc6a40462930bcb37cc1fdfb59154f2373b1;hb=cb710eca6820493add0ddd3d7e8e3ee53f2b6e57;hp=c1e7fb3eab44598c4991bd62a4cc38ebcf885446;hpb=267ad8f42644c2fa4ff6c2e7596d2b02c7397c85;p=net-next-2.6.git diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl index c1e7fb3eab4..2ec5fc6a404 100755 --- a/scripts/checkpatch.pl +++ b/scripts/checkpatch.pl @@ -1869,6 +1869,18 @@ sub process { $herecurr); } +# check for static const char * arrays. + if ($line =~ /\bstatic\s+const\s+char\s*\*\s*(\w+)\s*\[\s*\]\s*=\s*/) { + WARN("static const char * array should probably be static const char * const\n" . + $herecurr); + } + +# check for static char foo[] = "bar" declarations. + if ($line =~ /\bstatic\s+char\s+(\w+)\s*\[\s*\]\s*=\s*"/) { + WARN("static char array declaration should probably be static const char\n" . + $herecurr); + } + # check for new typedefs, only function parameters and sparse annotations # make sense. if ($line =~ /\btypedef\s/ &&