-
Notifications
You must be signed in to change notification settings - Fork 607
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
parser error with typedef #523
Comments
I expanded the output for the debugging results. It look like for some reason it is marking the
|
Please add a minimal, reproducible example A small |
It's right there. I just gave you an example.
|
This example still has comments that need to be removed manually. I asked for code that can be fed to pycparser directly without the preprocessor (which often obscures issue reports). In any case, the code is invalid standard C, I believe, because the compiler does not know what Trying your fragment with
The right way to write this typedef would be:
|
OK so I have done what you stated and this is what happens.
see the issue there.
Those values should be apart of the |
the type for |
Oh and I am not sure why I am able to run the code through the preprocessor and it doesn't error at all. It also works with DOXYGEN without any issues. The original example I am referring to. |
Yes, that's how it works. pycparser just produces an AST for you, it doesn't do any semantic or type analysis. Note also that just:
... is perfectly valid C. The The AST you have from pycparser has all the information you need -- you can see the type the |
There is no link between the 2 enumerations made?.. what you are telling me is I have to iterate over the entire ast again in order to locate the type used in the typedef? That's crazy to have to do that. There should be some kind of a link between a typedef and it's parent type if there is one available. |
so if I use this code
is
but it's not if I do this?... They are both the same thing. They do the same thing... |
The following code is being use to keep memory use in check when returning an enumeration from a function. The 3 byte savings is needed. The issue is when generating documentation unless I change the type to the actual enumeration the path back to the enumeration will not be completed. The following code fixes that issue when documentation is generated for the C code.
There is a binding that is made for Python that uses pycparser to read the C code. The binding makes things more pythonic and in a class arrangement. I would like to be able to pull the documentation from the c library and align it correctly with the python code. This shouldn't be an issue except when I set the macro for DOXYGEN and run it through pycparser it errors out on
typedef _lv_res_t lv_res_t;
. It doesn't error if I do not have the DOXYGEN macro set. I need it set in order to make the correct link in the documentation in order to have the enum values correctly tied to a functions return value in the documentation.Here is the debugging output from pycparser
The text was updated successfully, but these errors were encountered: