lkml.org 
[lkml]   [2012]   [Sep]   [7]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: [PATCH] perf bench: fix assert when NDEBUG is defined
> Its valid (although admittedly dubious) to have BUG_ON with
> side-effects.
>
> The 'right' fix would be something like:
>
> ---
> #ifndef BUG_ON
> +#ifdef NDEBUG
> +#define BUG_ON(cond) do { if (cond) ; } while (0)
> +#else
> #define BUG_ON(cond) assert(!(cond))
> #endif
> +#endif
>

This is indeed the right fix. I will use this approach, test it and resubmit.

Thanks,
Irina


\
 
 \ /
  Last update: 2012-09-08 04:01    [W:0.057 / U:0.548 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site