On Wed, Jul 6, 2011 at 3:46 PM, Basile Starynkevitch
<bas...@starynkevitch.net> wrote:
> On Wed, Jul 06, 2011 at 03:21:47PM +0200, Richard Guenther wrote:
>> On Wed, Jul 6, 2011 at 2:50 PM, Basile Starynkevitch
>> <bas...@starynkevitch.net> wrote:
>> >
>> > I belive it can help to make plugin code more robust. A serious plugin 
>> > developper could then add in his plugin code something like
>> >
>> > #if GCCPLUGIN_VERSION != 4007
>> > #error this plugin can be built only for GCC 4.7
>> > #endif
>> >
>> > and with such a feature the plugin won't even compile if, for one reason or
>> > another, the wrong gcc has been considered i.e. passed with
>> >   -I$(gcc -print-file-name=plugin)
>> >
>> > This brings some help to the careful plugin coder, and don't harm GCC 
>> > itself.
>> >
>> > For GCC trunk or branches we have the BUILDING_GCC_VERSION macro, but it
>> > does not appear in the headers insdtalled by gcc-4.6-plugin-dev package.
>> > Plugins can currently only check for version compatibility at plugin dlopen
>> > time, not at plugin build time!
>>
>> I'd say exposng major, minor and patchlevel (instead of micro)
>> should be enough.
>
>
> Thanks for the comment. I am attaching a diff to GCC trunk 175912, and I
> documented the feature.
>
> #### gcc/ChangeLog entry #####
> 2011-07-06  Basile Starynkevitch  <bas...@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.
> ### end of gcc/ChangeLog entry ####
>
> Ok for trunk?

I'm not sure using cut is portable enough - for bversion.h generation
we use sed instead (see Makefile.in), so I suppose copying that
would be better.

I can't approve the configury changes but the change itself looks
reasonable to me

Thanks,
Richard.

> 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} ***
>

Reply via email to