linux-sparse.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Al Viro <viro@ftp.linux.org.uk>
To: linux-sparse@vger.kernel.org
Subject: [RFC] show_type() format problems
Date: Thu, 12 Jul 2007 10:14:53 +0100	[thread overview]
Message-ID: <20070712091453.GY21668@ftp.linux.org.uk> (raw)

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?

             reply	other threads:[~2007-07-12  9:14 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-07-12  9:14 Al Viro [this message]
2007-07-12 16:22 ` [RFC] show_type() format problems Josh Triplett
2007-07-12 18:25   ` Al Viro

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20070712091453.GY21668@ftp.linux.org.uk \
    --to=viro@ftp.linux.org.uk \
    --cc=linux-sparse@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).