davidmalcolm / gcc-python-plugin

GCC plugin that embeds CPython inside the compiler
GNU General Public License v3.0
198 stars 58 forks source link

FunctionDecl never finished #105

Open davidmalcolm opened 7 years ago

davidmalcolm commented 7 years ago

Consider this plugin:

{{{ import gcc

def decl_finished(decl, *args, **kwargs): print "DECLARING %s -> %s" % (type(decl), decl.name)

gcc.register_callback(gcc.PLUGIN_FINISH_DECL, decl_finished) }}}

... and this C source file:

{{{ void somefunction(void) { } }}}

Running, I get:

{{{ pokyo. gcc-with-python2 simple-test-plugin.py -c somefunc.c DECLARING <type 'gcc.ParmDecl'> -> None }}}

First, it's weird to see a ParmDecl here - but ok, I can live with this :)

What the bug is really about is that I would expect a FunctionDecl to be finished here, but it is not. The docs say that it will be.

I did this on Fedora 21 using the system gcc and the system python plugin.

davidmalcolm commented 7 years ago

Imported from trac issue 64. Created by tromey on 2015-05-20T11:13:25, last modified: 2015-11-23T11:22:21

davidmalcolm commented 7 years ago

Trac comment by tromey on 2015-11-23 11:22:21:

FWIW still a problem on Fedora 22. I wonder now if this is a gcc bug, I will try to find out.