lkml.org 
[lkml]   [2004]   [Aug]   [28]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [2.6 patch][1/3] ipc/ BUG -> BUG_ON conversions
On Sat, Aug 28, 2004 at 12:05:10PM -0400, Kyle Moffett wrote:
> On Aug 28, 2004, at 11:15, Adrian Bunk wrote:
> >The patch below does BUG -> BUG_ON conversions in ipc/ .
> >--- linux-2.6.9-rc1-mm1-full-3.4/ipc/shm.c.old 2004-08-28
> >15:55:28.000000000 +0200
> >+++ linux-2.6.9-rc1-mm1-full-3.4/ipc/shm.c 2004-08-28
> >16:02:56.000000000 +0200
> >@@ -86,8 +86,7 @@
> > static inline void shm_inc (int id) {
> > struct shmid_kernel *shp;
> >
> >- if(!(shp = shm_lock(id)))
> >- BUG();
> >+ BUG_ON(!(shp = shm_lock(id)));
>
> This won't work:
>
> With debugging mode:
> if (unlikely(!(shp = shm_lock(id)))) BUG();
>
> Without debugging mode:
> do { } while(0)

Where in 2.6.9-rc1-mm1 is this "Without debugging mode" defined?

> Anything you put in BUG_ON() must *NOT* have side effects.
>...

I'd have said exactly the same some time ago, but I was convinced by
Arjan that if done correctly, a BUG_ON() with side effects is possible
with no extra cost even if you want to make BUG configurably do nothing.

cu
Adrian

--

"Is there not promise of rain?" Ling Tan asked suddenly out
of the darkness. There had been need of rain for many days.
"Only a promise," Lao Er said.
Pearl S. Buck - Dragon Seed

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 14:05    [W:1.754 / U:0.508 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site