Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp1794527imu; Wed, 12 Dec 2018 04:33:53 -0800 (PST) X-Google-Smtp-Source: AFSGD/UsbXWeioW6nP6FNLgYKwT42/PD0ypkeNHG+7A0eWYcR1T+pcnQhRAWmoI1uMeGb++5bgbD X-Received: by 2002:a63:ff16:: with SMTP id k22mr18412677pgi.244.1544618033522; Wed, 12 Dec 2018 04:33:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1544618033; cv=none; d=google.com; s=arc-20160816; b=K8w5JYNElfX0meran45zyjaMwupBl3o2RqcCb+lA9b+hmWzNsN7D7oJ/otUpMFIh2T mKeqMsTHEI6KuNejxfSKT0klODTvDVyQAR1mA9TGkYmHaseTUjFNS5lMqUXqN6RdP67g R+3e/ctl0y3L30M7f/mjpSNjwk+gB6t/aEFymmm6vDIbLOiSXl3IZe011/Of4wJTYhd2 4yoP2mzf8et+alAC3tSV38WRo4axaSFhva2aXGnz4SLNDgtFBHSygMr2oeisLzUDFEcq qkfAwAqF+qh1T56T+8diQRwYHo1FwI2zqrht5pdEBdVf/8zV9W8dcmnVb4E2e1xOPTk7 oV0g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from; bh=FixlXoy9gQL65p5W5CJSRcgR7jPryEQVKq23Fchx06E=; b=nlu0lwRg91CclJ3mDhBxEySOuWHgP87cxAh4UXvH854D1h4nwBWPotdKAaHIO5gmkE yJPBrvD6RBczLZeQIEl6eLqA/0zS2khY61z2Lf1Q7t4XAQRSXk2fkxJshJhVVM2zdhKq +IqowbdWl3E/2ka7UhaMtsf6N9btA6zDfErtpwBo4iDmt+5mP30Tsl6X5n8lwhwSHqR2 r4l3jtVZONorVh/r7BGHaqAha209f5X5XvX5qXn05zP0sKdEj5r/MCG/TJUPa4HDfSQj 3Yt51JKXq0QX7SQ+3FrEKNw64Wx5MZnHxg/m6/sYBFICVGoRWYGdmCIfS0+KnNJkO5A5 pZpQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z14si14117800pgu.525.2018.12.12.04.33.38; Wed, 12 Dec 2018 04:33:53 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727479AbeLLMc2 (ORCPT + 99 others); Wed, 12 Dec 2018 07:32:28 -0500 Received: from mail2-relais-roc.national.inria.fr ([192.134.164.83]:21773 "EHLO mail2-relais-roc.national.inria.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727260AbeLLMcZ (ORCPT ); Wed, 12 Dec 2018 07:32:25 -0500 X-IronPort-AV: E=Sophos;i="5.56,344,1539640800"; d="scan'208";a="359976178" Received: from palace.rsr.lip6.fr (HELO palace.lip6.fr) ([132.227.105.202]) by mail2-relais-roc.national.inria.fr with ESMTP/TLS/AES128-SHA256; 12 Dec 2018 13:32:22 +0100 From: Julia Lawall To: Julia Lawall Cc: Gilles Muller , Nicolas Palix , Michal Marek , cocci@systeme.lip6.fr, linux-kernel@vger.kernel.org, Masahiro Yamada , Peter Zijlstra , "Paul E . McKenney" Subject: [PATCH 1/2] scripts: coccinelle: only suggest true/false in files that already use them Date: Wed, 12 Dec 2018 12:55:56 +0100 Message-Id: <1544615757-19356-2-git-send-email-Julia.Lawall@lip6.fr> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1544615757-19356-1-git-send-email-Julia.Lawall@lip6.fr> References: <1544615757-19356-1-git-send-email-Julia.Lawall@lip6.fr> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Some code may overall use 0 and 1, so don't introduce occasional uses of true and false in these cases. Signed-off-by: Julia Lawall --- scripts/coccinelle/misc/boolinit.cocci | 31 +++++++++++++++++++++---------- 1 file changed, 21 insertions(+), 10 deletions(-) diff --git a/scripts/coccinelle/misc/boolinit.cocci b/scripts/coccinelle/misc/boolinit.cocci index b9abed4..1b44feb 100644 --- a/scripts/coccinelle/misc/boolinit.cocci +++ b/scripts/coccinelle/misc/boolinit.cocci @@ -13,10 +13,17 @@ virtual context virtual org virtual report +@boolok@ +symbol true,false; +@@ +( +true +| +false +) + @depends on patch@ bool t; -symbol true; -symbol false; @@ ( @@ -63,7 +70,7 @@ bool t; + t ) -@depends on patch@ +@depends on patch && boolok@ bool b; @@ ( @@ -116,19 +123,23 @@ position p; * t@p != 0 ) -@r3 depends on !patch@ +@r3 depends on !patch && boolok@ bool b; -position p1,p2; -constant c; +position p1; @@ ( *b@p1 = 0 | *b@p1 = 1 -| -*b@p2 = c ) +@r4 depends on !patch@ +bool b; +position p2; +constant c != {0,1}; +@@ +*b@p2 = c + @script:python depends on org@ p << r1.p; @@ @@ -148,7 +159,7 @@ p1 << r3.p1; cocci.print_main("WARNING: Assignment of bool to 0/1",p1) @script:python depends on org@ -p2 << r3.p2; +p2 << r4.p2; @@ cocci.print_main("ERROR: Assignment of bool to non-0/1 constant",p2) @@ -172,7 +183,7 @@ p1 << r3.p1; coccilib.report.print_report(p1[0],"WARNING: Assignment of bool to 0/1") @script:python depends on report@ -p2 << r3.p2; +p2 << r4.p2; @@ coccilib.report.print_report(p2[0],"ERROR: Assignment of bool to non-0/1 constant") -- 1.9.1