Taras Glek wrote:

Would you consider restructuring GTY markers to be more like GCC attributes?

It could have some advantages, but if I understand what you mean it would make sense only on platforms where GCC is compiled by itself. I believe that (perhaps unfortunately) the rule is that GCC should be compilable by any ISO-C conformant compiler.

I'm writing code to generate code to convert GCC trees to JavaScript objects for my GCC plugin. Clearly this is similar to what gengtype does. However, I would like to reuse GTY markers without using the gengtype parser. Since I already use the GCC asts, it would be handy if GTYs were just gnu attributes.

I think it was also be beneficial to do GTYs as gcc attributes for consistency instead of having yet another language extension.

So far I've defined GTY as
#define GTY(x) __attribute__((user (#x)))

Which appears to work for most cases except for numerous cases of

typedef struct Name GTY(()) {
};

These would parse fine as attributes if they were more like

typedef struct GTY(()) Name  {
};

Maybe you might patch gengtype to accept such a change, and be able to parse the above? Then you only have to (trivially) patch all the files so that typedef struct Name GTY(()) is changed to
typedef struct GTY(()) Name


Would you be willing to accept such a change?

Another possible benefit of raising GTYs to attribute status would be that other projects could do compile-time reflection similar to what GCC does in a semi-formal way.

This would be interesting (including for my MELT branch)

A more disruptive technique would be to have all the data defined with GTY described (perhaps more precisely) elsewhere. I mean to have all the GGC handled data described -probably in a different syntax- elsewhere, and having all the struct and GGC routines generated otherwise.

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