aboutsummaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorPaolo Bonzini <pbonzini@redhat.com>2019-06-21 13:28:54 +0200
committerPaolo Bonzini <pbonzini@redhat.com>2019-07-05 22:16:45 +0200
commitc20b139620498b2f158b52e0c4ad7f6de35a520e (patch)
tree52d73eb078c3579c5c8323bc4902f2d19554fa8f /scripts
parent58164eaff530a1e804f5710936dd37518ab5a90e (diff)
downloadqemu-c20b139620498b2f158b52e0c4ad7f6de35a520e.zip
qemu-c20b139620498b2f158b52e0c4ad7f6de35a520e.tar.gz
qemu-c20b139620498b2f158b52e0c4ad7f6de35a520e.tar.bz2
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 <pbonzini@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Message-Id: <1561116534-21814-1-git-send-email-pbonzini@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/checkpatch.pl3
1 files changed, 2 insertions, 1 deletions
diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index c2aaf42..2f81371 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+/) {