This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: RFC: Deprecate (a little bit) of C++ attribute syntax
- From: Gabriel Dos Reis <gdr at integrable-solutions dot net>
- To: mark at codesourcery dot com
- Cc: gcc at gcc dot gnu dot org, jason at redhat dot com, nathan at codesourcery dot com, gdr at codesourcery dot com
- Date: 14 Aug 2002 02:08:17 +0200
- Subject: Re: RFC: Deprecate (a little bit) of C++ attribute syntax
- Organization: CodeSourcery, LLC
- References: <200208132257.g7DMvle32325@localhost.localdomain>
Mark Mitchell <mark@codesourcery.com> writes:
| Currently, the C++ front end accepts this syntax:
|
| int x (3) __attribute__((unused));
[...]
| Therefore, I'm proposing deprecating this syntax in GCC 3.3 and
| removing it in GCC 3.4 (with the new parser).
| I'm not sure if I can
| get the old parser to actually warn about this (it's confused and
| thinks the parenthesized initializer is part of the declarator, but
| there is then later magic to untangle that!)
Do you think it is the same reason why it seems to ignore
attributes for nested typedef-names? I.e. in
struct A {
struct X { } __attribute__((__aligned__(4)));
typedef struct { } Y __attribute__((__aligned__(4)));
};
__alignof__(A::X) == 4 but __alignof__(A::Y) == 1.
?
| Objections?
I mostly agree with all of yours suggestions -- as you know, I've been
working on the attribute stuff these days. The oddity you mention may
be more prenicious. Consider:
template<typename T>
struct X { } __attribute__((__aligned__(__alignof__(T))));
This may, at first sight, look innocent, but it doesn't do the obvious
thing one thinks of.
The problem here is that at the closing brace, the template-parameter
"T" goes out of scope -- the current parser doesn't diagnose it
because we don't do 2-phase name lookup yet.
-- Gaby