* [PATCH] add BUG_ON to 2.4 #1
@ 2002-01-25 23:14 Robert Love
2002-01-26 3:17 ` John Levon
0 siblings, 1 reply; 4+ messages in thread
From: Robert Love @ 2002-01-25 23:14 UTC (permalink / raw)
To: marcelo; +Cc: linux-kernel
The following patch adds the BUG_ON (as seen on TV and 2.5) define to
the 2.4 kernel. This will help in portability and back-porting from 2.5
to 2.4, plus BUG_ON is a nice optimization and aids readability.
For the unaware, BUG_ON(condition) calls bug on !condition, which is
marked unlikely().
This is the generalized arch-independent BUG_ON as in later 2.5 kernels.
Marcelo, please apply.
Robert Love
--- linux-2.4.18-pre7/include/linux/kernel.h Thu Jan 24 13:48:18 2002
+++ linux/include/linux/kernel.h Fri Jan 25 17:53:54 2002
@@ -11,6 +11,7 @@
#include <linux/linkage.h>
#include <linux/stddef.h>
#include <linux/types.h>
+#include <linux/compiler.h>
/* Optimization barrier */
/* The "volatile" is due to gcc bugs */
@@ -181,4 +182,5 @@
char _f[20-2*sizeof(long)-sizeof(int)]; /* Padding: libc5 uses this.. */
};
+#define BUG_ON(condition) do { if (unlikely((condition)!=0)) BUG(); } while(0)
#endif
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] add BUG_ON to 2.4 #1
2002-01-25 23:14 [PATCH] add BUG_ON to 2.4 #1 Robert Love
@ 2002-01-26 3:17 ` John Levon
2002-01-26 3:22 ` Robert Love
0 siblings, 1 reply; 4+ messages in thread
From: John Levon @ 2002-01-26 3:17 UTC (permalink / raw)
To: linux-kernel
On Fri, Jan 25, 2002 at 06:14:05PM -0500, Robert Love wrote:
> The following patch adds the BUG_ON (as seen on TV and 2.5) define to
> the 2.4 kernel. This will help in portability and back-porting from 2.5
> to 2.4, plus BUG_ON is a nice optimization and aids readability.
I mentioned earlier today we need someone to step up and write a kcompat.h
for 2.5 stuff like minor() and the new remap_page_range().
I'll have to do this anyway for the stuff I use (I already have oodles of
2.2 stuff) but it would be nice to be able to use a "standard" header (and .c
if necessary)
regards
john
--
"ALL television is children's television."
- Richard Adler
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] add BUG_ON to 2.4 #1
2002-01-26 3:17 ` John Levon
@ 2002-01-26 3:22 ` Robert Love
2002-01-26 3:27 ` John Levon
0 siblings, 1 reply; 4+ messages in thread
From: Robert Love @ 2002-01-26 3:22 UTC (permalink / raw)
To: John Levon; +Cc: linux-kernel
On Fri, 2002-01-25 at 22:17, John Levon wrote:
> I mentioned earlier today we need someone to step up and write a kcompat.h
> for 2.5 stuff like minor() and the new remap_page_range().
>
> I'll have to do this anyway for the stuff I use (I already have oodles of
> 2.2 stuff) but it would be nice to be able to use a "standard" header (and .c
> if necessary)
Hopefully Marcelo will take this patch and we won't need BUG_ON, at
least, for 2.5->2.4 compatibility.
Robert Love
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] add BUG_ON to 2.4 #1
2002-01-26 3:22 ` Robert Love
@ 2002-01-26 3:27 ` John Levon
0 siblings, 0 replies; 4+ messages in thread
From: John Levon @ 2002-01-26 3:27 UTC (permalink / raw)
To: linux-kernel
On Fri, Jan 25, 2002 at 10:22:51PM -0500, Robert Love wrote:
> Hopefully Marcelo will take this patch and we won't need BUG_ON, at
> least, for 2.5->2.4 compatibility.
we still need it in kcompat.h so I can compile under 2.4.<random>,
and 2.2.<random> for that matter.
regards
john
--
"ALL television is children's television."
- Richard Adler
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2002-01-26 3:24 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-01-25 23:14 [PATCH] add BUG_ON to 2.4 #1 Robert Love
2002-01-26 3:17 ` John Levon
2002-01-26 3:22 ` Robert Love
2002-01-26 3:27 ` John Levon
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox