Open charmoniumQ opened 7 months ago
While va_arg
is in C99, it's a macro so it should be handled by the preprocessor. You can already parse this using the standard provided fake headers (see the README).
In the general case taking types instead of other identifiers can be very tricky in C (which is probably why this is delegated to a macro in the standard).
The provided macro ignores the type of the argument, so this information is not available in the AST.
I don't object, but it may be tricky to add this parsing rule without introducing more parser conflicts. PRs welcome
I was hoping to parse the following code.
I understand that pycparser can parse function-like syntax forms, so long as none of the arguments are type-names. I was wondering what part of the code causes this behavior (it's not obvious to me from reading the
_c_ast.cfg
), and would you accept a pull request that loosens this behavior, i.e.,foo(int)
would be valid (so thatva_arg
can be supported)?Some rationale:
va_arg
is technically in C99, so it's not some random GCC extension, and pycparser already supports parsing the ellipsis, but ellipsis withoutvar_arg
is kind of useless.