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: 5
Date: Mon, 06 Jul 2015 21:02:10 +0000
From: Justin Tai <taijusti(a)gmail.com
To:
gcc-python-plugin(a)lists.fedorahosted.org
Subject: Add support for PLUGIN_PRAGMAS
Message-ID:
<CAKYQ15jkkr3G=Dh+hymMQuBdOs+7b0B7z7jv0yvtsxY=aFu8KQ(a)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 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?
Thanks!
Justin
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <
https://lists.fedorahosted.org/pipermail/gcc-python-plugin/attachments/20...
------------------------------
Message: 6
Date: Mon, 06 Jul 2015 17:24:53 -0400
From: David Malcolm <dmalcolm(a)redhat.com
To:
gcc-python-plugin(a)lists.fedorahosted.org
Subject: Re: Add support for PLUGIN_PRAGMAS
Message-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 a
usable void * user_data place for pragmas for storing the associated
Python callable. But looking at
c-family/c-pragma.c:c_register_pragma_with_data I see that the C
frontend somehow manages to stash a void *, so presumably it's possible.
Hope this is helpful
Dave