From: Andy Whitcroft Date: Fri, 23 Mar 2012 22:02:18 +0000 (-0700) Subject: checkpatch: handle string concatenation in simple #defines X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=e45bab8ebfee65ba89b228c1e7c64a6cb0812124;p=linux-beck.git 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 Cc: Joe Perches Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl index 95ba30a24dcf..01a65988a057 100755 --- a/scripts/checkpatch.pl +++ b/scripts/checkpatch.pl @@ -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|