Re: [NET]: Shut up warnings in net/core/flow.c

From: Linus Torvalds
Date: Wed Nov 23 2005 - 11:54:57 EST




On Wed, 23 Nov 2005, David S. Miller wrote:
>
> From: Andrew Morton <akpm@xxxxxxxx>
> Date: Wed, 23 Nov 2005 00:21:34 -0800
>
> > Nope, this will break !CONFIG_SMP builds. Quite a few places in the
> > kernel do not implement the ipi handler if !CONFIG_SMP.
>
> Ho hum, nothing is ever easy eh? :-) I think your patch is fine for
> now, but in the long term the !CONFIG_SMP ifdefs for those ipi
> handlers should probably just get removed. If GCC can't optimize
> those things away, I'd be really surprised.

I just reverted the whole commit.

We've had this exact thing before, and it's easy enough to handle, but you
have to do it right.

The way to handle it is to do

static inline int maybe_ignored(int arg, ...)
{
return arg;
}

#define smp_call_function(func,info,retry,wait) \
maybe_ignored(0, info, retry, wait)

which is a very useful way to say: we don't care about "func", but we want
to avoid unused warnings for "info", "retry" and "wait", and we want to
return 0 regardless and compile it all away.

If somebody tests this, puts the "maybe_ignored()" function in some nice
generic header file, I'll apply it.

I _refuse_ to apply the patch from Andrew that adds "(void)" to shut up
the compiler. That's a piece of crap, and we should never do things like
that. Bad C style.

Linus
-
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/