diff options
author | bstarynk <bstarynk@138bc75d-0d04-0410-961f-82ee72b054a4> | 2011-07-06 16:37:09 +0000 |
---|---|---|
committer | bstarynk <bstarynk@138bc75d-0d04-0410-961f-82ee72b054a4> | 2011-07-06 16:37:09 +0000 |
commit | 7fed55f3ab35664e0865dbf9f0c724b893e4c4d0 (patch) | |
tree | 38ed9939c26dba6d87fde9593de9440bc6b331cc | |
parent | 6529f6e38087813e2131ee61c77438a502c17c8d (diff) | |
download | gcc-7fed55f3ab35664e0865dbf9f0c724b893e4c4d0.tar.gz |
2011-07-06 Basile Starynkevitch <basile@starynkevitch.net>
* 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.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@175923 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r-- | gcc/ChangeLog | 12 | ||||
-rwxr-xr-x | gcc/configure | 9 | ||||
-rw-r--r-- | gcc/configure.ac | 5 | ||||
-rw-r--r-- | gcc/doc/plugins.texi | 11 |
4 files changed, 35 insertions, 2 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 3156a9be19d..38a8bcd4936 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,15 @@ +2011-07-06 Basile Starynkevitch <basile@starynkevitch.net> + + * 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. + 2011-07-06 Bernd Schmidt <bernds@codesourcery.com> * machmode.h (TRULY_NOOP_TRUNCATION_MODES_P): New macro. diff --git a/gcc/configure b/gcc/configure index 10c24cc94c9..68830c57dfb 100755 --- a/gcc/configure +++ b/gcc/configure @@ -11072,6 +11072,11 @@ fi cat > plugin-version.h <<EOF #include "configargs.h" +#define GCCPLUGIN_VERSION_MAJOR `echo $gcc_BASEVER | sed -e 's/^\([0-9]*\).*$/\1/'` +#define GCCPLUGIN_VERSION_MINOR `echo $gcc_BASEVER | sed -e 's/^[0-9]*\.\([0-9]*\).*$/\1/'` +#define GCCPLUGIN_VERSION_PATCHLEVEL `echo $gcc_BASEVER | sed -e 's/^[0-9]*\.[0-9]*\.\([0-9]*\)$/\1/'` +#define GCCPLUGIN_VERSION (GCCPLUGIN_VERSION_MAJOR*1000 + GCCPLUGIN_VERSION_MINOR) + static char basever[] = "$gcc_BASEVER"; static char datestamp[] = "$gcc_DATESTAMP"; static char devphase[] = "$gcc_DEVPHASE"; @@ -17623,7 +17628,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 17626 "configure" +#line 17631 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -17729,7 +17734,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 17732 "configure" +#line 17737 "configure" #include "confdefs.h" #if HAVE_DLFCN_H diff --git a/gcc/configure.ac b/gcc/configure.ac index 5f3641b3198..02c6089e9e6 100644 --- a/gcc/configure.ac +++ b/gcc/configure.ac @@ -1511,6 +1511,11 @@ fi cat > plugin-version.h <<EOF #include "configargs.h" +#define GCCPLUGIN_VERSION_MAJOR `echo $gcc_BASEVER | sed -e 's/^\([0-9]*\).*$/\1/'` +#define GCCPLUGIN_VERSION_MINOR `echo $gcc_BASEVER | sed -e 's/^[0-9]*\.\([0-9]*\).*$/\1/'` +#define GCCPLUGIN_VERSION_PATCHLEVEL `echo $gcc_BASEVER | sed -e 's/^[0-9]*\.[0-9]*\.\([0-9]*\)$/\1/'` +#define GCCPLUGIN_VERSION (GCCPLUGIN_VERSION_MAJOR*1000 + GCCPLUGIN_VERSION_MINOR) + static char basever[] = "$gcc_BASEVER"; static char datestamp[] = "$gcc_DATESTAMP"; static char devphase[] = "$gcc_DEVPHASE"; 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 |