qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Markus Armbruster <armbru@redhat.com>
To: Paolo Bonzini <pbonzini@redhat.com>
Cc: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH RFC] checkpatch: do not warn for multiline parenthesized returned value
Date: Mon, 24 Jun 2019 11:00:51 +0200	[thread overview]
Message-ID: <87tvcftl18.fsf@dusky.pond.sub.org> (raw)
In-Reply-To: <1561116534-21814-1-git-send-email-pbonzini@redhat.com> (Paolo Bonzini's message of "Fri, 21 Jun 2019 13:28:54 +0200")

Paolo Bonzini <pbonzini@redhat.com> writes:

> 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.

No objection.

> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> ---
>  scripts/checkpatch.pl | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> 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+/) {



  parent reply	other threads:[~2019-06-24  9:06 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-06-21 11:28 [Qemu-devel] [PATCH RFC] checkpatch: do not warn for multiline parenthesized returned value Paolo Bonzini
2019-06-21 13:47 ` Eric Blake
2019-06-24  9:00 ` Markus Armbruster [this message]
2019-06-25 15:12 ` Richard Henderson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87tvcftl18.fsf@dusky.pond.sub.org \
    --to=armbru@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).