From patchwork Sat Nov 27 18:15:45 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julia Lawall X-Patchwork-Id: 12642505 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 kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9CA30C433F5 for ; Sat, 27 Nov 2021 18:16:08 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id E67E86B0072; Sat, 27 Nov 2021 13:15:57 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id DEF7F6B0078; Sat, 27 Nov 2021 13:15:57 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id C6AED6B007B; Sat, 27 Nov 2021 13:15:57 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0019.hostedemail.com [216.40.44.19]) by kanga.kvack.org (Postfix) with ESMTP id B78806B0072 for ; Sat, 27 Nov 2021 13:15:57 -0500 (EST) Received: from smtpin02.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id 75FAD184848CD for ; Sat, 27 Nov 2021 18:15:47 +0000 (UTC) X-FDA: 78855513534.02.1A3A2EF Received: from mail2-relais-roc.national.inria.fr (mail2-relais-roc.national.inria.fr [192.134.164.83]) by imf16.hostedemail.com (Postfix) with ESMTP id D09F3F0000A0 for ; Sat, 27 Nov 2021 18:15:41 +0000 (UTC) IronPort-Data: A9a23:zRNkJ6MdzJarbdDvrR0IlcFynXyQoLVcMsFnjC/WdQO51z8q3jIHmDRJXD2FO6zcNmL3f9pzaoTl9ksDscPXm99gGjLY11k9FiMQ8ZKt6fexdxqrYXvKdqUvdK/WhiknQoGowPscEzmM+X9BDpC79SMljPjSGeKmYAL5EnsZqTFMGX5JZS1Ly7ZRbr5A2bBVMivV0T/Ai5W31GyNh1aYBlkpB5er83uDihhdVAQw5TTSbdgT1LPXeuJ84Jg3fcldJFOgKmVY83LTegrN8F251juxExYFCtqpiLf2dCXmQJaCYE7Q2jwPAfHk20cZzsAx+v9T2P40a1pTijzPm9luwdFJnZ22UwYgeKPW8AgYe0cFT34jYfMuFLjvZCLXXdao51LHd3/96/RoAls/MYAR9qBwG24m3fcXJTRLfAyOr+2zybO/DOJrg6wLJcrzOasbu3d93XTXCusgTZnfQqLMo9hC018YgsFIAOabYs8xaiRmZxeGZAdAUn8TCZQjjKKri2P5fjlwtl2Yv+w07nLVwQg316LiWPLeet3MQMRTkUaRoUrU42m/CRYfcteZoRKX/3uoje7njz/2HokVEfuz8JZXbPe7roAIIERJDh3i+6D/1B74C48ZMUEKvDEgt+40+VDDczU0ZDXgyFbsg/LWc4M4/zUG1Tyw IronPort-HdrOrdr: A9a23:fQ2HiaP2gCoMvsBcTtqjsMiBIKoaSvp037BN7TESdfU1SL36qynApp4mPHPP5Qr5O0tBpTnjAse9qBrnnPYf3WB7B9iftWfd1FdAYLsC0bff X-IronPort-AV: E=Sophos;i="5.87,269,1631570400"; d="scan'208";a="6547546" Received: from 173.121.68.85.rev.sfr.net (HELO hadrien) ([85.68.121.173]) by mail2-relais-roc.national.inria.fr with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 27 Nov 2021 19:15:45 +0100 Date: Sat, 27 Nov 2021 19:15:45 +0100 (CET) From: Julia Lawall X-X-Sender: jll@hadrien To: Matthew Wilcox cc: cgel.zte@gmail.com, akpm@linux-foundation.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, chiminghao , Zeal Robot Subject: scripts/coccinelle: drop bugon.cocci Message-ID: User-Agent: Alpine 2.22 (DEB 394 2020-01-19) MIME-Version: 1.0 X-Rspamd-Server: rspam11 X-Rspamd-Queue-Id: D09F3F0000A0 X-Stat-Signature: y9zbnd6g76jyxed3cae7okr93gzsd9t5 Authentication-Results: imf16.hostedemail.com; dkim=none; dmarc=none; spf=pass (imf16.hostedemail.com: domain of julia.lawall@inria.fr designates 192.134.164.83 as permitted sender) smtp.mailfrom=julia.lawall@inria.fr X-HE-Tag: 1638036941-322331 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000002, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: The BUG_ON script was never safe, in that it was not able to check whether the condition was side-effecting. At this point, BUG_ON should be well known, so it has probably outlived its usefuless. Signed-off-by: Julia Lawall Suggested-by: Matthew Wilcox diff --git a/scripts/coccinelle/misc/bugon.cocci b/scripts/coccinelle/misc/bugon.cocci deleted file mode 100644 index 8d595c358408..000000000000 --- a/scripts/coccinelle/misc/bugon.cocci +++ /dev/null @@ -1,63 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0-only -/// Use BUG_ON instead of a if condition followed by BUG. -/// -//# This makes an effort to find cases where BUG() follows an if -//# condition on an expression and replaces the if condition and BUG() -//# with a BUG_ON having the conditional expression of the if statement -//# as argument. -// -// Confidence: High -// Copyright: (C) 2014 Himangi Saraogi. -// Comments: -// Options: --no-includes --include-headers - -virtual patch -virtual context -virtual org -virtual report - -//---------------------------------------------------------- -// For context mode -//---------------------------------------------------------- - -@depends on context@ -expression e; -@@ - -*if (e) BUG(); - -//---------------------------------------------------------- -// For patch mode -//---------------------------------------------------------- - -@depends on patch@ -expression e; -@@ - --if (e) BUG(); -+BUG_ON(e); - -//---------------------------------------------------------- -// For org and report mode -//---------------------------------------------------------- - -@r depends on (org || report)@ -expression e; -position p; -@@ - - if (e) BUG@p (); - -@script:python depends on org@ -p << r.p; -@@ - -coccilib.org.print_todo(p[0], "WARNING use BUG_ON") - -@script:python depends on report@ -p << r.p; -@@ - -msg="WARNING: Use BUG_ON instead of if condition followed by BUG.\nPlease make sure the condition has no side effects (see conditional BUG_ON definition in include/asm-generic/bug.h)" -coccilib.report.print_report(p[0], msg) -