On Sat, 24 Mar 2007, Randy Dunlap wrote:
>
> But I would not complain if sparse just read & ignored the
> attributes (rather than throwing errors on them).
Well, sparse is often also an "arbiter of good taste".
"Technically correct" or "..but gcc accepts it" are secondary to "does the
source make sense".
For example, gcc accepts a *lot* of insanity when it comes to attributes
in odd places. That doesn't necessarily mean that sparse should accept it.
And any C compiler will accept
void *ptr = 0;
and that doesn't mean that sparse should accept that mind-boggling bug in
the C standard. Yes, the zero constant is a special pointer, but it's
special when cast to a pointer type, not when used as a integer. And the
fact that the C standard disagrees with me just means that the C standard
is wrong.
So I don't think sparse should necessarily accept crap code just because
(a) gcc accepts it and (b) there is some crap code in the kernel that uses
it. That "__attribute__((unused))" on a label seems to be exactly that
kind of horror. It's not like it's any prettier than tons of *valid* ways
to do the same (for example, using the C preprocessor).
Linus
-
To unsubscribe from this list: send the line "unsubscribe linux-sparse" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at http://vger.kernel.org/majordomo-info.html