[hellogcc] [patch 4 plugins.texi]: Update gccint-zh trunk to upstreams r179462

  • From: Yao Qi <qiyaoltc@xxxxxxxxx>
  • To: hellogcc@xxxxxxxxxxxxx
  • Date: Fri, 7 Oct 2011 22:04:06 +0800

On Fri, Oct 07, 2011 at 09:47:15PM +0800, Yao Qi wrote:
> 这个patch是fsf gcc doc目录下边和gccint有关文件从 r170935到
> r179462的修改。我们gccint-zh trunk也是根据这个patch进行修改。
> 
> -- 
> Yao Qi <qiyaoltc AT gmail DOT com>
> 
> Index: plugins.texi
> ===================================================================
> --- plugins.texi      (revision 170935)
> +++ plugins.texi      (revision 179462)
> @@ -14,7 +14,7 @@
>  and invoked at pre-determined locations in the compilation
>  process.
>  
> -Plugins are loaded with 
> +Plugins are loaded with
>  
>  @option{-fplugin=/path/to/@var{name}.so} 
> @option{-fplugin-arg-@var{name}-@var{key1}[=@var{value1}]}
>  
> @@ -151,6 +151,7 @@
>  @{
>    PLUGIN_PASS_MANAGER_SETUP,    /* To hook into pass manager.  */
>    PLUGIN_FINISH_TYPE,           /* After finishing parsing a type.  */
> +  PLUGIN_FINISH_DECL,           /* After finishing parsing a declaration. */
>    PLUGIN_FINISH_UNIT,           /* Useful for summary processing.  */
>    PLUGIN_PRE_GENERICIZE,        /* Allows to see low level AST in C and C++ 
> frontends.  */
>    PLUGIN_FINISH,                /* Called before GCC exits.  */
> @@ -264,7 +265,7 @@
>  @end smallexample
>  
>  
> -@section Interacting with the GCC Garbage Collector 
> +@section Interacting with the GCC Garbage Collector
>  
>  Some plugins may want to be informed when GGC (the GCC Garbage
>  Collector) is running. They can register callbacks for the
> @@ -277,7 +278,7 @@
>  for the @code{PLUGIN_GGC_MARKING} event. Such callbacks can call the
>  @code{ggc_set_mark} routine, preferably thru the @code{ggc_mark} macro
>  (and conversely, these routines should usually not be used in plugins
> -outside of the @code{PLUGIN_GGC_MARKING} event).  
> +outside of the @code{PLUGIN_GGC_MARKING} event).
>  
>  Some plugins may need to add extra GGC root tables, e.g. to handle their own
>  @code{GTY}-ed data. This can be done with the 
> @code{PLUGIN_REGISTER_GGC_ROOTS}
> @@ -331,12 +332,12 @@
>  
>  /* Attribute definition */
>  static struct attribute_spec user_attr =
> -  @{ "user", 1, 1, false,  false, false, handle_user_attribute @};
> +  @{ "user", 1, 1, false,  false, false, handle_user_attribute, false @};
>  
>  /* Plugin callback called during attribute registration.
>  Registered with register_callback (plugin_name, PLUGIN_ATTRIBUTES, 
> register_attributes, NULL)
>  */
> -static void 
> +static void
>  register_attributes (void *event_data, void *data)
>  @{
>    warning (0, G_("Callback to register attributes"));
> @@ -356,8 +357,8 @@
>       register_callback (plugin_name, PLUGIN_PRAGMAS,
>                          register_my_pragma, NULL);
>  */
> -static void 
> -register_my_pragma (void *event_data, void *data) 
> +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);
> @@ -365,7 +366,7 @@
>  @end smallexample
>  
>  It is suggested to pass @code{"GCCPLUGIN"} (or a short name identifying
> -your plugin) as the ``space'' argument of your pragma. 
> +your plugin) as the ``space'' argument of your pragma.
>  
>  
>  @section Recording information about pass execution
> @@ -417,6 +418,17 @@
>  Inside plugins, this @code{plugin} directory name can be queried by
>  calling @code{default_plugin_dir_name ()}.
>  
> +Plugins may know, when they are compiled, the GCC version for which
> +@file{plugin-version.h} is provided.  The constant macros
> +@code{GCCPLUGIN_VERSION_MAJOR}, @code{GCCPLUGIN_VERSION_MINOR},
> +@code{GCCPLUGIN_VERSION_PATCHLEVEL}, @code{GCCPLUGIN_VERSION} are
> +integer numbers, so a plugin could ensure it is built for GCC 4.7 with 
> +@smallexample
> +#if GCCPLUGIN_VERSION != 4007
> +#error this GCC plugin is for GCC 4.7
> +#endif
> +@end smallexample
> +
>  The following GNU Makefile excerpt shows how to build a simple plugin:
>  
>  @smallexample
> @@ -435,6 +447,6 @@
>  plugin.so}, using backquote shell syntax to query the @file{plugin}
>  directory.
>  
> -Plugins needing to use @command{gengtype} require a GCC build
> -directory for the same version of GCC that they will be linked
> -against.
> +When a plugin needs to use @command{gengtype}, be sure that both
> +@file{gengtype} and @file{gtype.state} have the same version as the
> +GCC for which the plugin is built.

