From patchwork Mon Dec 26 11:40:48 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: 36597 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4e01:0:0:0:0:0 with SMTP id p1csp866652wrt; Mon, 26 Dec 2022 03:43:32 -0800 (PST) X-Google-Smtp-Source: AMrXdXsQ3UpZsQkm7FnUInXGKzp94ot6BKOr2Ql9Zd3lQgUvBqlHKFwmSHsJE7LdUOH4wq7Jjh3/ X-Received: by 2002:a17:907:3f9f:b0:840:4901:901f with SMTP id hr31-20020a1709073f9f00b008404901901fmr19921182ejc.3.1672055012795; Mon, 26 Dec 2022 03:43:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1672055012; cv=none; d=google.com; s=arc-20160816; b=GDZKdyZzkfnBpTm1NW57imBo2QUwClUyT0NcIe2X9FHsFYLnRhTgd9Sq8x4Gcvx0o6 fxf+C8q/wayuhYajrt2eqn26D2d4Vs/9MkcJpLr9U9+gYgM8fZrCdx1b12x71rKgVr+P 6LHYWyRtS6a9AmnCoVa0DKjotcn8drBnrNq9c9i3s4PHaLgl0j4ELxcMiNhpChV+BOCj 6BsUFo5p71RdBZQZOcMbVakmbhk1YYSpCSnpZFWHs2B1OQVicgkXGISHJe+yxLHJh9OW dgv8CdnKvPDay1G5N9lZwItrsMO/8K1A5tTvZj+E2e7ij8ZCVPLnaIS4FZW39zdg4r5w XwFA== 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=aIE5D00QMEudAVr/ZGTLkM6u06YIh7qY0R5N34syWx0=; b=rYsC1NVKNv8ZE1DVDlx9FD4ToQ68NRa/uZvonCn5TA9syi8fp1zxJwpa5mPBWiIpkC ALfYxRtpS/xiUKsU3rbQqS7n8aRtqWna86nxZV2TwE5X49rm4RJzDHAJIJQVeTM+Ij0T rpKvcxwffbA3eO2mRPGeI189UddK/SYLtOWu/I+UBrdmr9p19ha9/+YyNs8JyTaI20ra 1gVx+/MPCoVG4CAswlKAxY9DAaiOi6kTNkB1LBqGSKXY/Rpwfb1+sddxfW0Z8mEsobjG 0Y44JdzYyLMxBQz1g1CnlDqNjBuVoUxNMZ+F7OZQl/N9mIS8tUZrlzqX0/4dQJtW6HnK 2JKg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@mailo.com header.s=mailo header.b=YFcMlkF8; 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 di15-20020a170906730f00b007c14d966ebasi9420046ejc.404.2022.12.26.03.43.06; Mon, 26 Dec 2022 03:43:32 -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=YFcMlkF8; 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 S229983AbiLZLlB (ORCPT + 99 others); Mon, 26 Dec 2022 06:41:01 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60512 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229533AbiLZLk7 (ORCPT ); Mon, 26 Dec 2022 06:40:59 -0500 Received: from msg-4.mailo.com (msg-4.mailo.com [213.182.54.15]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8854A6153 for ; Mon, 26 Dec 2022 03:40:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=mailo.com; s=mailo; t=1672054854; bh=QXEpXdS92hvyGJurlSR2i2Ob09JMchOtOH1qQF/RGNQ=; h=X-EA-Auth:Date:From:To:Cc:Subject:Message-ID:MIME-Version: Content-Type; b=YFcMlkF869kIfoRAuQibKMOhCGyWlR5ChmTm1Z201HC+buaXPFn/O1lIdDCeu2Nnj F1sd1FZNsF5a31yieEDytsnu6xR9ZlBm7rUDJN5Wf+MXzMmlxErQkq4DjOeu5GXzJO 5Dzncw1WMQwoltHEEkZ+8oBvq9H/8FXIYNqoE6Zo= Received: by b-6.in.mailobj.net [192.168.90.16] with ESMTP via ip-206.mailobj.net [213.182.55.206] Mon, 26 Dec 2022 12:40:53 +0100 (CET) X-EA-Auth: adL/BIG9YIrbBZkyKpUv7mpvbbYQY0lB3VFfNE3VCfssviRh5dBEFeTfbH1Ia1zRCyeregw9qDTsgA9YpgLy8559XVjLxz9H Date: Mon, 26 Dec 2022 17:10:48 +0530 From: Deepak R Varma To: Julia Lawall , Nicolas Palix , cocci@inria.fr, linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org Cc: Saurabh Singh Sengar , Praveen Kumar , Deepak R Varma Subject: [PATCH v2] 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?1753276756755786372?= A common practice is to grep for "WARNING" or "ERROR" text in the report output from a Coccinelle semantic patch script. So, include the text "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 --- Changes in v2: 1. Correct word test to text in patch description. Feedback from Markus.Elfring@web.de 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)