Open RomanYakovenko opened 7 years ago
Sorry for the delay, got caught up with other issues.
There is an entry in the FAQ about these: http://pygccxml.readthedocs.io/en/master/faq.html#va-list-tag-and-other-hidden-declarations
When I added support for castxml 1 or 2 years ago, these declarations appeared in the xml tree, because they are exposed by clang/llvm. It broke some tests in pygccxml, and broke pyplusplus. So I decided to filter them out. This is helpful for beginners because if they loop over the declarations, they will not be confused too much.
Of course, you can disable that feature, and pass the "f1"
flag to the config. These declarations will no more be filtered out. I hope that helps.
Of course I would be really pleased to know when you need access to these declarations, because until now for me these declarations are really mysterious. When are you explicitly writing c++ code using __va_list_tag
or one of the others?
py++ is able to create bindings for C code (via ctypes). It just automates the whole process.
As a usage example, it exports whole gmplib to Python (https://bitbucket.org/RomanYakovenko/pyplusplus/src/ccc13d869b4d33b198a15bde9a9efa2086e1edbc/examples/pygmplib/generate_code.py?at=default&fileviewer=file-view-default)
The library uses it in the code: __GMP_DECLSPEC int gmp_obstack_vprintf (struct obstack , const char , va_list);
ctypes does not support such functions. So the code generator needs to find all such functions (... or va_list) and exclude them. But it is unable to do this, since the variable type is "unknown".
Hello.
scanner_t.startElement method contains the following code:
I completely don't understand the comment, it explains what it does, but not why. Second, this code creates incomplete declarations tree. For example, if a function uses "va_list" as the argument, the declarations tree will contain reference to unknown_t class instance. Thus preventing me to find out those functions. In my opinion this code does not belong to the scanner, but the user code. Also, even in case you have a very good reason to filter it, by default pygccxml should provide the view to the tree exactly as it was generated by castxml/gccxml.
The patch is trivial: in my opinion, the code should be deleted.
Regards, Roman