-- 
Yao Qi <qiyaoltc AT gmail DOT com>

Hell is empty and all the devils are here.
                -- Wm. Shakespeare, "The Tempest"

Index: plugins.texi
===================================================================
--- plugins.texi        (revision 374)
+++ plugins.texi        (working copy)
@@ -179,6 +179,7 @@
 @{
   PLUGIN_PASS_MANAGER_SETUP,    /* To hook into pass manager.  */
   PLUGIN_FINISH_TYPE,           /* After finishing parsing a type.  */
+  PLUGIN_FINISH_DECL,           /* After finishing parsing a declaration. */
   PLUGIN_FINISH_UNIT,           /* Useful for summary processing.  */
   PLUGIN_PRE_GENERICIZE,        /* Allows to see low level AST in C and C++ 
frontends.  */
   PLUGIN_FINISH,                /* Called before GCC exits.  */
@@ -380,7 +381,7 @@
 
 /* Attribute definition */
 static struct attribute_spec user_attr =
-  @{ "user", 1, 1, false,  false, false, handle_user_attribute @};
+  @{ "user", 1, 1, false,  false, false, handle_user_attribute, false @};
 
 /* Plugin callback called during attribute registration.
 Registered with register_callback (plugin_name, PLUGIN_ATTRIBUTES, 
register_attributes, NULL)
@@ -476,6 +477,17 @@
 @en calling @code{default_plugin_dir_name ()}.
 在插件内部,该@code{plugin}目录名可以通过调用@code{default_plugin_dir_name ()}来查询。
 
+Plugins may know, when they are compiled, the GCC version for which
+@file{plugin-version.h} is provided.  The constant macros
+@code{GCCPLUGIN_VERSION_MAJOR}, @code{GCCPLUGIN_VERSION_MINOR},
+@code{GCCPLUGIN_VERSION_PATCHLEVEL}, @code{GCCPLUGIN_VERSION} are
+integer numbers, so a plugin could ensure it is built for GCC 4.7 with 
+@smallexample
+#if GCCPLUGIN_VERSION != 4007
+#error this GCC plugin is for GCC 4.7
+#endif
+@end smallexample
+
 @en The following GNU Makefile excerpt shows how to build a simple plugin:
 下列GNU Makefile摘抄片段展示了如何构建一个简单的插件:
 
@@ -499,4 +511,8 @@
 @en Plugins needing to use @command{gengtype} require a GCC build
 @en directory for the same version of GCC that they will be linked
 @en against.
-需要使用@command{gengtype}的插件需要一个GCC的构建目录,其必须是与将要链接的GCC具有相同的版本。
+@en 需要使用@command{gengtype}的插件需要一个GCC的构建目录,其必须是与将要链接的GCC具有相同的版本。
+When a plugin needs to use @command{gengtype}, be sure that both
+@file{gengtype} and @file{gtype.state} have the same version as the
+GCC for which the plugin is built.
+

Other related posts:

  • » [hellogcc] [patch 4 plugins.texi]: Update gccint-zh trunk to upstreams r179462 - Yao Qi