From nobody Wed Oct 22 06:35:00 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 1519480533523438.7351639341815; Sat, 24 Feb 2018 05:55:33 -0800 (PST) Received: from localhost ([::1]:50234 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1epaIP-0004cb-6G for importer@patchew.org; Sat, 24 Feb 2018 08:55:25 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59267) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1epaHV-0004DF-Rg for qemu-devel@nongnu.org; Sat, 24 Feb 2018 08:54:30 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1epaHS-0007tx-OK for qemu-devel@nongnu.org; Sat, 24 Feb 2018 08:54:29 -0500 Received: from smtp23.cstnet.cn ([159.226.251.23]:39317 helo=cstnet.cn) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1epaHS-0007r8-2g for qemu-devel@nongnu.org; Sat, 24 Feb 2018 08:54:26 -0500 Received: from Sword.lan (unknown [210.77.26.65]) by APP-03 (Coremail) with SMTP id rQCowAD39_WKbpFaX2alBQ--.9109S3; Sat, 24 Feb 2018 21:54:19 +0800 (CST) From: Su Hang To: thuth@redhat.com, stefanha@redhat.com, eblake@redhat.com Date: Sat, 24 Feb 2018 21:54:18 +0800 Message-Id: <1519480458-9573-1-git-send-email-suhang16@mails.ucas.ac.cn> X-Mailer: git-send-email 2.7.4 X-CM-TRANSID: rQCowAD39_WKbpFaX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I43 ZEXa7IU0sF4tUUUUU== 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 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`. Suggested-by: Eric Blake Suggested-by: Thomas Huth Signed-off-by: Su Hang --- scripts/checkpatch.pl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl index 1b4b812e28fa..cfe7e77d156f 100755 --- a/scripts/checkpatch.pl +++ b/scripts/checkpatch.pl @@ -2353,7 +2353,7 @@ 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