From: Al Viro <viro@ftp.linux.org.uk>
To: Ulrich Weigand <Ulrich.Weigand@de.ibm.com>
Cc: Arnd Bergmann <arnd@arndb.de>,
linux-kernel@vger.kernel.org, linux-sparse@vger.kernel.org,
Linus Torvalds <torvalds@linux-foundation.org>,
Ben Elliston <elliston@au1.ibm.com>
Subject: Re: [RFC] bloody mess with __attribute__() syntax
Date: Thu, 5 Jul 2007 17:27:41 +0100 [thread overview]
Message-ID: <20070705162741.GL21478@ftp.linux.org.uk> (raw)
In-Reply-To: <OFC2AA6078.1DF7BE7E-ON4225730F.0044BE34-4225730F.0046B6F1@de.ibm.com>
On Thu, Jul 05, 2007 at 02:52:22PM +0200, Ulrich Weigand wrote:
> The Named Address Space extension is documented in chapter 5 of
> Technical Report 18037:
> ISO/IEC JTC1 SC22 WG14 N1169
> "Programming languages - C - Extensions to support embedded processors"
> http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1169.pdf
Humm... The only syntax for defining address spaces I see there is in
appendix B and frankly, it doesn't look right. BTW, they forgot to
ban auto struct {<address_space> int x;} y - my preference would be
to ban address_space on struct/union members, but the tastes differ.
In any case, since they prohibit auto <address_space> int z, they'd
better find some approach prohibiting that one.
> We've currently implemented support for one Cell-specific address
> space qualifier according to that syntax. Before submitting this
> for inclusion in GCC, we're planning to make the implementation
> more general to support arbitrary address space qualifiers;
> something like the sparse "__user" attribute would appear to be
> a natural use case for that syntax extension.
>
> (CC'ing Ben Elliston, who is working on the GCC front-end
> implementation.)
OK. AFAICS,
a) __attribute__ is not an option since it doesn't act as
a qualifier (i.e. won't satisfy the requirements of section 5 in
there). In constructs like int __attribute__((foo)) *p, attribite
applies to int *, not to int, according to gcc documentation.
b) we still need noderef, unless implementation provides
some way to tie that to address space itself.
c) we need some way to declare address spaces that would *not*
be subsets of generic one; rules for pointer conversions allow conversion
from nested address space on assignment and we definitely don't want
that for __user -> generic or __iomem -> generic.
d) addressmod() doesn't look right for declaration of address space.
Looks like it's a macro anyway (it accepts macros for accessors, so it
can't live after preprocessing phase), so... what syntax are you using
for declarations?
e) [IMPORTANT] typeof() behaviour: at the very least, we want
some way to strip __user on typeof(). Even if it turns into a new
primitive (__unqualify__(type)). gcc typeof leaves qualifiers in place.
We very definitely want a way to have an auto variable declared with
given type sans the address space; think of obvious uses in macros.
If __user et.al. are based on some sparse-only mechanism, we can special-case
them all we want, but if it becomes something gcc would understand... We
will need the same semantics.
So we either need gcc typeof() to remove address space qualifier
(IMO unlikely to happen) *or* an independent primitive that would strip
qualifiers from a type, so that with
typedef const int C;
typedef int A[2];
we would have
__unqualify__(const int) => int
__unqualify__(const int *) => const int * // qualifier inside
__unqualify__(__user int) => int
__unqualify__(int __user *) => int __user * // qualifier inside
__unqualify__(int * __user) => int *
__unqualify__(C) => int
__unqualify__(const A) => int[2]
__unqualify__(const int [2]) => int[2] // same type as in previous
next prev parent reply other threads:[~2007-07-05 16:27 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-07-05 9:35 [RFC] bloody mess with __attribute__() syntax Al Viro
2007-07-05 12:03 ` Arnd Bergmann
[not found] ` <OFC2AA6078.1DF7BE7E-ON4225730F.0044BE34-4225730F.0046B6F1@de.ibm.com>
2007-07-05 16:27 ` Al Viro [this message]
2007-07-13 9:04 ` Al Viro
2007-07-05 15:36 ` Josh Triplett
2007-07-05 16:43 ` Al Viro
2007-07-05 18:50 ` Josh Triplett
2007-07-05 19:13 ` Al Viro
2007-07-05 19:35 ` Josh Triplett
2007-07-05 20:08 ` Al Viro
2007-07-05 20:56 ` Linus Torvalds
2007-07-06 3:26 ` Al Viro
2007-07-05 21:09 ` Josh Triplett
2007-07-06 7:48 ` Al Viro
2007-07-06 8:33 ` Josh Triplett
2007-07-06 15:52 ` Al Viro
2007-07-06 19:29 ` Josh Triplett
2007-07-07 2:11 ` Al Viro
2007-07-07 2:28 ` Josh Triplett
2007-07-08 21:50 ` Al Viro
2007-07-07 2:30 ` Al Viro
2007-07-07 2:55 ` Josh Triplett
2007-07-08 21:52 ` Al Viro
2007-07-05 16:41 ` Linus Torvalds
2007-07-05 16:53 ` Al Viro
2007-07-05 17:02 ` Chris Lattner
2007-07-05 17:09 ` Al Viro
2007-07-05 17:26 ` Linus Torvalds
2007-07-05 18:07 ` Al Viro
2007-07-05 18:56 ` Linus Torvalds
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=20070705162741.GL21478@ftp.linux.org.uk \
--to=viro@ftp.linux.org.uk \
--cc=Ulrich.Weigand@de.ibm.com \
--cc=arnd@arndb.de \
--cc=elliston@au1.ibm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-sparse@vger.kernel.org \
--cc=torvalds@linux-foundation.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).