From nobody Tue Sep 16 23:57:43 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 31EC4C3DA79 for ; Mon, 26 Dec 2022 11:41:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230352AbiLZLlB (ORCPT ); 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 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" 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 a= t line 208. xyz_file.c:196:6-25: WARNING: atomic_dec_and_test variation before obje= ct 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(-) diff --git a/scripts/coccinelle/api/atomic_as_refcounter.cocci b/scripts/co= ccinelle/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 =3D~ ".*call_rcu.*"; p1 << r1.p1; p2 << r1.p2; @@ -msg =3D "atomic_dec_and_test variation before object free at line %s." +msg =3D "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 =3D "atomic_dec_and_test variation before object free at line %s." +msg =3D "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 =3D "atomic_add_unless" +msg =3D "WARNING: atomic_add_unless" coccilib.report.print_report(p1[0], msg) @r3 exists@ @@ -126,5 +126,5 @@ x =3D atomic64_add_return@p1(-1, ...); @script:python depends on report@ p1 << r3.p1; @@ -msg =3D "x =3D atomic_add_return(-1, ...)" +msg =3D "WARNING: x =3D atomic_add_return(-1, ...)" coccilib.report.print_report(p1[0], msg) -- 2.34.1