All of lore.kernel.org
 help / color / mirror / Atom feed
From: Eric Blake <eblake@redhat.com>
To: Leonid Bloch <leonid@daynix.com>, qemu-devel@nongnu.org
Cc: Blue Swirl <blauwirbel@gmail.com>
Subject: Re: [Qemu-devel] [PATCH 2/2] checkpatch: Eliminate false positive in case of space before square bracket in a definition
Date: Thu, 29 Oct 2015 10:13:06 -0600	[thread overview]
Message-ID: <56324592.9070308@redhat.com> (raw)
In-Reply-To: <1446112118-12376-3-git-send-email-leonid@daynix.com>

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

On 10/29/2015 03:48 AM, Leonid Bloch wrote:
> Now, macro definition such as "#define abc(x) [x] = y" should pass
> without an error.

Do we even have macros like that? Without context, it seems like that
macro definition is under-parenthesized, and that you wouldn't want to
use abc(x) in an arbitrary expression for fear of precedence rules
causing nasty surprises.

> 
> Signed-off-by: Leonid Bloch <leonid@daynix.com>
> ---
>  scripts/checkpatch.pl | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
> index 455d94b..e7d9cce 100755
> --- a/scripts/checkpatch.pl
> +++ b/scripts/checkpatch.pl
> @@ -1716,11 +1716,13 @@ sub process {
>  #  2. at the beginning of a line for slice initialisers -- [0...10] = 5,
>  #  3. inside a curly brace -- = { [0...10] = 5 }
>  #  4. after a comma -- [1] = 5, [2] = 6
> +#  5. in a macro definition -- #define abc(x) [x] = y
>  		while ($line =~ /(.*?\s)\[/g) {
>  			my ($where, $prefix) = ($-[1], $1);
>  			if ($prefix !~ /$Type\s+$/ &&
>  			    ($where != 0 || $prefix !~ /^.\s+$/) &&
>  			    $prefix !~ /{\s+$/ &&
> +			    $prefix !~ /\#\s*define[^(]*\([^)]*\)\s+$/ &&
>  			    $prefix !~ /,\s+$/) {
>  				ERROR("space prohibited before open square bracket '['\n" . $herecurr);
>  			}
> 

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 604 bytes --]

  reply	other threads:[~2015-10-29 16:13 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-10-29  9:48 [Qemu-devel] [PATCH 0/2] checkpatch: Fixing two cases of false positives in checkpatch.pl Leonid Bloch
2015-10-29  9:48 ` [Qemu-devel] [PATCH 1/2] checkpatch: Eliminate false positive in case of comma-space-square bracket Leonid Bloch
2015-10-29  9:48 ` [Qemu-devel] [PATCH 2/2] checkpatch: Eliminate false positive in case of space before square bracket in a definition Leonid Bloch
2015-10-29 16:13   ` Eric Blake [this message]
2015-10-29 16:59     ` Leonid Bloch
2015-11-10  9:48 ` [Qemu-devel] [PATCH 0/2] checkpatch: Fixing two cases of false positives in checkpatch.pl Leonid Bloch
2015-11-24 14:43   ` Leonid Bloch
2015-12-20  9:31     ` Leonid Bloch
2016-01-05 12:02       ` Leonid Bloch
2016-01-11 12:12 ` Markus Armbruster
2016-01-31 14:13   ` Leonid Bloch
2016-02-11  9:43     ` Leonid Bloch
2016-02-11  9:47       ` Paolo Bonzini

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=56324592.9070308@redhat.com \
    --to=eblake@redhat.com \
    --cc=blauwirbel@gmail.com \
    --cc=leonid@daynix.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.