From nobody Fri May 17 17:31:28 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1596799014; cv=none; d=zohomail.com; s=zohoarc; b=g0Ig9kKEcNpkTpkpKt54yfycddYFGE+3Gk2ythRLZ+D1VPdFstQA9SBjoElAR4MI3MSjstobO0TNQTxMmr+HkmVLINCEXHx62wdR2l+Be2M1sThAIvFujjTOBelzkqzzWSIP7wjxqknc8FkMcvqnVlVrgt2f9fvSDNEC6HFdmc4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1596799014; h=Cc:Date:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:Sender:Subject:To; bh=/bguBSGgwxSssJ1YBCX9L23xHuviueJuwZyFChgJBQs=; b=gCAd5j3kx8R1JVNHUt/hh+pWTdv1Td6vhGQL4wZO+fvSCd36tRqeudc2esRS1xp45Ntlr0LlK4MtPPltdh1P5nasyWRCII86wFynlVKyInb557IcCLepVvNZSlhu3tvgv9ChIxSpr+R/SysHT6EOfnuayZ6mp0JedEP5Kr9iP0w= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1596799014611723.7808940246271; Fri, 7 Aug 2020 04:16:54 -0700 (PDT) Received: from localhost ([::1]:37882 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1k40Mn-0004NL-CV for importer@patchew.org; Fri, 07 Aug 2020 07:16:53 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:53248) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1k40Kw-0002wr-7L for qemu-devel@nongnu.org; Fri, 07 Aug 2020 07:14:58 -0400 Received: from mx2.suse.de ([195.135.220.15]:46210) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1k40Ku-00076j-DY for qemu-devel@nongnu.org; Fri, 07 Aug 2020 07:14:57 -0400 Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 9B001B6C8; Fri, 7 Aug 2020 11:15:12 +0000 (UTC) X-Virus-Scanned: by amavisd-new at test-mx.suse.de From: Claudio Fontana To: Markus Armbruster Subject: [RFC v2] checkpatch: detect missing changes to trace-events Date: Fri, 7 Aug 2020 13:14:47 +0200 Message-Id: <20200807111447.15599-1-cfontana@suse.de> X-Mailer: git-send-email 2.16.4 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=195.135.220.15; envelope-from=cfontana@suse.de; helo=mx2.suse.de X-detected-operating-system: by eggs.gnu.org: First seen = 2020/08/06 23:38:33 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x (no timestamps) [generic] X-Spam_score_int: -41 X-Spam_score: -4.2 X-Spam_bar: ---- X-Spam_report: (-4.2 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "Michael S . Tsirkin" , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , qemu-devel@nongnu.org, Claudio Fontana , Stefan Hajnoczi , Paolo Bonzini , =?UTF-8?q?Alex=20Benn=C3=A9e?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Signed-off-by: Claudio Fontana --- scripts/checkpatch.pl | 37 ++++++++++++++++++++++++++++++------- 1 file changed, 30 insertions(+), 7 deletions(-) v1 -> v2 : * track the "from" file in addition to the "to" file, and grep into both (if they exist), looking for trace.h, trace-root.h If files are reachable and readable, emit a warning if there is no update to trace-events. diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl index bd3faa154c..37db212fc6 100755 --- a/scripts/checkpatch.pl +++ b/scripts/checkpatch.pl @@ -1300,6 +1300,7 @@ sub process { my $in_header_lines =3D $file ? 0 : 1; my $in_commit_log =3D 0; #Scanning lines before patch my $reported_maintainer_file =3D 0; + my $reported_trace_events_file =3D 0; my $non_utf8_charset =3D 0; =20 our @report =3D (); @@ -1309,6 +1310,7 @@ sub process { our $cnt_chk =3D 0; =20 # Trace the real file/line as we go. + my $fromfile =3D ''; my $realfile =3D ''; my $realline =3D 0; my $realcnt =3D 0; @@ -1454,10 +1456,15 @@ sub process { $here =3D "#$realline: " if ($file); =20 # extract the filename as it passes - if ($line =3D~ /^diff --git.*?(\S+)$/) { - $realfile =3D $1; - $realfile =3D~ s@^([^/]*)/@@ if (!$file); + if ($line =3D~ /^diff --git.*?(\S+).*?(\S+)$/) { + $fromfile =3D $1; + $realfile =3D $2; + if (!$file) { + $fromfile =3D~ s@^([^/]*)/@@ ; + $realfile =3D~ s@^([^/]*)/@@ ; + } checkfilename($realfile, \$acpi_testexpected, \$acpi_nont= estexpected); + } elsif ($line =3D~ /^\+\+\+\s+(\S+)/) { $realfile =3D $1; $realfile =3D~ s@^([^/]*)/@@ if (!$file); @@ -1470,6 +1477,11 @@ sub process { } =20 next; + + } elsif ($line =3D~ /^---\s+(\S+)/) { + $fromfile =3D $1; + $fromfile =3D~ s@^([^/]*)/@@ if (!$file); + next; } =20 $here .=3D "FILE: $realfile:$realline:" if ($realcnt !=3D 0); @@ -1524,15 +1536,26 @@ sub process { if ($line =3D~ /^\s*MAINTAINERS\s*\|/) { $reported_maintainer_file =3D 1; } - +# similar check for trace-events + if ($line =3D~ /^\s*trace-events\s*\|/) { + $reported_trace_events_file =3D 1; + } # Check for added, moved or deleted files - if (!$reported_maintainer_file && !$in_commit_log && + if (!$in_commit_log && ($line =3D~ /^(?:new|deleted) file mode\s*\d+\s*$/ || $line =3D~ /^rename (?:from|to) [\w\/\.\-]+\s*$/ || ($line =3D~ /\{\s*([\w\/\.\-]*)\s*\=3D\>\s*([\w\/\.\-]*)\s*\}/ && (defined($1) || defined($2))))) { - $reported_maintainer_file =3D 1; - WARN("added, moved or deleted file(s), does MAINTAINERS need updating?\= n" . $herecurr); + if (!$reported_maintainer_file) { + $reported_maintainer_file =3D 1; + WARN("added, moved or deleted file(s), does MAINTAINERS need updating?= \n" . $herecurr); + } + if (!$reported_trace_events_file) { + if (`grep -F -s -e trace.h -e trace-root.h ${fromfile} ${realfile}` ne= '') { + $reported_trace_events_file =3D 1; + WARN("added, moved or deleted file(s), does trace-events need updatin= g?\n" . $herecurr); + } + } } =20 # Check for wrappage within a valid hunk of the file --=20 2.16.4