Messages in this thread | | | Date | Sat, 28 Aug 2004 18:26:34 +0200 | From | Adrian Bunk <> | Subject | Re: [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/
| |