From patchwork Sun Dec 25 15:09:25 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Deepak R Varma X-Patchwork-Id: 36482 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4e01:0:0:0:0:0 with SMTP id p1csp550124wrt; Sun, 25 Dec 2022 07:10:18 -0800 (PST) X-Google-Smtp-Source: AMrXdXutgf1gEU1leDmJ7UhI4Gksay5nN4zM+Tv6gFL1STuQjVmsbHb3S81SI03yTCLT4Dg2Iase X-Received: by 2002:a17:906:8601:b0:7b2:91e8:1553 with SMTP id o1-20020a170906860100b007b291e81553mr12364061ejx.20.1671981018336; Sun, 25 Dec 2022 07:10:18 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1671981018; cv=none; d=google.com; s=arc-20160816; b=oLXafPPqv7kykn2GaCqjqGJUZFxKLhLpcpYneOUuP/GjiqTx6ipoPUnIFhogbLvnqu JYMKZFOju50Eupww/S3Tyr+k7S0u3qbPxBuq1Vk8kITY/A68GKTmDtnsJb3AcYmDSXGF KeNG7M3IzTWr/XDjHvBvOb/Ng3h6N1VAUnsvwXh/Wm16wmpbOo4ELW1K2yiAstBJkP5h JLtUeTTpkBVuukZFRWFCG/A3ZDcDWg1p28gm2UUuozzbxeBdKmZ4pNVQ/l3eAFeYgPlu 1oPDqZExyNM9ZXEm84J6cyPGo19a0tcFspw5Jmg3ZLu9QyjwMelp/XaXXFG1e8/6rcyZ OC8w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-disposition:mime-version:message-id :subject:cc:to:from:date:dkim-signature; bh=6UfeXhqBPhCnzAVep7pncTrLl2H4zeiceXIx+IefpL4=; b=E4MDjRzTUlBcrj8FLfV+RvLltjUEaKaegF/xrm6nbBp4rY5KPQJ1qjmvrXU8TpIOL9 yKjSSSj+bwpZ6oq/AhuLJtmErPjwGcD1LAM8pe1GRslwt0LAOYEKb3znr+YxNMPKzvYC OWRxDs1pZpZ4mg+MC/Li21G67SbKWEDIkE+mcVWw/i7zTlLZy48utTh6uT866Uixed+z DWXi/jYrBGkNytO7J/juvML3k6gvI7cX4Z4LuFz4sGcIcR5/QhUqFXvigzU/xXuXozpn CdQaMIbeGqn33SI7TNII6tTazpfOPf0ThZ4kQDVG4MSmwLKOnUaMhxrvUSbtdxqRAYZY cqaA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@mailo.com header.s=mailo header.b=BV5vHNAV; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=mailo.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id g9-20020a056402090900b0047bb02c3cefsi7834939edz.265.2022.12.25.07.09.42; Sun, 25 Dec 2022 07:10:18 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=fail header.i=@mailo.com header.s=mailo header.b=BV5vHNAV; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=mailo.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229671AbiLYPJi (ORCPT + 99 others); Sun, 25 Dec 2022 10:09:38 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38006 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229498AbiLYPJh (ORCPT ); Sun, 25 Dec 2022 10:09:37 -0500 Received: from msg-2.mailo.com (msg-2.mailo.com [213.182.54.12]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 938695FE3 for ; Sun, 25 Dec 2022 07:09:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=mailo.com; s=mailo; t=1671980971; bh=JbAethzpN7nG0wyvMkJzQiQv8OlJxBl91l6miBYz0Nk=; h=X-EA-Auth:Date:From:To:Cc:Subject:Message-ID:MIME-Version: Content-Type; b=BV5vHNAVx1e/43nCEdOqcUs8eTIfHoxAmmzp+gTIUGqHpE7l3InpEvyE80hfV0PwH aqr41iwS2IbMlBJvwNsVPBakz+BVHTX3CE1KYyBj2H+D0Eqzau/k+T2Br5vGIG56VR IhsZz+L3okJuaOW0pPOONVbgbrfcjiMd6ej8yReY= Received: by b-4.in.mailobj.net [192.168.90.14] with ESMTP via ip-206.mailobj.net [213.182.55.206] Sun, 25 Dec 2022 16:09:31 +0100 (CET) X-EA-Auth: Grnebmk61o2Ytl3xXoo8eI+B/Z+hTR6IkbcdeL7dstezlgCqOfUiYXf7/B+fI6UnsFS+ceP+79I10fP+LlSD+n417BF7f6Ck Date: Sun, 25 Dec 2022 20:39:25 +0530 From: Deepak R Varma To: Julia Lawall , Nicolas Palix , cocci@inria.fr, linux-kernel@vger.kernel.org Cc: Saurabh Singh Sengar , Praveen Kumar , Deepak R Varma Subject: [PATCH] coccinelle: api/atomic_as_refcounter: include message type in output Message-ID: MIME-Version: 1.0 Content-Disposition: inline X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1753199168307655494?= X-GMAIL-MSGID: =?utf-8?q?1753199168307655494?= A common practice is to grep for "WARNING" or "ERROR" text in the report output from a coccinelle semantic patch script. So, include the test "WARNING: " in the report output generated by the semantic patch for desired filtering of the output. Also improves the readability of the output. Here is an example of the old and new outputs reported: xyz_file.c:131:39-40: atomic_add_unless xyz_file.c:131:39-40: WARNING: atomic_add_unless xyz_file.c:196:6-25: atomic_dec_and_test variation before object free at line 208. xyz_file.c:196:6-25: WARNING: atomic_dec_and_test variation before object free at line 208. Signed-off-by: Deepak R Varma --- scripts/coccinelle/api/atomic_as_refcounter.cocci | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) -- 2.34.1 diff --git a/scripts/coccinelle/api/atomic_as_refcounter.cocci b/scripts/coccinelle/api/atomic_as_refcounter.cocci index e63d52408b86..bbe5b2932933 100644 --- a/scripts/coccinelle/api/atomic_as_refcounter.cocci +++ b/scripts/coccinelle/api/atomic_as_refcounter.cocci @@ -55,7 +55,7 @@ identifier fname6 =~ ".*call_rcu.*"; p1 << r1.p1; p2 << r1.p2; @@ -msg = "atomic_dec_and_test variation before object free at line %s." +msg = "WARNING: atomic_dec_and_test variation before object free at line %s." coccilib.report.print_report(p1[0], msg % (p2[0].line)) @r4 exists@ @@ -88,7 +88,7 @@ fname@p2(y, ...); p1 << r4.p1; p2 << r4.p2; @@ -msg = "atomic_dec_and_test variation before object free at line %s." +msg = "WARNING: atomic_dec_and_test variation before object free at line %s." coccilib.report.print_report(p1[0], msg % (p2[0].line)) @r2 exists@ @@ -107,7 +107,7 @@ atomic64_add_unless(&(a)->x,-1,1)@p1 @script:python depends on report@ p1 << r2.p1; @@ -msg = "atomic_add_unless" +msg = "WARNING: atomic_add_unless" coccilib.report.print_report(p1[0], msg) @r3 exists@ @@ -126,5 +126,5 @@ x = atomic64_add_return@p1(-1, ...); @script:python depends on report@ p1 << r3.p1; @@ -msg = "x = atomic_add_return(-1, ...)" +msg = "WARNING: x = atomic_add_return(-1, ...)" coccilib.report.print_report(p1[0], msg)