Elyes Haouas has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/70202 )
Change subject: lint/checkpatch: Add check for const static or static <non ptr type> ......................................................................
lint/checkpatch: Add check for const static or static <non ptr type>
This reduce the difference with linux v6.1-rc7.
Change-Id: Ib4b37e130f2edbfe0385f0707a8c910a244bcfc7 Signed-off-by: Elyes Haouas ehaouas@noos.fr --- M util/lint/checkpatch.pl 1 file changed, 24 insertions(+), 0 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/02/70202/1
diff --git a/util/lint/checkpatch.pl b/util/lint/checkpatch.pl index 03b6851..296ab13 100755 --- a/util/lint/checkpatch.pl +++ b/util/lint/checkpatch.pl @@ -4276,6 +4276,18 @@ } }
+# check for const static or static <non ptr type> const declarations +# prefer 'static const <foo>' over 'const static <foo>' and 'static <foo> const' + if ($sline =~ /^+\s*const\s+static\s+($Type)\b/ || + $sline =~ /^+\s*static\s+($BasicType)\s+const\b/) { + if (WARN("STATIC_CONST", + "Move const after static - use 'static const $1'\n" . $herecurr) && + $fix) { + $fixed[$fixlinenr] =~ s/\bconst\s+static\b/static const/; + $fixed[$fixlinenr] =~ s/\bstatic\s+($BasicType)\s+const\b/static const $1/; + } + } + # 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",