From nobody Wed Oct 22 06:32:27 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (208.118.235.17 [208.118.235.17]) by mx.zohomail.com with SMTPS id 151952850511657.89814094398605; Sat, 24 Feb 2018 19:15:05 -0800 (PST) Received: from localhost ([::1]:52590 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1epmmA-0008L0-PD for importer@patchew.org; Sat, 24 Feb 2018 22:14:58 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:48600) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1epmlE-00081A-Mt for qemu-devel@nongnu.org; Sat, 24 Feb 2018 22:14:01 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1epml9-0005U3-Jt for qemu-devel@nongnu.org; Sat, 24 Feb 2018 22:14:00 -0500 Received: from smtp23.cstnet.cn ([159.226.251.23]:53641 helo=cstnet.cn) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1epml9-0005Mb-0j for qemu-devel@nongnu.org; Sat, 24 Feb 2018 22:13:55 -0500 Received: from localhost.localdomain (unknown [36.110.80.218]) by APP-03 (Coremail) with SMTP id rQCowAAXHe3uKZJaKoPQBQ--.15440S3; Sun, 25 Feb 2018 11:13:50 +0800 (CST) From: Su Hang To: thuth@redhat.com, eblake@redhat.com, stefanha@redhat.com Date: Sun, 25 Feb 2018 11:13:09 +0800 Message-Id: <1519528389-14023-1-git-send-email-suhang16@mails.ucas.ac.cn> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1519480458-9573-1-git-send-email-suhang16@mails.ucas.ac.cn> References: <1519480458-9573-1-git-send-email-suhang16@mails.ucas.ac.cn> X-CM-TRANSID: rQCowAAXHe3uKZJaKoPQBQ--.15440S3 X-Coremail-Antispam: 1UD129KBjvdXoW7JFyfGr48ZF48tF47CFyrtFb_yoWDuFX_Zr 97tr17XrykAr909Fn0yr429340kw4UZaykZ3W5Zr9ru3s5GFsrua97Jr9xXw4jga4IvFyY 9r98XF97CFn3ZjkaLaAFLSUrUUUUUb8apTn2vfkv8UJUUUU8Yxn0WfASr-VFAUDa7-sFnT 9fnUUIcSsGvfJTRUUUbc8YjsxI4VW3JwAYFVCjjxCrM7AC8VAFwI0_Jr0_Gr1l1xkIjI8I 6I8E6xAIw20EY4v20xvaj40_Wr0E3s1l1IIY67AEw4v_Jr0_Jr4l8cAvFVAK0II2c7xJM2 8CjxkF64kEwVA0rcxSw2x7M28EF7xvwVC0I7IYx2IY67AKxVWUJVWUCwA2z4x0Y4vE2Ix0 cI8IcVCY1x0267AKxVWUJVW8JwA2z4x0Y4vEx4A2jsIE14v26r4j6F4UM28EF7xvwVC2z2 80aVCY1x0267AKxVW8JVW8Jr1lnxkEFVAIw20F6cxK64vIFxWle2I262IYc4CY6c8Ij28I cVAaY2xG8wAqx4xG64xvF2IEw4CE5I8CrVC2j2WlYx0E2Ix0cI8IcVAFwI0_Jr0_Jr4lYx 0Ex4A2jsIE14v26r1j6r4UMcvjeVCFs4IE7xkEbVWUJVW8JwACjcxG0xvY0x0EwIxGrwCF 04k20xvY0x0EwIxGrwCFx2IqxVCFs4IE7xkEbVWUJVW8JwC20s026c02F40E14v26r1j6r 18MI8I3I0E7480Y4vE14v26r106r1rMI8E67AF67kF1VAFwI0_JF0_Jw1lIxkGc2Ij64vI r41lIxAIcVC0I7IYx2IY67AKxVWUJVWUCwCI42IY6xIIjxv20xvEc7CjxVAFwI0_Jr0_Gr 1lIxAIcVCF04k26cxKx2IYs7xG6rW3Jr0E3s1lIxAIcVC2z280aVAFwI0_Jr0_Gr1lIxAI cVC2z280aVCY1x0267AKxVWUJVW8JbIYCTnIWIevJa73UjIFyTuYvjxU4oUDDUUUU X-CM-SenderInfo: pvxkt0rjrwqzpdlo2hpxfd2hldfou0/ X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [fuzzy] X-Received-From: 159.226.251.23 Subject: [Qemu-devel] [PATCH v2 RFC] scripts/checkpatch.pl:Add check for `while` and `for` X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Add check for `while` and `for` statement, which condition has more than one line. The former checkpatch.pl can check `if` statement, which condition has more than one line, whether block misses brace round, like this: ''' if (cond1 || cond2) statement; ''' But it doesn't do the same check for `for` and `while` statement. Suggested-by: Eric Blake Suggested-by: Thomas Huth Signed-off-by: Su Hang --- scripts/checkpatch.pl | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl index 1b4b812e28fa..7e332135e177 100755 --- a/scripts/checkpatch.pl +++ b/scripts/checkpatch.pl @@ -2353,7 +2353,8 @@ sub process { } =20 # check for missing bracing round if etc - if ($line =3D~ /(^.*)\bif\b/ && $line !~ /\#\s*if/) { + if ($line =3D~ /(^.*)\b(if|for|while)\b/ && + $line !~ /\#\s*(if|for|while)/) { my ($level, $endln, @chunks) =3D ctx_statement_full($linenr, $realcnt, 1); if ($dbg_adv_apw) { --=20 2.7.4