Messages in this thread | | | Date | Tue, 15 Jun 2004 19:53:28 -0700 (PDT) | From | Linus Torvalds <> | Subject | Re: [PATCH] security_sk_free void return fixup |
| |
On Tue, 15 Jun 2004, Chris Wright wrote: > > CHECK net/core/sock.c > include/linux/security.h:2636:39: warning: return expression in void function > CC net/core/sock.o
I'm going to remove this warning from sparse. Apparently it is valid C99, and somebody (I think Richard Henderson) made the excellent point that it allows for type-independent code where you do something like
mytype myfunc1(xxx);
mytype myfunc2(xxx) { ... return myfunc1(...); }
and it just works regardless of what type it is.
sparse will obviously warn about expressions with non-void types being returned from a void function, but the case where the expression exists and has the right type should be ok.
I'm not sure it's wonderful C in general, but I certainly can't claim it is actively offensive, and since gcc accepts it and we have these things in the kernel, why complain?
Linus - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
| |