Re: 2.4.27-pre2: tg3: there's no WARN_ON in 2.4

From: H. Peter Anvin
Date: Tue May 11 2004 - 19:28:12 EST


Followup to: <20040506121302.GI9636@xxxxxxxxx>
By author: Adrian Bunk <bunk@xxxxxxxxx>
In newsgroup: linux.dev.kernel
> > >
> > >yep. Either we backport WARN_ON ;) or simply do the attached.
> > >
> > >--- old/drivers/net/tg3.c 2004-05-04 14:30:22.000000000 +0200
> > >+++ new/drivers/net/tg3.c 2004-05-04 14:49:58.000000000 +0200
> > >@@ -51,6 +51,10 @@
> > > #define TG3_TSO_SUPPORT 0
> > > #endif
> > >
> > >+#ifndef WARN_ON
> > >+#define WARN_ON(x) do { } while (0)
> > >+#endif
> >
> > Related but off topic. Do people find the ab#define WARN_ON(x)
> > a macro acceptable? The fact is that not mentioning 'x' means any
> > side-effects are not executed, meaning the author must take special
> > care when using this macro.
> >...
>
> Do not use code with side effects in BUG_ON and WARN_ON.
>

Why not use the much simpler:

#ifndef WARN_ON
# define WARN_ON(x) ((void)(x))
#endif

Preserves side effects and everything.

-hpa
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/