From 749f2e5ccf3223ccb27046e05681704a6a080b1f Mon Sep 17 00:00:00 2001 From: Joe Perches Date: Tue, 26 Oct 2010 14:23:20 -0700 Subject: [PATCH] --- yaml --- r: 217597 b: refs/heads/master c: cb710eca6820493add0ddd3d7e8e3ee53f2b6e57 h: refs/heads/master i: 217595: 72237cf4dc2f4f77e5c1a551e93d1756023c39ec v: v3 --- [refs] | 2 +- trunk/scripts/checkpatch.pl | 12 ++++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/[refs] b/[refs] index d282d2a21c91..2afb89f3a348 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 267ad8f42644c2fa4ff6c2e7596d2b02c7397c85 +refs/heads/master: cb710eca6820493add0ddd3d7e8e3ee53f2b6e57 diff --git a/trunk/scripts/checkpatch.pl b/trunk/scripts/checkpatch.pl index c1e7fb3eab44..2ec5fc6a4046 100755 --- a/trunk/scripts/checkpatch.pl +++ b/trunk/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/ &&