Patchwork [Bug,c/46859] Attribute depends on location

login
register
mail settings
Submitter Joseph S. Myers
Date Dec. 9, 2010, 9:23 p.m.
Message ID <Pine.LNX.4.64.1012092122110.32497@digraph.polyomino.org.uk>
Download mbox | patch
Permalink /patch/74991/
State New
Headers show

Comments

Joseph S. Myers - Dec. 9, 2010, 9:23 p.m.
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.

Patch

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.