linux-sparse.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [RFC] show_type() format problems
@ 2007-07-12  9:14 Al Viro
  2007-07-12 16:22 ` Josh Triplett
  0 siblings, 1 reply; 3+ messages in thread
From: Al Viro @ 2007-07-12  9:14 UTC (permalink / raw)
  To: linux-sparse

int __attribute__((address_space(1))) **p;
int *__attribute__((address_space(1))) *q;

void foo(void)
{
        p = q;
}

quite predictably gives a warning.  The contents of that warning,
however, is somewhat unfortunate:

test.c:6:4: warning: incorrect type in assignment (different address spaces)
test.c:6:4:    expected int **[addressable] [toplevel] p<asn:1>
test.c:6:4:    got int **[addressable] [toplevel] q<asn:1>

The reason is simple: we put <asn:...> *after* the identifier.  *, of
course, goes before it.  So when we have a pointer to pointer, there's
no way to tell which of them had brought address_space.

Do we want to keep the current behaviour?  It's obviously not nice -
especially when we get warnings like one above.

We also can't tell pointer to array from array of pointers.  Does anybody
object against making it look more like C declarations?  I.e. put <asn:...>
together with modifiers and at least add parens when needed?

Believe me, I do realize that it will change build logs.  I probably have
more of those than just about anybody else (several years worth of sparse
runs on the kernel for couple dozens of targets).  And yes, it'll hurt.
I don't see a better alternative, though; we might be able to tweak the
output to deal with ambiguities and still keep the same results for (very)
simple cases, but if we are tweaking it at all we really ought to go for
something recognizable for normal C programmers...

Comments?

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2007-07-12 18:25 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-07-12  9:14 [RFC] show_type() format problems Al Viro
2007-07-12 16:22 ` Josh Triplett
2007-07-12 18:25   ` Al Viro

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).