Skip to content

Commit

Permalink
checkpatch: handle string concatenation in simple #defines
Browse files Browse the repository at this point in the history
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 <[email protected]>
Cc: Joe Perches <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
Andy Whitcroft authored and torvalds committed Mar 23, 2012
1 parent b9df76a commit e45bab8
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions scripts/checkpatch.pl
Original file line number Diff line number Diff line change
Expand Up @@ -2894,6 +2894,12 @@ sub process {
{
}

# Flatten any obvious string concatentation.
while ($dstat =~ s/("X*")\s*$Ident/$1/ ||
$dstat =~ s/$Ident\s*("X*")/$1/)
{
}

my $exceptions = qr{
$Declare|
module_param_named|
Expand Down

0 comments on commit e45bab8

Please sign in to comment.