qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Stefan Hajnoczi <stefanha@redhat.com>
To: Su Hang <suhang16@mails.ucas.ac.cn>
Cc: thuth@redhat.com, eblake@redhat.com, qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH v2 RFC] scripts/checkpatch.pl: add check for `while` and `for`
Date: Tue, 27 Feb 2018 17:32:34 +0000	[thread overview]
Message-ID: <20180227173234.GI32480@stefanha-x1.localdomain> (raw)
In-Reply-To: <1519613598-12270-1-git-send-email-suhang16@mails.ucas.ac.cn>

[-- Attachment #1: Type: text/plain, Size: 744 bytes --]

On Mon, Feb 26, 2018 at 10:53:18AM +0800, Su Hang wrote:
> diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
> index 1b4b812e28fa..10c138344fa9 100755
> --- a/scripts/checkpatch.pl
> +++ b/scripts/checkpatch.pl
> @@ -2353,7 +2353,8 @@ sub process {
>  		}
>  
>  # check for missing bracing round if etc

Please fix the pre-existing typo in the comment:

s/round/around/

> -		if ($line =~ /(^.*)\bif\b/ && $line !~ /\#\s*if/) {
> +		if ($line =~ /(^.*)\b(for|while|if)\b/ &&
> +			$line !~ /\#\s*(for|while|if)/) {

Please use (?:...) like most other cases in checkpatch.pl.  Perl
automatically assigns groups to $1, $2, etc with (...).  Using (?:...)
is preferred since it's faster and free of this side-effect.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 455 bytes --]

  reply	other threads:[~2018-02-27 17:32 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-02-26  2:53 [Qemu-devel] [PATCH v2 RFC] scripts/checkpatch.pl: add check for `while` and `for` Su Hang
2018-02-27 17:32 ` Stefan Hajnoczi [this message]
2018-02-27 17:42   ` Peter Maydell
2018-02-28  9:50     ` Stefan Hajnoczi
  -- strict thread matches above, loose matches on Subject: below --
2018-02-24 13:54 [Qemu-devel] [PATCH RFC] scripts/checkpatch.pl:Add " Su Hang
2018-02-25  3:13 ` [Qemu-devel] [PATCH v2 " Su Hang

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=20180227173234.GI32480@stefanha-x1.localdomain \
    --to=stefanha@redhat.com \
    --cc=eblake@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=suhang16@mails.ucas.ac.cn \
    --cc=thuth@redhat.com \
    /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).