-
Notifications
You must be signed in to change notification settings - Fork 30
Open
Description
I have a .h file which I am trying to parse.
#include <stdio.h>
#define MAX_VAL 100
struct {
int x;
char a[MAX_VAL];
} mahesh_t;
after preprocessing it I get the following lines
cpp -E test.h > test.hh
excerpt from the file:
#1 "/usr/lib/gcc/x86_64-redhat-linux/4.4.6/include/stddef.h" 1 3 4
#211 "/usr/lib/gcc/x86_64-redhat-linux/4.4.6/include/stddef.h" 3 4
typedef long unsigned int size_t;
#35 "/usr/include/stdio.h" 2 3 4
when I try to run the script I get this error
$ python c-to-c.py ./test.hh
Traceback (most recent call last):
File "c-to-c.py", line 60, in <module>
translate_to_c(sys.argv[1])
File "c-to-c.py", line 24, in translate_to_c
ast = parse_file(filename, use_cpp=True)
File "/usr/lib/python2.6/site-packages/pycparser/__init__.py", line 93, in parse_file
return parser.parse(text, filename)
File "/usr/lib/python2.6/site-packages/pycparser/c_parser.py", line 138, in parse
debug=debuglevel)
File "/usr/lib/python2.6/site-packages/pycparser/ply/yacc.py", line 265, in parse
return self.parseopt_notrack(input,lexer,debug,tracking,tokenfunc)
File "/usr/lib/python2.6/site-packages/pycparser/ply/yacc.py", line 1047, in parseopt_notrack
tok = self.errorfunc(errtoken)
File "/usr/lib/python2.6/site-packages/pycparser/c_parser.py", line 1613, in p_error
column=self.clex.find_tok_column(p)))
File "/usr/lib/python2.6/site-packages/pycparser/plyparser.py", line 54, in _parse_error
raise ParseError("%s: %s" % (coord, msg))
pycparser.plyparser.ParseError: /usr/include/_G_config.h:53:24: before: __attribute__
Any ideas on how do I fix this?
What wrong am I doing?
thanks
Metadata
Metadata
Assignees
Labels
No labels