public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Robert Love <rml@tech9.net>
To: marcelo@conectiva.com.br, alan@lxorguk.ukuu.org.uk
Cc: linux-kernel@vger.kernel.org
Subject: [PATCH] 2.4: BUG_ON (1/2)
Date: 02 Apr 2002 21:59:34 -0500	[thread overview]
Message-ID: <1017802779.2941.594.camel@phantasy> (raw)

Marcelo and Alan,

The attached patch adds 2.5's BUG_ON construct to the 2.4 kernel.  This
is done to facilitate portability and back-porting 2.4 <=> 2.5, because
BUG_ON is a very readable construct, and because it is a small
optimization over standard BUG.

For the unaware,  BUG_ON(condition) is basically

        if (unlikely(condition) != 0) BUG();

This is not really about sprinkling BUG_ONs everywhere but helping
backporting.  And I like BUG_ON :)

This patch is against 2.4.19-pre5, but also applies to 2.4.19-pre4-ac3. 
Alan and Marcelo - please apply.

        Robert Love

diff -urN linux-2.4.19-pre5/include/linux/kernel.h linux/include/linux/kernel.h
--- linux-2.4.19-pre5/include/linux/kernel.h	Sat Mar 30 18:26:41 2002
+++ linux/include/linux/kernel.h	Sat Mar 30 18:30:18 2002
@@ -184,4 +184,6 @@
 	char _f[20-2*sizeof(long)-sizeof(int)];	/* Padding: libc5 uses this.. */
 };
 
-#endif
+#define BUG_ON(condition) do { if (unlikely((condition)!=0)) BUG(); } while(0)
+
+#endif /* _LINUX_KERNEL_H */


             reply	other threads:[~2002-04-03  3:03 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-04-03  2:59 Robert Love [this message]
  -- strict thread matches above, loose matches on Subject: below --
2002-03-21  0:15 [PATCH] 2.4: BUG_ON (1/2) Robert Love

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1017802779.2941.594.camel@phantasy \
    --to=rml@tech9.net \
    --cc=alan@lxorguk.ukuu.org.uk \
    --cc=linux-kernel@vger.kernel.org \
    --cc=marcelo@conectiva.com.br \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox