From: Arjan van de Ven <arjan@infradead.org>
To: "Vegard Nossum" <vegard.nossum@gmail.com>
Cc: linux-kernel@vger.kernel.org, akpm@linux-foundation.org
Subject: Re: [patch 2/3] Add a WARN() macro; this is WARN_ON() + printk arguments
Date: Wed, 7 May 2008 06:37:20 -0700 [thread overview]
Message-ID: <20080507063720.7aa1baf7@infradead.org> (raw)
In-Reply-To: <19f34abd0805062341x21caa29dld03d838057d498e3@mail.gmail.com>
On Wed, 7 May 2008 08:41:31 +0200
"Vegard Nossum" <vegard.nossum@gmail.com> wrote:
> Hi!
>
> On Wed, May 7, 2008 at 8:21 AM, Arjan van de Ven
> <arjan@infradead.org> wrote:
> > Subject: Add a WARN() macro; this is WARN_ON() + printk arguments
> > From: Arjan van de Ven <arjan@linux.intel.com>
> >
> > Add a WARN() macro that acts like WARN_ON(), with the added
> > feature that it takes a printk like argument that is printed as
> > part of the warning message.
>
> [...]
>
> > +#ifndef WARN
> > +#define WARN(condition, format...)
> > ({ \
> > + int __ret_warn_on
> > = !!(condition); \
> > + if
> > (unlikely(__ret_warn_on)) \
> > +
> > __WARN_printf(format); \
> > +
> > unlikely(__ret_warn_on); \
> > +}) +#endif
>
> Is there a good reason why this is not a static inline function?
yes there is, and it's the same one that makes WARN_ON() not an inline
function (I tried); it's not possible to find a type for "condition"
that works for all callers.
> If WARN() is made a static inline, you can call
> __builtin_return_address(0) there and pass it into here instead. This
> seems like a kind of low-level internal function anyway, because of
> the file/line info.
if I could make it a static inline, I would make it an out of line
instead to save space ;)
next prev parent reply other threads:[~2008-05-07 13:37 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-05-07 6:20 [patch 1/3] Rename WARN() to WARNING() to clear the namespace Arjan van de Ven
2008-05-07 6:21 ` [patch 2/3] Add a WARN() macro; this is WARN_ON() + printk arguments Arjan van de Ven
2008-05-07 6:21 ` [patch 3/3] Example use of WARN() Arjan van de Ven
2008-05-14 4:36 ` Andrew Morton
2008-05-14 4:51 ` Arjan van de Ven
2008-05-15 3:43 ` Arjan van de Ven
2008-05-07 6:41 ` [patch 2/3] Add a WARN() macro; this is WARN_ON() + printk arguments Vegard Nossum
2008-05-07 13:37 ` Arjan van de Ven [this message]
2008-05-07 7:31 ` Jiri Slaby
2008-05-07 12:46 ` [patch 1/3] Rename WARN() to WARNING() to clear the namespace Johannes Weiner
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=20080507063720.7aa1baf7@infradead.org \
--to=arjan@infradead.org \
--cc=akpm@linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=vegard.nossum@gmail.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®