diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl index 646295cd99906a84ba384fa445b224bf208b8ba2..91308bec89b94e56e92a703c5e2e019e53098753 100755 --- a/scripts/checkpatch.pl +++ b/scripts/checkpatch.pl @@ -2675,6 +2675,13 @@ sub process { $herecurr); } +# check for non-global char *foo[] = {"bar", ...} declarations. + if ($line =~ /^.\s+(?:static\s+|const\s+)?char\s+\*\s*\w+\s*\[\s*\]\s*=\s*\{/) { + WARN("STATIC_CONST_CHAR_ARRAY", + "char * array declaration might be better as static const\n" . + $herecurr); + } + # check for function declarations without arguments like "int foo()" if ($line =~ /(\b$Type\s+$Ident)\s*\(\s*\)/) { if (ERROR("FUNCTION_WITHOUT_ARGS",