This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
questions about plugin API
- From: Brad Hards <bradh at frogmouth dot net>
- To: gcc at gcc dot gnu dot org
- Date: Sun, 26 Apr 2009 18:40:22 +1000
- Subject: questions about plugin API
G'day,
I noted the merge of (most of) the plugins branch, and managed to build trunk.
I'm interested in using the plugins API to provide checking of features
specific to some library functions (e.g. where functions need to be called in
a certain order - analogous to the malloc() / use() / free() sequence, where
use() before malloc(), or use() after free() , or free() after free() or
free() without malloc() all represent bugs).
I recognise I'm going to need to understand a bit of gcc to implement such a
thing, which may or may not defeat me yet.
Since my function order check will essentially be specific to the library, I
was planning to provide it with the library. However I can't seem to build a
plugin out of tree without depending on having a source and build tree
available (or copying the headers).
I eventually managed to copy enough headers and associated .def files to make
an example build and run out of tree. Its about 50 headers for a do-not-much
plugin.
[I was a bit confused about why there were no examples, and eventually figured
out that the gcc/testsuite part is still pending. I used the dumb_plugin.c
example from branches/plugins/, one API change required]
Is the plan to require plugins to be built in the tree? Or will a subset of
headers be pushed as the "public" plugin API?
As a related note, would it be possible to have the callback functions not
pass a void* gcc_data? Instead, have a separate register_callback_event_foo()
for each event type, and have an appropriate callback function signature for
each event type? Otherwise, the plugin API doesn't tell me what type of
event data I'll get for each callback function.
Brad