From: Linus Torvalds <torvalds@linux-foundation.org>
To: Al Viro <viro@ftp.linux.org.uk>
Cc: linux-sparse@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [RFC] bloody mess with __attribute__() syntax
Date: Thu, 5 Jul 2007 09:41:55 -0700 (PDT) [thread overview]
Message-ID: <alpine.LFD.0.98.0707050930330.9434@woody.linux-foundation.org> (raw)
In-Reply-To: <20070705093528.GK21478@ftp.linux.org.uk>
On Thu, 5 Jul 2007, Al Viro wrote:
>
> Now, that idiocy would be none of our concern, if not for the fact
> that noderef and address_space() are definitely supposed to imitate
> qualifiers.
Absolutely.
> Note that gcc rules for __attribute__() (and that's the only source
> of rules we _have_ for the damn thing) clearly say that
> int __user *p;
> is the same thing as
> int *__user p;
Quick question: is there some reason why we have to honor the crazy gcc
rules, and cannot try to convince gcc people that they are insane?
That said:
> Frankly, I would rather add a new primitive (__qualifier__) mirroring the
> __attribute__, but acting like real qualifiers do.
I'd be ok with that, but I would in many ways just prefer to keep the
existing syntax, and just make the qualifiers be a separate _namespace_
within the attribute setup.
We already really should be able to handle that perfectly well, since we
look up the attribute names using the normal name lookup functions, which
already has the notion of different namespaces.
IOW, as far as I can tell, there's really no reason to add a
"__qualifier__" handler, because it's not going to help us. Anything we
can do with __qualifier__, we can already do with our __attribute__
parsing: what you suggest would involve having a new place for parsing
__attributes__, and making the *current* qualifier-like attribute parsing
trigger on "__qualifier__" instead.
So what I'd suggest is to just have *both* cases trigger on __attribute__,
but in the qualifier case we'd use NS_QUALIFIER to look up the attribute
function, and in the non-qualifier case we'd use NS_ATTRIBUTE (right now
we always use NS_KEYWORD, and that's probably bogus: we should put the
attribute names in another namespace _anyway_).
That would effectively mean that "__attribute__()" is just a way to escape
into another set of namespaces. The advantage of that is that we could
possibly support attributes in other places more naturally (ie we could
have another namespace for attributes on statements or inline assembly,
and we wouldn't ever introduce yet another keyword - the *name* in the
attribute is the real keyword)
Linus
next prev parent reply other threads:[~2007-07-05 16:42 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-07-05 9:35 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
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-05 16:41 ` Linus Torvalds [this message]
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=alpine.LFD.0.98.0707050930330.9434@woody.linux-foundation.org \
--to=torvalds@linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
--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
all inboxes | Powered by JetHome®