Question

I use pycparser to parse c code and for my test files it works fine. I had some problems with the cpp and the header files so I use a external cpp and give the pycparser the output of the preprocessor. With my test files it all works but with files from a real software projects I get an error.

ast = parse_file("layer2.c.o", use_cpp=False)

Error message:

  File "/usr/local/lib/python2.7/dist-packages/pycparser/c_parser.py", line 1613, in p_error
column=self.clex.find_tok_column(p)))
  File "/usr/local/lib/python2.7/dist-packages/pycparser/plyparser.py", line 54, in _parse_error
    raise ParseError("%s: %s" % (coord, msg)) raise ParseError("%s: %s" % (coord, msg))

pycparser.plyparser.ParseError: /usr/include/stdint.h:58:1: before: __extension__

Does anybody knows this problem?

No correct solution

OTHER TIPS

See the FAQ about __extension__. In general, I see you're trying to parse included standard headers. Your life will be considerably easier if you use the "fake" C headers that come with pycparser instead. Details here.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top