From: Paolo Bonzini Date: Fri, 21 Jun 2019 11:28:54 +0000 (+0200) Subject: checkpatch: do not warn for multiline parenthesized returned value X-Git-Tag: v4.1.0~66^2~10 X-Git-Url: https://git.proxmox.com/?p=mirror_qemu.git;a=commitdiff_plain;h=c20b139620498b2f158b52e0c4ad7f6de35a520e checkpatch: do not warn for multiline parenthesized returned value While indeed we do not want to have return (a); it is less clear that this applies to return (a && b); Some editors indent more nicely if you have parentheses, and some people's eyes may appreciate that as well. Signed-off-by: Paolo Bonzini Reviewed-by: Eric Blake Reviewed-by: Richard Henderson Message-Id: <1561116534-21814-1-git-send-email-pbonzini@redhat.com> Signed-off-by: Paolo Bonzini --- diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl index c2aaf421da..2f81371ffb 100755 --- a/scripts/checkpatch.pl +++ b/scripts/checkpatch.pl @@ -2296,7 +2296,8 @@ sub process { $value =~ s/\([^\(\)]*\)/1/) { } #print "value<$value>\n"; - if ($value =~ /^\s*(?:$Ident|-?$Constant)\s*$/) { + if ($value =~ /^\s*(?:$Ident|-?$Constant)\s*$/ && + $line =~ /;$/) { ERROR("return is not a function, parentheses are not required\n" . $herecurr); } elsif ($spacing !~ /\s+/) {