-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.
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
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,
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
@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