All of lore.kernel.org
 help / color / mirror / Atom feed
From: Benjamin Herrenschmidt <benh@kernel.crashing.org>
To: kevin diggs <diggskevin38@gmail.com>
Cc: Andreas Schwab <schwab@linux-m68k.org>,
	linuxppc-dev@lists.ozlabs.org,
	Evan Lavelle <sa212+lppc@cyconix.com>
Subject: Re: halt/reset on assert?
Date: Fri, 08 Apr 2011 07:48:09 +1000	[thread overview]
Message-ID: <1302212889.2458.40.camel@pasglop> (raw)
In-Reply-To: <BANLkTimX==Ei2Sn=86svSajHNX+0G1WM9w@mail.gmail.com>

On Thu, 2011-04-07 at 12:04 -0500, kevin diggs wrote:
> On Thu, Apr 7, 2011 at 2:55 AM, Benjamin Herrenschmidt
> <benh@kernel.crashing.org> wrote:
> > On Wed, 2011-04-06 at 14:01 +0100, Evan Lavelle wrote:
> >> #define MY_ASSERT(expr) if(!(expr)) BUG()
> >
> > Make it
> >
> > #define MY_ASSERT(expr) do { if .... } while(0)
> >
> > To ensure it has proper single statement semantics in C.
> >
> So THAT'S why they do this!!!!!! Now I just have to figure out what
> 'proper single statement semantics' means!

Thing what happens without the do { ... } while(0) if you have code
that looks like:

	if (enable_debug)
		MY_ASSERT(foo);
	else
		something_else;

Ben.

  reply	other threads:[~2011-04-07 21:48 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <4D966C5C.9030409__15236.8285613649$1301704900$gmane$org@cyconix.com>
2011-04-02  6:51 ` halt/reset on assert? Andreas Schwab
2011-04-02  6:53 ` Andreas Schwab
2011-04-06 13:01   ` Evan Lavelle
2011-04-07  7:55     ` Benjamin Herrenschmidt
2011-04-07 17:04       ` kevin diggs
2011-04-07 21:48         ` Benjamin Herrenschmidt [this message]
2011-04-02  0:22 Evan Lavelle

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=1302212889.2458.40.camel@pasglop \
    --to=benh@kernel.crashing.org \
    --cc=diggskevin38@gmail.com \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=sa212+lppc@cyconix.com \
    --cc=schwab@linux-m68k.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.