eliben / pycparser

:snake: Complete C99 parser in pure Python
Other
3.26k stars 612 forks source link

ParseError with typeof #554

Closed sertonix closed 2 months ago

sertonix commented 2 months ago

pycparser seems to be unable to parse typeof (or __typeof__). For example this code

typedef __typeof__(int *) test;

fails to compile with this error pycparser.plyparser.ParseError: c_files/test.c:2:27: before: test but is valid C code.

Doc: https://gcc.gnu.org/onlinedocs/gcc/Typeof.html

eliben commented 2 months ago

Is it ISO C or a gcc extension?

sertonix commented 2 months ago

The gcc doc states that __typeof__ is OSI C. I can't find the OSI C spec to verify it.

eliben commented 2 months ago

For gnu extension support, consider https://github.com/inducer/pycparserext