-
-
Notifications
You must be signed in to change notification settings - Fork 201
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
Renderer crash when visiting typedef #534
Comments
I think the fix proposed is fine @IvanoBilenchi , thanks for investigating. Does appear the real problem is something else as is often the case, but this seems like a decent workaround. Should add a comment though marking the bug and what was the original situation so it isn't forgotten about in the future when this could be fixed properly. @jakobandersen Could you also share thoughts if possible? |
Hmm, this is strange. What is the supposed meaning of /**
* My integer type.
*
* @typedef my_uint_t
*/
typedef uint64_t my_uint_t; the XML is <type>uint64_t</type>
<definition>my_uint_t</definition>
<argsstring></argsstring>
<name>my_uint_t</name> but if the C++ is just /**
* My integer type.
*
*/
typedef uint64_t my_uint_t; the XML becomes <type>uint64_t</type>
<definition>typedef uint64_t my_uint_t</definition>
<argsstring></argsstring>
<name>my_uint_t</name> Unfortunately, if <type>uint64_t</type>
<definition>my_uint_t</definition>
<argsstring></argsstring>
<name>my_uint_t</name> and <type>uint64_t</type>
<definition>using my_uint_t = uint64_t</definition>
<argsstring></argsstring>
<name>my_uint_t</name> so the proposed fix unfortunately does not work for type aliases. |
Thanks for the reply! I did some digging in the Doxygen docs: the typedef command seems to require a "typedef declaration" parameter, so likely the whole I guess this is more of a "better error handling needed" situation. Maybe throw an explicit exception if either condition is not met? Something along the lines of Or a reasonable default: given that you cannot infer if the |
Hmm, from the XML it looks like one can completely leave out the |
Would it be acceptable to emit a warning and then render it via the fallback way anyway, using |
Sounds like a good fallback to me. Note that this method may also be called for C declarations, so falling back to typdef as suggested is probably the best option. |
It might be wrong but seems like Doxygen is expecting exactly this in its tests: https://github.com/doxygen/doxygen/blob/master/testing/018_def.c#L31 Also the few uses of "@typedef" in the Doxygen code base, are not documenting the typedef itself but its use, as can be seen here: https://github.com/doxygen/doxygen/blob/master/qtools/qfile.cpp#L535 |
Hmm, from that XML it is not clear to me how to figure out of it's a typedef or a type alias. Perhaps there is a different marker for type aliases?
I think it is documenting the typedef, but just in a different position than where it is declared. The Doxygen docs for |
My codebases are in C, so I won't be seeing much "using", but here are the results with a local test: /**
* Just typedef, no doxygen header
*/
typedef int inta_t;
/**
* @typedef intb_t
*/
typedef int intb_t;
/**
* Just using, no doxygen header
*/
using intc_t = int;
/**
* @typedef intd_t
*/
using intd_t = int; Resulting Doxygen XML: <memberdef kind="typedef">
<type>int</type>
<definition>typedef int inta_t</definition>
<name>inta_t</name>
</memberdef>
<memberdef kind="typedef">
<type>int</type>
<definition>intb_t</definition>
<name>intb_t</name>
</memberdef>
<memberdef kind="typedef">
<type>int</type>
<definition>using intc_t = int</definition>
<name>intc_t</name>
</memberdef>
<memberdef kind="typedef">
<type>int</type>
<definition>intd_t</definition>
<name>intd_t</name>
</memberdef> |
Fix released in v4.19.2 just now, thanks for all the work! |
Breathe 4.18.1 (Sphinx 3.0.3), was previously using Breathe 4.14.1 (Sphinx 2.4.3) which does not have this issue.
This header crashes the renderer:
The exception thrown is:
Having a look at the code,
declaration
is probably uninitialized because Breathe fails to retrieve the definition for the typedef, which is nested in the #ifdef, so none of the two conditions are met:Of course I can get it to work pretty easily by changing the condition to:
Though I'm not sure if that's the right course of action in all cases, so I don't know if this would be fine as a PR. Thoughts?
Thanks!
The text was updated successfully, but these errors were encountered: