aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog11
-rw-r--r--gcc/doc/cpp.texi2
-rw-r--r--gcc/doc/extend.texi2
-rw-r--r--gcc/doc/plugins.texi27
4 files changed, 39 insertions, 3 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 546ec36..0de0981 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,4 +1,13 @@
-gcc/
+2009-11-11 Basile Starynkevitch <basile@starynkevitch.net>
+ * doc/plugins.texi (Registering custom attributes): section
+ renamed as (Registering custom attributes or pragmas).
+ Mentions custom attributes & pragmas, and c_register_pragma, with
+ a small example.
+ * doc/cpp.texi (Pragmas): Mentions that plugins can provide their
+ pragmas.
+ * doc/extend.texi (Function Attributes): Mentions that plugin can
+ provide their attributes.
+
2009-11-11 Jon Beniston <jon@beniston.com>
* config.gcc: Add lm32 elf and uclinux targets.
diff --git a/gcc/doc/cpp.texi b/gcc/doc/cpp.texi
index 590630c..1a322ba 100644
--- a/gcc/doc/cpp.texi
+++ b/gcc/doc/cpp.texi
@@ -3541,6 +3541,8 @@ This manual documents the pragmas which are meaningful to the
preprocessor itself. Other pragmas are meaningful to the C or C++
compilers. They are documented in the GCC manual.
+GCC plugins may provide their own pragmas.
+
@ftable @code
@item #pragma GCC dependency
@code{#pragma GCC dependency} allows you to check the relative dates of
diff --git a/gcc/doc/extend.texi b/gcc/doc/extend.texi
index c9c759d..dd5a89c 100644
--- a/gcc/doc/extend.texi
+++ b/gcc/doc/extend.texi
@@ -1922,6 +1922,8 @@ particular target systems. Other attributes, including @code{section}
are supported for variables declarations (@pxref{Variable Attributes})
and for types (@pxref{Type Attributes}).
+GCC plugins may provide their own attributes.
+
You may also specify attributes with @samp{__} preceding and following
each keyword. This allows you to use them in header files without
being concerned about a possible macro of the same name. For example,
diff --git a/gcc/doc/plugins.texi b/gcc/doc/plugins.texi
index 123f670..6639a4e 100644
--- a/gcc/doc/plugins.texi
+++ b/gcc/doc/plugins.texi
@@ -261,9 +261,10 @@ Such a structure is passed as the @code{user_data} by the plugin's
init routine using @code{register_callback} with the
@code{PLUGIN_INFO} pseudo-event and a null callback.
-@section Registering custom attributes
+@section Registering custom attributes or pragmas
-For analysis purposes it is useful to be able to add custom attributes.
+For analysis (or other) purposes it is useful to be able to add custom
+attributes or pragmas.
The @code{PLUGIN_ATTRIBUTES} callback is called during attribute
registration. Use the @code{register_attribute} function to register
@@ -295,6 +296,28 @@ register_attributes (void *event_data, void *data)
@end smallexample
+The @code{PLUGIN_PRAGMAS} callback is called during pragmas
+registration. Use the @code{c_register_pragma} or
+@code{c_register_pragma_with_expansion} functions to register custom
+pragmas.
+
+@smallexample
+/* Plugin callback called during pragmas registration. Registered with
+ register_callback (plugin_name, PLUGIN_PRAGMAS,
+ register_my_pragma, NULL);
+*/
+static void
+register_my_pragma (void *event_data, void *data)
+@{
+ warning (0, G_("Callback to register pragmas"));
+ c_register_pragma ("GCCPLUGIN", "sayhello", handle_pragma_sayhello);
+@}
+@end smallexample
+
+It is suggested to pass @code{"GCCPLUGIN"} (or a short name identifying
+your plugin) as the ``space'' argument of your pragma.
+
+
@section Building GCC plugins
If plugins are enabled, GCC installs the headers needed to build a