From nobody Wed Sep 17 01:14:58 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 B7380C3DA7D for ; Sun, 25 Dec 2022 15:12:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229812AbiLYPJj (ORCPT ); Sun, 25 Dec 2022 10:09:39 -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 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 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 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 --- 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