inducer / pycparserext

Extensions for Eli Bendersky's pycparser
http://pypi.python.org/pypi/pycparserext
Other
83 stars 28 forks source link

Bugfix for generic_visit #4

Closed dgoldstein0 closed 11 years ago

dgoldstein0 commented 11 years ago

Basically, I was using pycparserext, trying to call the visit function to generate code. I wrote a small C program to experiment with, and found that it broke our code generation (we are basically parsing the code, making small changes to the ast, and regenerating the code from the ast). The program that caused the trouble is https://github.com/dgoldstein0/pycmutate/blob/master/testcode/unary_ops.c.

one-line change to fix the bug :). Thought you might want to apply the fix to the main branch of the codebase.

dgoldstein0 commented 11 years ago

Just want to update this: I found another bug in the code (dealing with array initializers) which basically led me to realize that c_generator.py is out of sync with pycparser's corresponding file. I copied the pycparser version of c_generator.py over pycparserext's, and (after fixing the import of c_ast) it seems to fix both bugs I encountered. So just update to the latest pycparser code and I think these bugs should go away.

inducer commented 11 years ago

Now that pycparser actually exports c_generator, there isn't really a reason to keep a copy around. 8c6ae6be0 deprecates pycparser.c_generator and replaces it with an import of the upstream module. I'll roll this into a release soon.

Thanks for the report! Andreas