From nobody Tue May 13 15:59:17 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1538727132003124.4302822124647; Fri, 5 Oct 2018 01:12:12 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id E24C930642A6; Fri, 5 Oct 2018 08:12:09 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id AC1962E020; Fri, 5 Oct 2018 08:12:09 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id CA3273D382; Fri, 5 Oct 2018 08:12:08 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w958C7Dn009393 for ; Fri, 5 Oct 2018 04:12:07 -0400 Received: by smtp.corp.redhat.com (Postfix) id A794562471; Fri, 5 Oct 2018 08:12:07 +0000 (UTC) Received: from mx1.redhat.com (ext-mx19.extmail.prod.ext.phx2.redhat.com [10.5.110.48]) by smtp.corp.redhat.com (Postfix) with ESMTPS id A01B462470 for ; Fri, 5 Oct 2018 08:12:07 +0000 (UTC) Received: from m97138.mail.qiye.163.com (m97138.mail.qiye.163.com [220.181.97.138]) by mx1.redhat.com (Postfix) with ESMTP id 6BA40307D90F for ; Fri, 5 Oct 2018 08:12:05 +0000 (UTC) Received: from localhost.localdomain (unknown [58.56.27.130]) by smtp9 (Coremail) with SMTP id u+CowAB3p3_PHLdb0blTAg--.62652S22; Fri, 05 Oct 2018 16:12:04 +0800 (CST) From: Shi Lei To: libvir-list@redhat.com Date: Fri, 5 Oct 2018 16:11:43 +0800 Message-Id: <20181005081145.29901-21-shi_lei@massclouds.com> In-Reply-To: <20181005081145.29901-1-shi_lei@massclouds.com> References: <20181005081145.29901-1-shi_lei@massclouds.com> X-CM-TRANSID: u+CowAB3p3_PHLdb0blTAg--.62652S22 X-Coremail-Antispam: 1Uf129KBjvJXoWxAF1rZF45Aw4UGr15uFyUKFg_yoW5GrWkpF 4YyFn3urWDXr12y34IyFy5Xr1fZa9YgFyDZr13Z3W8Ja4kta4UtryIg3Z5ur1UuF1kArWU ua9Igr4DuF10vrDanT9S1TB71UUUUUUqnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDUYxBIdaVFxhVjvjDU0xZFpf9x0pRUku7UUUUU= X-Originating-IP: [58.56.27.130] X-CM-SenderInfo: pvklsz1hl6ztxvvfz0xxgvhudrp/1tbiARTWT1ikTghdeAAAsT X-Greylist: Sender passed SPF test, Sender IP whitelisted by DNSRBL, ACL 214 matched, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.48]); Fri, 05 Oct 2018 08:12:06 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.48]); Fri, 05 Oct 2018 08:12:06 +0000 (UTC) for IP:'220.181.97.138' DOMAIN:'m97138.mail.qiye.163.com' HELO:'m97138.mail.qiye.163.com' FROM:'shi_lei@massclouds.com' RCPT:'' X-RedHat-Spam-Score: -0.01 (RCVD_IN_DNSWL_NONE) 220.181.97.138 m97138.mail.qiye.163.com 220.181.97.138 m97138.mail.qiye.163.com X-Scanned-By: MIMEDefang 2.84 on 10.5.110.48 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 20/22] build-aux:check-spacing: Relax the check-rule for misaligned stuff X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.49]); Fri, 05 Oct 2018 08:12:10 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Linefeed can be put behind the open-parenthesis of the function, the position of argument should be: 1) pos % 4 =3D=3D 0 2) pos > start_of_function_name(includes func's parent_pointer) 3) pos is the first place which matches 1) and 2) E.g. [indent]if (virLongLongLongFunctionName( [4-spaces-align]LongLongLongFirstName, [4-spaces-align]LongLongLongSecondName) < 0) or [indent]ret =3D pointer->virFunctionName( [4-spaces-align]LongLongLongFirstName, [4-spaces-align]LongLongLongSecondName); Signed-off-by: Shi Lei --- build-aux/check-spacing.pl | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/build-aux/check-spacing.pl b/build-aux/check-spacing.pl index d36b004..64a5dac 100755 --- a/build-aux/check-spacing.pl +++ b/build-aux/check-spacing.pl @@ -275,10 +275,10 @@ sub CheckMisalignment { my $pos =3D $$paren_stack[-1][0]; my $linenum =3D $$paren_stack[-1][1]; my $code =3D $$paren_stack[-1][2]; - if ($pos + 1 !=3D length($`)) { + if ($pos !=3D length($`)) { my $pad =3D ""; if ($. > $linenum + 1) { - $pad =3D " " x $pos . " ...\n"; + $pad =3D " " x $pos . "...\n"; } print "Misaligned line in parenthesis:\n"; print "$$file:$linenum-$.:\n$code$pad$$line\n"; @@ -291,6 +291,7 @@ sub CheckMisalignment { if ($$data =3D~ /.*[()]/) { my $pos =3D 0; my $temp =3D $$data; + $temp =3D~ s/\s+$//; =20 # Kill the content between matched parenthesis and themselves # within the current line. @@ -310,9 +311,20 @@ sub CheckMisalignment { } =20 # Push the item for open-paren on @paren_stack - # @item =3D [ position of the open-paren, linenum, code-line ] + # @item =3D [ correct-indent, linenum, code-line ] while (($pos =3D index($temp, "\(", $pos)) >=3D 0) { - push @$paren_stack, [$pos, $., $$line]; + if ($pos+1 =3D=3D length($temp)) { + my $recent =3D rindex($temp, "\(", $pos-1) + 1; + my $correct =3D rindex($temp, " ", $pos-1) + 1; + $correct =3D ($correct >=3D $recent) ? $correct : $recent; + $correct +=3D 4 - ($correct % 4); + if ($correct < $pos) { + push @$paren_stack, [$correct, $., $$line]; + last; + } + } + + push @$paren_stack, [$pos+1, $., $$line]; $pos++; } } @@ -370,7 +382,7 @@ foreach my $file (@ARGV) { # We _need_ fix these misalignment in batches. # We _should_ remove it as soon as fixing all. ##################################################################= ### - next unless $file =3D~ /^src\/util\//; + next unless $file =3D~ /^src\/(?!esx|qemu|hyperv|lxc|conf|libxl|vb= ox|test|security)/; =20 $ret =3D 1 if CheckMisalignment(\$data, \$file, \$line, \@paren_st= ack); } --=20 2.17.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list