summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Malcolm <dmalcolm@redhat.com>2012-01-11 01:26:39 (GMT)
committerDavid Malcolm <dmalcolm@redhat.com>2012-01-11 01:26:39 (GMT)
commit360652bc4ec1aa3ef1506d9e3cf6bacb0bd1ca67 (patch)
tree2ea37ed5b863b7007a176ce384b84055ba8a4773
parent87df2bf71292729105aa1415f279e4b0ca6070b8 (diff)
downloadgcc-python-plugin-360652bc4ec1aa3ef1506d9e3cf6bacb0bd1ca67.zip
gcc-python-plugin-360652bc4ec1aa3ef1506d9e3cf6bacb0bd1ca67.tar.gz
gcc-python-plugin-360652bc4ec1aa3ef1506d9e3cf6bacb0bd1ca67.tar.xz
docs: document gcc.PLUGIN_ATTRIBUTES (ticket #5)
Document gcc.PLUGIN_ATTRIBUTES Fixes https://fedorahosted.org/gcc-python-plugin/ticket/5
-rw-r--r--docs/attributes.rst2
-rw-r--r--docs/callbacks.rst27
2 files changed, 20 insertions, 9 deletions
diff --git a/docs/attributes.rst b/docs/attributes.rst
index ac310f8..461388c 100644
--- a/docs/attributes.rst
+++ b/docs/attributes.rst
@@ -43,7 +43,7 @@ above custom attributes take a single string parameter. A custom attribute can
take more than one parameter, or none at all.
To create custom attributes from Python, you need to wire up a callback
-response to the `gcc.PLUGIN_ATTRIBUTES` event:
+response to the :py:data:`gcc.PLUGIN_ATTRIBUTES` event:
.. literalinclude:: ../tests/examples/attributes/script.py
:lines: 39-40
diff --git a/docs/callbacks.rst b/docs/callbacks.rst
index ca1ebf2..b566743 100644
--- a/docs/callbacks.rst
+++ b/docs/callbacks.rst
@@ -76,6 +76,25 @@ ID Meaning
=============================================== =========
+.. py:data:: gcc.PLUGIN_ATTRIBUTES
+
+ Called when GCC is creating attributes for use with its non-standard
+ `__attribute__(()) syntax
+ <http://gcc.gnu.org/onlinedocs/gcc/Function-Attributes.html>`_.
+
+ If you want to create custom GCC attributes, you should register a callback
+ on this event and call :py:func:`gcc.register_attribute()` from within that
+ callback, so that they are created at the same time as the GCC's built-in
+ attributes.
+
+ No arguments are passed to your callback other than those that you supply
+ yourself when registering it:
+
+ (`*extraargs`, `**kwargs`)
+
+ See :doc:`creating custom GCC attributes <attributes>` for examples and
+ more information.
+
.. py:data:: gcc.PLUGIN_PASS_EXECUTION
Called when GCC is about to run one of its passes.
@@ -170,14 +189,6 @@ ID Meaning
.. Notes on the other callback events
- .. py:data:: gcc.PLUGIN_ATTRIBUTES
-
- Called from: init_attributes () at ../../gcc/attribs.c:187
- However, it seems at this point to have initialized these::
-
- static const struct attribute_spec *attribute_tables[4];
- static htab_t attribute_hash;
-
.. py:data:: gcc.PLUGIN_PRAGMAS
gcc_data=0x0