This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: gcc version against which a plugin is compiled - documentation?
- From: Basile STARYNKEVITCH <basile at starynkevitch dot net>
- To: Rafael Espindola <espindola at google dot com>
- Cc: gcc-patches <gcc-patches at gcc dot gnu dot org>
- Date: Wed, 11 Nov 2009 19:15:50 +0100
- Subject: Re: gcc version against which a plugin is compiled - documentation?
- References: <4ACF4301.8090108@starynkevitch.net> <38a0d8450910090742i275dbbddlf640e0e4318bfd4f@mail.gmail.com>
Rafael Espindola wrote in http://gcc.gnu.org/ml/gcc-patches/2009-10/msg00595.html
2009/10/9 Basile STARYNKEVITCH <basile@starynkevitch.net>:
Hello All,
Perhaps the plugin documentation, i.e.
http://gcc.gnu.org/onlinedocs/gccint/Plugins.html#Plugins should say in
section 23.2.2 plugin initialization something like
When compiling a plugin, the version of the GCC API for which the plugin
is compiled is available numerically in header file bversion.h thru
BUILDING_GCC_MAJOR BUILDING_GCC_MINOR BUILDING_GCC_VERSION macro and as
string information in header file plugin-version.h
My English is bad, and the details might be wrong or missing, so I am not
proposing a patch to plugins.texi yet.
I think a patch with that could be useful. Note that the info in
plugin-version.h also includes the configure arguments.
A small documenation patch is attached.
### gcc/ChangeLog
2009-11-11 Basile Starynkevitch <basile@starynkevitch.net>
* doc/plugins.texi (Plugin initialization): Added advices for
retrieving the version of GCC at plugin compilation and loading
times.
###
Is that ok?
Regards.
--
Basile STARYNKEVITCH http://starynkevitch.net/Basile/
email: basile<at>starynkevitch<dot>net mobile: +33 6 8501 2359
8, rue de la Faiencerie, 92340 Bourg La Reine, France
*** opinions {are only mines, sont seulement les miennes} ***
Index: gcc/doc/plugins.texi
===================================================================
--- gcc/doc/plugins.texi (revision 154097)
+++ gcc/doc/plugins.texi (working copy)
@@ -105,7 +105,18 @@
such structure and compare them field by field. It can be used by the
plugin's @code{plugin_init} function.
+When compiling a plugin, the version of the GCC API for which the
+plugin is compiled is available numerically in header file
+@file{bversion.h} thru the @code{BUILDING_GCC_MAJOR}
+@code{BUILDING_GCC_MINOR} @code{BUILDING_GCC_VERSION} macro and as
+string information in header file @file{plugin-version.h} (which also
+gives the @code{configure} arguments used when building GCC). It is
+advised to check carefully in the plugin initialization for version
+compatibility of the plugin binary with the GCC compiler loading it.
+
+
+
@subsection Plugin callbacks
Callback functions have the following prototype: