From: Josh Triplett <josht@linux.vnet.ibm.com>
To: Al Viro <viro@ftp.linux.org.uk>
Cc: linux-sparse@vger.kernel.org
Subject: Re: [RFC] show_type() format problems
Date: Thu, 12 Jul 2007 09:22:10 -0700 [thread overview]
Message-ID: <1184257330.3000.7.camel@josh-work.beaverton.ibm.com> (raw)
In-Reply-To: <20070712091453.GY21668@ftp.linux.org.uk>
On Thu, 2007-07-12 at 10:14 +0100, Al Viro wrote:
> 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?
Please do go ahead and change the output. I'd love for show_type to
output something as close to a parsable C type as possible.
> 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...
I do understand the concern, but I think that consistency of build logs
matters far less than sanity for the users of *current* Sparse. Let's
no go making purely gratuitous output changes, but here we have a good
reason to change the output.
- Josh Triplett
next prev parent reply other threads:[~2007-07-12 16:27 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-07-12 9:14 [RFC] show_type() format problems Al Viro
2007-07-12 16:22 ` Josh Triplett [this message]
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=1184257330.3000.7.camel@josh-work.beaverton.ibm.com \
--to=josht@linux.vnet.ibm.com \
--cc=linux-sparse@vger.kernel.org \
--cc=viro@ftp.linux.org.uk \
/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).