From bf5884559be4e9bfd8216516d540414dfede1d26 Mon Sep 17 00:00:00 2001 From: Basile Starynkevitch Date: Wed, 6 Jul 2011 16:37:09 +0000 Subject: configure.ac (plugin-version.h): Generate GCCPLUGIN_VERSION_MAJOR... 2011-07-06 Basile Starynkevitch * configure.ac (plugin-version.h): Generate GCCPLUGIN_VERSION_MAJOR, GCCPLUGIN_VERSION_MINOR, GCCPLUGIN_VERSION_PATCHLEVEL, GCCPLUGIN_VERSION constant integer macros. * configure: Regenerate. * doc/plugins.texi (Building GCC plugins): Mention GCCPLUGIN_VERSION ... constant macros in plugin-version.h. From-SVN: r175923 --- gcc/doc/plugins.texi | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'gcc/doc/plugins.texi') diff --git a/gcc/doc/plugins.texi b/gcc/doc/plugins.texi index 2ab2b62021d..1ff14474ccc 100644 --- a/gcc/doc/plugins.texi +++ b/gcc/doc/plugins.texi @@ -417,6 +417,17 @@ invoking @command{gcc -print-file-name=plugin} (replace if needed 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 -- cgit v1.2.1