All of lore.kernel.org
 help / color / mirror / Atom feed
From: Eric Sesterhenn / snakebyte <snakebyte@gmx.de>
To: kernel-janitors@vger.kernel.org
Subject: Re: [KJ] [Patch 8/9] BUG_ON() Conversion in md/raid6main.c
Date: Thu, 26 Jan 2006 02:18:52 +0000	[thread overview]
Message-ID: <1138241932.7930.6.camel@alice> (raw)
In-Reply-To: <1138233643.7232.45.camel@alice>

[-- Attachment #1: Type: text/plain, Size: 1110 bytes --]

hi,

On Wed, 2006-01-25 at 18:01 -0800, Greg KH wrote:
> >  if BUG() is defined to nothing it still leaves the if, which must be optimized
> >  away by the compiler, not by the preprocessor
> 
> "gcc" is the compiler, not the preprocessor, like I stated :)
> 
> And gcc does this for you, have you looked?

Sure the end result is the same in both cases. But in one case the
preprocessor does the work, by replacing BUG_ON() with nothing,
and in the other case the compiler has to notice there is an empty
if statement.

> Anyway, these cleanups don't really change anything, at the code or
> assembly level, so I don't see the need for them...

I think it is much cleaner to read ( takes less screen space ), but i guess
there was a discussion like this already somewhen, at least the 
janitor.kernelnewbies.org/TODO states:

"make sure BUG() is used correctly (i.e. if(function()) BUG(); is evil)
  i.e. even when no-op-ing BUG we still have an if (See also: BUG_ON)"

In addition to this the BUG_ON define in asm-generic/bug.h also includes
an unlikely() which might generate better code.

Greetings, Eric



[-- Attachment #2: Type: text/plain, Size: 168 bytes --]

_______________________________________________
Kernel-janitors mailing list
Kernel-janitors@lists.osdl.org
https://lists.osdl.org/mailman/listinfo/kernel-janitors

  parent reply	other threads:[~2006-01-26  2:18 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-01-26  0:00 [KJ] [Patch 8/9] BUG_ON() Conversion in md/raid6main.c Eric Sesterhenn / snakebyte
2006-01-26  0:34 ` Greg KH
2006-01-26  0:35 ` Greg KH
2006-01-26  1:25 ` Eric Sesterhenn / snakebyte
2006-01-26  2:01 ` Greg KH
2006-01-26  2:18 ` Eric Sesterhenn / snakebyte [this message]
2006-01-26  8:11 ` Adrian Bunk
2006-01-26  8:15 ` Adrian Bunk

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=1138241932.7930.6.camel@alice \
    --to=snakebyte@gmx.de \
    --cc=kernel-janitors@vger.kernel.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.