From nobody Tue Feb 10 19:14:38 2026 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 (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1501517022933332.6396220739473; Mon, 31 Jul 2017 09:03:42 -0700 (PDT) Received: from localhost ([::1]:60432 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dcDAS-0005hj-Pk for importer@patchew.org; Mon, 31 Jul 2017 12:03:40 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:33693) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dcD8d-0004YT-44 for qemu-devel@nongnu.org; Mon, 31 Jul 2017 12:01:48 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dcD8Z-0008De-2Q for qemu-devel@nongnu.org; Mon, 31 Jul 2017 12:01:47 -0400 Received: from mailhub.sw.ru ([195.214.232.25]:33859 helo=relay.sw.ru) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dcD8Y-0008Cj-Ns for qemu-devel@nongnu.org; Mon, 31 Jul 2017 12:01:43 -0400 Received: from kvm.sw.ru (msk-vpn.virtuozzo.com [195.214.232.6]) by relay.sw.ru (8.13.4/8.13.4) with ESMTP id v6VG1Zrr012437; Mon, 31 Jul 2017 19:01:37 +0300 (MSK) From: Vladimir Sementsov-Ogievskiy To: qemu-devel@nongnu.org Date: Mon, 31 Jul 2017 19:01:34 +0300 Message-Id: <20170731160135.12101-4-vsementsov@virtuozzo.com> X-Mailer: git-send-email 2.11.1 In-Reply-To: <20170731160135.12101-1-vsementsov@virtuozzo.com> References: <20170731160135.12101-1-vsementsov@virtuozzo.com> X-detected-operating-system: by eggs.gnu.org: OpenBSD 3.x [fuzzy] X-Received-From: 195.214.232.25 Subject: [Qemu-devel] [PATCH v3 3/4] checkpatch: check trace-events code style 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: peter.maydell@linaro.org, vsementsov@virtuozzo.com, stefanha@gmail.com, cohuck@redhat.com, mreitz@redhat.com, den@openvz.org, pbonzini@redhat.com, jsnow@redhat.com 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" According to CODING_STYLE, check that in trace-events: 1. hex numbers are prefixed with '0x' 2. '#' flag of printf is not used 3. The exclusion from 1. are period-separated groups of numbers Signed-off-by: Vladimir Sementsov-Ogievskiy Reviewed-by: Stefan Hajnoczi --- scripts/checkpatch.pl | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl index 4e91122813..fa478074b8 100755 --- a/scripts/checkpatch.pl +++ b/scripts/checkpatch.pl @@ -1337,6 +1337,25 @@ sub process { $rpt_cleaners =3D 1; } =20 +# checks for trace-events files + if ($realfile =3D~ /trace-events$/ && $line =3D~ /^\+/) { + if ($rawline =3D~ /%[-+ 0]*#/) { + ERROR("Don't use '#' flag of printf format ('%#') in " . + "trace-events, use '0x' prefix instead\n" . $herecurr); + } else { + my $hex =3D + qr/%[-+ *.0-9]*([hljztL]|ll|hh)?(x|X|"\s*PRI[xX][^"]*"?)/; + + # don't consider groups splitted by [.:/ ], like 2A.20:12ab + my $tmpline =3D $rawline =3D~ s/($hex[.:\/ ])+$hex//gr; + + if ($tmpline =3D~ /(?