This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Patch to document attributes representation
- To: <gcc-patches at gcc dot gnu dot org>
- Subject: Patch to document attributes representation
- From: "Joseph S. Myers" <jsm28 at cam dot ac dot uk>
- Date: Mon, 9 Jul 2001 00:14:24 +0100 (BST)
This patch to c-tree.texi documents how attributes are represented.
It passes "make info" and "make dvi". Applied to mainline and branch.
2001-07-09 Joseph S. Myers <jsm28@cam.ac.uk>
* doc/c-tree.texi: Document representation of attributes.
diff -ruN doc.orig/c-tree.texi doc/c-tree.texi
--- doc.orig/c-tree.texi Wed Jun 27 14:54:21 2001
+++ doc/c-tree.texi Sun Jul 8 23:01:25 2001
@@ -53,6 +53,7 @@
* Scopes:: Namespaces and classes.
* Functions:: Overloading, function bodies, and linkage.
* Declarations:: Type declarations and variables.
+* Attributes:: Declaration and type attributes.
* Expression trees:: From @code{typeid} to @code{throw}.
@end menu
@@ -1655,6 +1656,40 @@
The @code{WHILE_BODY} is the body of the loop.
@end table
+
+@c ---------------------------------------------------------------------
+@c Attributes
+@c ---------------------------------------------------------------------
+@node Attributes
+@section Attributes in trees
+@cindex attributes
+
+Attributes, as specified using the @code{__attribute__} keyword, are
+represented internally as a @code{TREE_LIST}. The @code{TREE_PURPOSE}
+is the name of the attribute, as an @code{IDENTIFIER_NODE}. The
+@code{TREE_VALUE} is a @code{TREE_LIST} of the arguments of the
+attribute, if any, or @code{NULL_TREE} if there are no arguments; the
+arguments are stored as the @code{TREE_VALUE} of successive entries in
+the list, and may be identifiers or expressions. The @code{TREE_CHAIN}
+of the attribute is the next attribute in a list of attributes applying
+to the same declaration or type, or @code{NULL_TREE} if there are no
+further attributes in the list.
+
+Attributes may be attached to declarations and to types; these
+attributes may be accessed with the following macros. At present only
+machine-dependent attributes are stored in this way (other attributes
+cause changes to the declaration or type or to other internal compiler
+data structures, but are not themselves stored along with the
+declaration or type), but in future all attributes may be stored like
+this.
+
+@deftypefn {Tree Macro} tree DECL_MACHINE_ATTRIBUTES (tree @var{decl})
+This macro returns the attributes on the declaration @var{decl}.
+@end deftypefn
+
+@deftypefn {Tree Macro} tree TYPE_ATTRIBUTES (tree @var{type})
+This macro returns the attributes on the type @var{type}.
+@end deftypefn
@c ---------------------------------------------------------------------
@c Expressions
--
Joseph S. Myers
jsm28@cam.ac.uk