[PATCH] include: add BUG_RETURN_* macros

Peter Hutterer peter.hutterer at who-t.net
Wed May 9 22:51:41 PDT 2012


On Wed, May 09, 2012 at 10:05:51PM -0700, Keith Packard wrote:
> On Thu, 10 May 2012 14:25:25 +1000, Peter Hutterer <peter.hutterer at who-t.net> wrote:
> 
> > +#define BUG_RETURN(cond) \
> > +        do { __BUG_WARN_MSG(cond, 0, NULL); return; } while(0)
> 
> I'm not a huge fan of macros hiding control flow...
 
these are bug macros. their only point is to scream BUG! into the log for
things that really shouldn't have happened.
right now we have a few of these:

    BUG_WARN(foo);
    if (foo)
            return FALSE;

so we check the condition twice. That now becomes
    BUG_RETURN_VAL(foo, FALSE)
which is less clutter, but fulfills the same purpose.

Cheers,
  Peter


More information about the xorg-devel mailing list