plugins.texi (Registering custom attributes): section renamed as (Registering custom...
authorBasile Starynkevitch <basile@starynkevitch.net>
Wed, 11 Nov 2009 17:52:46 +0000 (17:52 +0000)
committerBasile Starynkevitch <bstarynk@gcc.gnu.org>
Wed, 11 Nov 2009 17:52:46 +0000 (17:52 +0000)
2009-11-11  Basile Starynkevitch  <basile@starynkevitch.net>
* gcc/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.
* gcc/doc/cpp.texi (Pragmas): Mentions that plugins can provide their
pragmas.
* gcc/doc/extend.texi (Function Attributes): Mentions that plugin can
provide their attributes.

From-SVN: r154097

gcc/ChangeLog
gcc/doc/cpp.texi
gcc/doc/extend.texi
gcc/doc/plugins.texi

index 546ec36..0de0981 100644 (file)
@@ -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.
index 590630c..1a322ba 100644 (file)
@@ -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
index c9c759d..dd5a89c 100644 (file)
@@ -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,
index 123f670..6639a4e 100644 (file)
@@ -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