Skip to content

Commit e45bab8

Browse files
Andy Whitcrofttorvalds
authored andcommitted
checkpatch: handle string concatenation in simple #defines
Adjacent strings indicate concatentation, therefore look at identifiers directly adjacent to literal strings as strings too. This allows us to better detect the form below and accept it as a simple constant: #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt Signed-off-by: Andy Whitcroft <apw@canonical.com> Cc: Joe Perches <joe@perches.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
1 parent b9df76a commit e45bab8

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

scripts/checkpatch.pl

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2894,6 +2894,12 @@ sub process {
28942894
{
28952895
}
28962896

2897+
# Flatten any obvious string concatentation.
2898+
while ($dstat =~ s/("X*")\s*$Ident/$1/ ||
2899+
$dstat =~ s/$Ident\s*("X*")/$1/)
2900+
{
2901+
}
2902+
28972903
my $exceptions = qr{
28982904
$Declare|
28992905
module_param_named|

0 commit comments

Comments
 (0)