]> git.proxmox.com Git - mirror_qemu.git/commitdiff
checkpatch: do not warn for multiline parenthesized returned value
authorPaolo Bonzini <pbonzini@redhat.com>
Fri, 21 Jun 2019 11:28:54 +0000 (13:28 +0200)
committerPaolo Bonzini <pbonzini@redhat.com>
Fri, 5 Jul 2019 20:16:45 +0000 (22:16 +0200)
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>
scripts/checkpatch.pl

index c2aaf421da32c3b8405e638666e8cba18745dbad..2f81371ffb0fa9b03549e1aeb8e2b14ea37ab1be 100755 (executable)
@@ -2296,7 +2296,8 @@ sub process {
                               $value =~ s/\([^\(\)]*\)/1/) {
                        }
 #print "value<$value>\n";
                               $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+/) {
                                ERROR("return is not a function, parentheses are not required\n" . $herecurr);
 
                        } elsif ($spacing !~ /\s+/) {