From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:57150) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZrppF-0001CG-G4 for qemu-devel@nongnu.org; Thu, 29 Oct 2015 12:13:23 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZrppB-0003sk-88 for qemu-devel@nongnu.org; Thu, 29 Oct 2015 12:13:17 -0400 Received: from mx1.redhat.com ([209.132.183.28]:38075) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZrppB-0003sH-2M for qemu-devel@nongnu.org; Thu, 29 Oct 2015 12:13:13 -0400 References: <1446112118-12376-1-git-send-email-leonid@daynix.com> <1446112118-12376-3-git-send-email-leonid@daynix.com> From: Eric Blake Message-ID: <56324592.9070308@redhat.com> Date: Thu, 29 Oct 2015 10:13:06 -0600 MIME-Version: 1.0 In-Reply-To: <1446112118-12376-3-git-send-email-leonid@daynix.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="AoJGW5GbfbP41EdvCH3cjTV6NsojnD28v" Subject: Re: [Qemu-devel] [PATCH 2/2] checkpatch: Eliminate false positive in case of space before square bracket in a definition List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Leonid Bloch , qemu-devel@nongnu.org Cc: Blue Swirl This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --AoJGW5GbfbP41EdvCH3cjTV6NsojnD28v Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 10/29/2015 03:48 AM, Leonid Bloch wrote: > Now, macro definition such as "#define abc(x) [x] =3D 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. >=20 > Signed-off-by: Leonid Bloch > --- > scripts/checkpatch.pl | 2 ++ > 1 file changed, 2 insertions(+) >=20 > 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] =3D= 5, > # 3. inside a curly brace -- =3D { [0...10] =3D 5 } > # 4. after a comma -- [1] =3D 5, [2] =3D 6 > +# 5. in a macro definition -- #define abc(x) [x] =3D y > while ($line =3D~ /(.*?\s)\[/g) { > my ($where, $prefix) =3D ($-[1], $1); > if ($prefix !~ /$Type\s+$/ && > ($where !=3D 0 || $prefix !~ /^.\s+$/) && > $prefix !~ /{\s+$/ && > + $prefix !~ /\#\s*define[^(]*\([^)]*\)\s+$/ && > $prefix !~ /,\s+$/) { > ERROR("space prohibited before open square bracket '['\n" . $herec= urr); > } >=20 --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --AoJGW5GbfbP41EdvCH3cjTV6NsojnD28v Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 Comment: Public key at http://people.redhat.com/eblake/eblake.gpg Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQEcBAEBCAAGBQJWMkWSAAoJEKeha0olJ0NqSnsH/jtTUUOgutM30lgqJlo1rUnO edR4sGmlFE1oagITsXbW8FWg8Y7VyjKTL56Bb6U6zQxJ8H9uFRhje4SZQZDgqUdE Cp6nRQ6GP4vhUQj/EnPjJmoelJIViYU0sVIJcdxwBNK5HDZ4R2mmMXqCLrhtm/7K 52ZLgSN0TZu3kcbUvqQH8DSqqq+V6pHvFbtxV9Qcpmx2gAncU+WlFin+anxv0nOw Fgdpjc7yu3lRyRxJCysN/SwsIlMdGA/rP5QLfKHwRLZ4V20aFlldvc94TO+UDxrY DIPfvJ68YHm60AWWooA1txii6YEnftXD6RKBollKuTtMEqKtxIY6pDcAPiPB3/E= =q2Oy -----END PGP SIGNATURE----- --AoJGW5GbfbP41EdvCH3cjTV6NsojnD28v--