From e45bab8ebfee65ba89b228c1e7c64a6cb0812124 Mon Sep 17 00:00:00 2001 From: Andy Whitcroft Date: Fri, 23 Mar 2012 15:02:18 -0700 Subject: 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 --- scripts/checkpatch.pl | 6 ++++++ 1 file changed, 6 insertions(+) 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| -- cgit v1.2.3