Not sure how to continue the email chain on this mailing list, so copying it below.
Thanks David for your response :-). I'm having trouble converting a python callable object to a C function to pass into c_register_pragma() to register the new callback. Should this be implemented like how attribute support was added? That is, have a single callback in the python plugin for whenever a pragma is parsed, and from there do a lookup on an internal table of all registered pragma? This seems like a poor use of c_register_pragma().
Justin
Message: 5Date: Mon, 06 Jul 2015 21:02:10 +0000From: Justin Tai <taijusti@gmail.com>To: gcc-python-plugin@lists.fedorahosted.orgSubject: Add support for PLUGIN_PRAGMASMessage-ID: <CAKYQ15jkkr3G=Dh+hymMQuBdOs+7b0B7z7jv0yvtsxY=aFu8KQ@mail.gmail.com>Content-Type: text/plain; charset="utf-8"Hi everyone,I'm trying to add support for a new pragma to gcc. This requires supportfor the PLUGIN_PRAGMAS event, which I'm currently trying to add support for.1) Any tips?2) I've added support for registering a callback for the PLUGIN_PRAGMASevent. The next step is to add support for the GCC API c_register_pragma()by adding an entry to GccMethods in gcc-python.c and adding and populatinggcc-python-pragmas.c/h. Does this sound about right?Thanks!Justin-------------- next part --------------An HTML attachment was scrubbed...URL: <https://lists.fedorahosted.org/pipermail/gcc-python-plugin/attachments/20150706/782956e0/attachment-0001.html>------------------------------Message: 6Date: Mon, 06 Jul 2015 17:24:53 -0400From: David Malcolm <dmalcolm@redhat.com>To: gcc-python-plugin@lists.fedorahosted.orgSubject: Re: Add support for PLUGIN_PRAGMASMessage-ID: <1436217893.24803.44.camel@surprise>Content-Type: text/plain; charset="UTF-8"On Mon, 2015-07-06 at 21:02 +0000, Justin Tai wrote:> Hi everyone,> I'm trying to add support for a new pragma to gcc. This requires> support for the PLUGIN_PRAGMAS event, which I'm currently trying to> add support for.>>> 1) Any tips?> 2) I've added support for registering a callback for the> PLUGIN_PRAGMAS event. The next step is to add support for the GCC API> c_register_pragma() by adding an entry to GccMethods in gcc-python.c> and adding and populating gcc-python-pragmas.c/h. Does this sound> about right?Yes, this sounds sane.I have a vague feeling I looked at doing this, and that I could see ausable void * user_data place for pragmas for storing the associatedPython callable. But looking atc-family/c-pragma.c:c_register_pragma_with_data I see that the Cfrontend somehow manages to stash a void *, so presumably it's possible.Hope this is helpfulDave