-
Notifications
You must be signed in to change notification settings - Fork 39
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
Unions nested inside structures are not parsed #37
Comments
Definitely a bug. I don't really have an interest in fixing this myself (lots of stuff going on), but I can provide guidance for debugging/fixing this if you would like to fix it. |
I had a lookat the parsing method, it appears that the method def _evaluate_class_stack(self):
parent = self.curClass
if parent:
debug_print("found nested subclass")
self.accessSpecifierStack.append(self.curAccessSpecifier)
if self.nameStack[0] == "typedef":
del self.nameStack[0]
if len(self.nameStack) == 1:
if self.nameStack[0] == "struct":
self.anon_struct_counter += 1
# We cant handle more than 1 anonymous struct, so name them uniquely
self.nameStack.append("anon-struct-%d" % self.anon_struct_counter)
elif self.nameStack[0] == "union":
self.anon_union_counter += 1
# We cant handle more than 1 anonymous union, so name them uniquely
self.nameStack.append("anon-union-%d" % self.anon_union_counter) However, when I try with only a |
I find that setting the environment variable |
I used this to investigate a little bit, this is my debug log :
for a nested structure in the same file
from my comprehension, the parser gets to the line 2371, where it decides what to do with the variable.
So my second issue here is that i can not parse an array of nested classes. |
So I made a pull request with a few changes that should not break anything. This bug is made of 2 problems :
the second issue should be adressed in the PR but the first one needs deeper changes |
Hello everyone!
Thank you for maintaining this library, and fixing various bugs with the original library.
I am trying to parse headers with a anonymous union defined inside a struct :
However, this union is not parsed as such, and i have no way of isolating the data allocated inside the union from the rest of the structure.
Output, printed as another C header gives :
As you can see the resulting memory allocated is not correct.
The output in json is :
Thanks in advance for any help
The text was updated successfully, but these errors were encountered: