gengtype: improved version for plugin support.

Basile STARYNKEVITCH basile@starynkevitch.net
Wed Sep 16 22:29:00 GMT 2009


Richard Guenther wrote:
> On Thu, Sep 17, 2009 at 12:13 AM, Basile STARYNKEVITCH
> <basile@starynkevitch.net> wrote:
>>
>> * there is an issue with PCH which is partly solved. PCH outputs a tag (in
>> the *.gch compiled file of a *.h header passed to gcc), value of the
>> generated enum gt_types_enum in gtype-desc.h. we reserve the 0 value (called
>> gt_types_enum_firstempty, so the first generated index e.g.
>> gt_ggc_e_15interface_tuple in the current trunk is now 1, not 0) f that enum
>> to mean don't persist that type. To permit several advanced plugins to
>> extend this tagging machinery, we need to make it more dynamic. so, if
>> GCC_PLUGIN_HAVE_PCH, we generate a dynamic enum like this:
>>
>> #ifdef GCC_PLUGIN_HAVE_PCH
>> static int gccplugin_type_base;
>> #define gt_ggc_e_16basilocalsptr_st
>> ((gccplugin_type_base>0)?(gccplugin_type_base+0):0)
>> #define gt_ggc_e_13melttriple_st
>> ((gccplugin_type_base>0)?(gccplugin_type_base+1):0)
>> #define gt_ggc_e_17VEC_melt_ptr_t_gc
>> ((gccplugin_type_base>0)?(gccplugin_type_base+2):0)
>>
>> I hope you guess the "dynamic enumeration" pattern in the geneerated code...
>>
>> Basically, plugin using GGC won't really work when generating precompiled
>> headers, but my patch added an experimental feature to help future patches
>> for this. (As I tried to explain in several occasions, generating
>> precompiled headers is not currently very compatible with plugins for
>> several reasons).
> 
> I don't think plugins and PCH will work together ever, so that change is not
> needed and only adds additional code.
> 

That generated code is protected by a #ifdef, so the corresponding 
binary code is empty (but I believe that these empty stubs are still 
needed, GCC won't be happy if the pch related routines are not even 
defined).

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



More information about the Gcc-patches mailing list