From: Mark Fasheh Date: Mon Feb 18 12:16:27 2008 Subject: [Ocfs2-devel] Re: [PATCH 3/7] fs/ocfs2: Use BUG_ON In-Reply-To: References: Message-ID: <20080218201453.GA22671@ca-server1.us.oracle.com> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: Julia Lawall Cc: kurt.hackel@oracle.com, ocfs2-devel@oss.oracle.com, linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org On Sun, Feb 17, 2008 at 06:55:49PM +0100, Julia Lawall wrote: > From: Julia Lawall > > if (...) BUG(); should be replaced with BUG_ON(...) when the test has no > side-effects to allow a definition of BUG_ON that drops the code completely. > > The semantic patch that makes this change is as follows: > (http://www.emn.fr/x-info/coccinelle/) > > // > @ disable unlikely @ expression E,f; @@ > > ( > if (<... f(...) ...>) { BUG(); } > | > - if (unlikely(E)) { BUG(); } > + BUG_ON(E); > ) > > @@ expression E,f; @@ > > ( > if (<... f(...) ...>) { BUG(); } > | > - if (E) { BUG(); } > + BUG_ON(E); > ) > // > > Signed-off-by: Julia Lawall Acked-by: Mark Fasheh -- Mark Fasheh Principal Software Developer, Oracle mark.fasheh@oracle.com