From e4d5031cc88db53fe3aa9759b9c9780c179b21b5 Mon Sep 17 00:00:00 2001 From: Rafael Espindola Date: Thu, 19 Nov 2009 20:22:53 +0000 Subject: [multiple changes] 2009-11-19 Rafael Avila de Espindola * g++.dg/plugin/selfassign.c: Include plugin-version.h. (plugin_init): Pass correct version to plugin_default_version_check. * gcc.dg/plugin/ggcplug.c: Include plugin-version.h. (plugin_init): Pass correct version to plugin_default_version_check. * gcc.dg/plugin/selfassign.c: Include plugin-version.h. (plugin_init): Pass correct version to plugin_default_version_check. 2009-11-19 Basile Starynkevitch Rafael Avila de Espindola * doc/plugins.texi (Plugin initialization): Added advices for retrieving the version of GCC at plugin compilation and loading times. From-SVN: r154342 --- gcc/doc/plugins.texi | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'gcc/doc/plugins.texi') diff --git a/gcc/doc/plugins.texi b/gcc/doc/plugins.texi index 6639a4e..eb1008e 100644 --- a/gcc/doc/plugins.texi +++ b/gcc/doc/plugins.texi @@ -105,6 +105,25 @@ The function @code{plugin_default_version_check} takes two pointers to such structure and compare them field by field. It can be used by the plugin's @code{plugin_init} function. +The version of GCC used to compile the plugin can be found in the symbol +@code{gcc_version} defined in the header @file{plugin-version.h}. The +recommended version check to perform looks like + +@smallexample +#include "plugin-version.h" +... + +int +plugin_init (struct plugin_name_args *plugin_info, + struct plugin_gcc_version *version) +@{ + if (!plugin_default_version_check (version, &gcc_version)) + return 1; + +@} +@end smallexample + +but you can also check the individual fields if you want a less strict check. @subsection Plugin callbacks -- cgit v1.1