Hello All,

This is motivated by MELT, but I believe it would be useful to every GCC plugin which tries to be
compilable both for GCC 5 & GCC 6.

The technical issue described in https://gcc.gnu.org/ml/gcc/2016-02/msg00149.html is that the gimple identifier in plugins has changed from pointer (in GCC 5 and earlier) to class.

I feel that is a very major change w.r.t. plugins. Most (and probably all) GCC plugins will be affected.
(A cosmetic patch might be to name gimpleinstance what is today gimple)

A tempting way might be

#if GCCPLUGIN_VERSION >= 6000
typedef gimple* melt_gimpleptr_t;
#else
typedef gimple melt_gimpleptr_t;
#endif /* GCC 6 */

unfortunately, that does not work today, because gengtype does not get preprocessed input (and does not invoke the preprocessor).

Perhaps we should consider patching gengtype to enable conditional GTY-s at least for typedefs.

I am tempted to try implementing a conditional GTY, perhaps

   typedef GTY((when(WANTPOINTER)) gimple* melt_gimpleptr_t;

and

   typedef GTY((unless(WANTPOINTER)) gimple melt_gimpleptr_t;

then, add a condition argument to gengtype processor, perhaps invoking it as

    gengtype -CWANTPOINTER ....

or

   gengtype --condition WANTPOINTER

but this makes sense only if such a gengtype patch would go both into GCC 6 and into the next microrelease of GCC 5, i.e. GCC 5.4

I'm afraid that the current stage rules forbid that. Or, could such a patch be considered as a bug fix?

Opinions are welcome!

Regards.

PS. The very dirty alternative would be to feed gengtype with different variants of inputs. That is ugly.



--
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 mine, sont seulement les miennes} ***

Reply via email to