From nobody Thu Nov 6 22:49:42 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; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1544723879033312.3020051556158; Thu, 13 Dec 2018 09:57:59 -0800 (PST) Received: from localhost ([::1]:54034 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gXVFG-0000FO-1Q for importer@patchew.org; Thu, 13 Dec 2018 12:57:58 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40075) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gXVE0-000822-BQ for qemu-devel@nongnu.org; Thu, 13 Dec 2018 12:56:41 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gXVDx-00053G-36 for qemu-devel@nongnu.org; Thu, 13 Dec 2018 12:56:40 -0500 Received: from mx1.redhat.com ([209.132.183.28]:37142) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gXVDw-0004zF-Ro for qemu-devel@nongnu.org; Thu, 13 Dec 2018 12:56:36 -0500 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 37ED23082127 for ; Thu, 13 Dec 2018 17:56:35 +0000 (UTC) Received: from virtlab501.virt.lab.eng.bos.redhat.com (virtlab501.virt.lab.eng.bos.redhat.com [10.19.152.162]) by smtp.corp.redhat.com (Postfix) with ESMTP id 01AA0261C7; Thu, 13 Dec 2018 17:56:23 +0000 (UTC) From: Wainer dos Santos Moschetta To: qemu-devel@nongnu.org Date: Thu, 13 Dec 2018 12:55:52 -0500 Message-Id: <20181213175552.14857-2-wainersm@redhat.com> In-Reply-To: <20181213175552.14857-1-wainersm@redhat.com> References: <20181213175552.14857-1-wainersm@redhat.com> MIME-Version: 1.0 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.42]); Thu, 13 Dec 2018 17:56:35 +0000 (UTC) Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH 1/1] checkpatch: check for malformed comment block. 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: pbonzini@redhat.com, thuth@redhat.com, ehabkost@redhat.com, stefanha@redhat.com, Wainer dos Santos Moschetta Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" Currently scripts/checkpatch.pl does not check if multiline comments follow the QEMU's coding sytle. It is added a check for multiline comments that warns about: 1. block doesn't begin on its own line. 2. line in the block doesn't start with asterisk. 3. block doesn't end on its own line. Signed-off-by: Wainer dos Santos Moschetta --- scripts/checkpatch.pl | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl index 60f6f89a27..5abb579ed7 100755 --- a/scripts/checkpatch.pl +++ b/scripts/checkpatch.pl @@ -1858,6 +1858,38 @@ sub process { $line =3D~ s@//.*@@; $opline =3D~ s@//.*@@; =20 +# check for malformed comment block. + if ($rawline =3D~ m{/\*} && $rawline !~ m{\*\/}) { + if ($rawline !~ m{^.\s*/\*+$}) { + WARN("comment block should begin on its own" . + " line\n" . $herecurr); + } + + my $rel_line =3D 1; + my $reported =3D 0; + my $comment_line =3D ''; + my $herecurr =3D ''; + do { + $comment_line =3D $rawlines[$rel_line + $linenr + - 1]; + $herecurr =3D "#".($linenr + $rel_line) . + ": FILE: ".$realfile . + ":".($realline + $rel_line)."\n" . + $comment_line."\n"; + if (!$reported && $comment_line !~ m{^.\s*\*}) { + WARN("line in comment block should" . + " start with asterisk\n" . + $herecurr); + $reported =3D 1; + } + $rel_line++; + } while ($comment_line && $comment_line !~ m{\*\/}); + + if ($comment_line && $comment_line !~ m{^.\s*\*+\/}) { + WARN("comment block should end on its own" . + " line\n".$herecurr); + } + } # check for global initialisers. if ($line =3D~ /^.$Type\s*$Ident\s*(?:\s+$Modifier)*\s*=3D\s*(0|NULL|fal= se)\s*;/) { ERROR("do not initialise globals to 0 or NULL\n" . --=20 2.19.1