* Re: [IA64] Add mapping table between irq and vector [not found] <200707201959.l6KJxHAu019185@hera.kernel.org> @ 2007-07-20 20:17 ` Andrew Morton 2007-07-20 20:21 ` Andrew Morton 0 siblings, 1 reply; 2+ messages in thread From: Andrew Morton @ 2007-07-20 20:17 UTC (permalink / raw) To: Yasuaki Ishimatsu, Kenji Kaneshige; +Cc: linux-ia64, linux-kernel On Fri, 20 Jul 2007 19:59:17 GMT Linux Kernel Mailing List <linux-kernel@vger.kernel.org> wrote: > + BUG_ON(bind_irq_vector(irq, vector)); It's not good practice to do assert(expression-with-side-effects). Because if someone wants to create a build which has all the assertions disabled, the resulting binary will not work. In the present implementation our BUG_ON(expression) will evaluate `expression' even if CONFIG_BUG=n. But that's totally lame and we are just leaving optimisation opportunities on the floor. Our objective _should_ be to make BUG_ON(expr) generate no code at all if CONFIG_BUG=n. So please, prefer to do if (bind_irq_vector(irq, vector)) BUG(); ^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [IA64] Add mapping table between irq and vector 2007-07-20 20:17 ` [IA64] Add mapping table between irq and vector Andrew Morton @ 2007-07-20 20:21 ` Andrew Morton 0 siblings, 0 replies; 2+ messages in thread From: Andrew Morton @ 2007-07-20 20:21 UTC (permalink / raw) To: Yasuaki Ishimatsu, Kenji Kaneshige, linux-ia64, linux-kernel On Fri, 20 Jul 2007 13:17:28 -0700 Andrew Morton <akpm@linux-foundation.org> wrote: > On Fri, 20 Jul 2007 19:59:17 GMT > Linux Kernel Mailing List <linux-kernel@vger.kernel.org> wrote: > > > + BUG_ON(bind_irq_vector(irq, vector)); > > It's not good practice to do assert(expression-with-side-effects). Because > if someone wants to create a build which has all the assertions disabled, > the resulting binary will not work. > > In the present implementation our BUG_ON(expression) will evaluate > `expression' even if CONFIG_BUG=n. But that's totally lame and we are just > leaving optimisation opportunities on the floor. > > Our objective _should_ be to make BUG_ON(expr) generate no code at all if > CONFIG_BUG=n. > > So please, prefer to do > > if (bind_irq_vector(irq, vector)) > BUG(); > hm, now I think about it, our present implementation seems OK. If you have CONFIG_BUG=n then this: BUG_ON(foo < bar); will generate no code and this: BUG_ON(some_function()); will still call some_function(). So I guess we're OK. ^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2007-07-20 20:22 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <200707201959.l6KJxHAu019185@hera.kernel.org>
2007-07-20 20:17 ` [IA64] Add mapping table between irq and vector Andrew Morton
2007-07-20 20:21 ` Andrew Morton
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox