[plugins] checking the compiler version

Ian Lance Taylor iant@google.com
Wed Apr 8 15:37:00 GMT 2009


Rafael Espindola <espindola@google.com> writes:

> The question is what to pass. BASEVER is a natural candidate, but I
> would expect most plugins to depend on more fine grained things. Any
> change to one of the structures used in tree will probably break most.

True, but the important thing for plugins to check is consistency with a
released version of gcc.  I don't think we get much benefit from adding
mechanism for structure checksums for unreleased versions.

Having the plugin provide a function which checks the supported version
is going to force the same code to be written in a bunch of plugins.  I
think we should provide an automatic version.  For example, perhaps
gcc-plugin.h could pick up the gcc version, and do something like

#ifndef PLUGIN_PROVIDES_VERSION_CHECK
bool
plugin_check_version(const char* version)
{
  return strcmp(version, PLUGIN_VERSION) == 0;
}
#endif

and then somehow arrange for that to be the callback for the version
check.

Ian



More information about the Gcc-patches mailing list