[Bug c/46859] Attribute depends on location
joseph at codesourcery dot com
gcc-bugzilla@gcc.gnu.org
Thu Dec 9 21:24:00 GMT 2010
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46859
--- Comment #6 from joseph at codesourcery dot com <joseph at codesourcery dot com> 2010-12-09 21:23:53 UTC ---
On Thu, 9 Dec 2010, hjl.tools at gmail dot com wrote:
> For
>
> int *
> __attribute__((aligned(4096)))
> foo2 ()
> {
> return 0;
> }
>
> parser applies attribute to "int *" instead of foo2.
Yes, this is as documented, just like if you had a type qualifier there.
I see that two critical words were missing in the relevant section of the
manual; I've applied this patch to add them.
Index: doc/extend.texi
===================================================================
--- doc/extend.texi (revision 167663)
+++ doc/extend.texi (working copy)
@@ -4036,7 +4036,7 @@
declaration @code{T D} specifies the type
``@var{derived-declarator-type-list} @var{Type}'' for @var{ident}, then
@code{T D1} specifies the type ``@var{derived-declarator-type-list}
-@var{type-qualifier-and-attribute-specifier-list} @var{Type}'' for
+@var{type-qualifier-and-attribute-specifier-list} pointer to @var{Type}'' for
@var{ident}.
For example,
Index: ChangeLog
===================================================================
--- ChangeLog (revision 167663)
+++ ChangeLog (working copy)
@@ -1,5 +1,10 @@
2010-12-09 Joseph Myers <joseph@codesourcery.com>
+ * doc/extend.texi (Attribute Syntax): Correct description of
+ attributes in pointer declarators.
+
+2010-12-09 Joseph Myers <joseph@codesourcery.com>
+
* config/mips/vxworks.h (DBX_REGISTER_NUMBER): Undefine.
* config.gcc (mips64*-*-linux* | mipsisa64*-*-linux*,
mips*-*-linux*, mips-wrs-vxworks): Don't use svr4.h.
More information about the Gcc-bugs
mailing list