lkml.org 
[lkml]   [2007]   [Dec]   [14]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] Make WARN_ON/WARN_ON_ONCE no-ops when CONFIG_BUG is off
On Fri, Dec 14, 2007 at 09:27:55PM +0800, Herbert Xu wrote:
> Hi:
>
> [PATCH] Make WARN_ON/WARN_ON_ONCE no-ops when CONFIG_BUG is off
>
> The description of CONFIG_BUG clearly states that both BUG and
> WARN_ON may be skipped. However, our actual implementation still
> checks the condition on WARN_ON if it's used as part of an if
> statement or such.
>
> This patch makes it return 0 after evaluating the expression
> if CONFIG_BUG is disabled. This is consistent with the spirit
> of the CONFIG_BUG option.

I added CONFIG_BUG, and I think the current behavior is correct. As
you've noticed, we have to evaluate condition, it may have
side-effects. And if code does:

/* this indicates a driver bug, report and fail gracefully */
if (WARN_ON(val == NULL))
return -EFAULT;

..we surely want it to continue returning -EFAULT, regardless of
whether we log it, no? What use case did you have in mind?

--
Mathematics is the supreme nostalgia of our time.


\
 
 \ /
  Last update: 2007-12-14 19:05    [W:0.121 / U:0.016 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site