-
-
Notifications
You must be signed in to change notification settings - Fork 196
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
Duplicate definition with C "typedef struct foo foo" #543
Comments
There may be a minor change needed in Breathe, but otherwise the core problem is in Sphinx. I have opened an issue over there to discuss what the behaviour should be. |
Thanks. You are correct - it appears to be a Sphinx problem. I produced a test-case (attached) that demonstrates this (tested with Sphinx 3.1.0 and Breathe 4.19.0) I'll see if I can revert to older versions and see if anything changes. |
Unfortunately, installing older versions doesn't seem to work. Installing Sphinx 2.4.4 via pip3 seems to end up installing 3.1.0 anyway (or something broken that reports itself as 3.1.0). Likewise with older versions of Breathe. I'm not sure what the cause is, but the result crashes:
|
+ Add c_id_attributes to conf.py for parsing TILEDB_* + Rename typedef tiledb_query_status_details_t to tiledb_experimental_query_status_details_t + breathe-doc/breathe#543
+ Add c_id_attributes to conf.py for parsing TILEDB_* + Rename typedef tiledb_query_status_details_t to tiledb_experimental_query_status_details_t + breathe-doc/breathe#543
* Add C API doc for tiledb_array_upgrade_version * Configuration changes + Add c_id_attributes to conf.py for parsing TILEDB_* + Rename typedef tiledb_query_status_details_t to tiledb_experimental_query_status_details_t + breathe-doc/breathe#543 * Refactor changes + Rename struct tiledb_query_status_details_t to tiledb_experimental_query_status_details_t + typedef tiledb_experimental_query_status_details_t tiledb_query_status_details_t
* Add C API doc for tiledb_array_upgrade_version * Configuration changes + Add c_id_attributes to conf.py for parsing TILEDB_* + Rename typedef tiledb_query_status_details_t to tiledb_experimental_query_status_details_t + breathe-doc/breathe#543 * Refactor changes + Rename struct tiledb_query_status_details_t to tiledb_experimental_query_status_details_t + typedef tiledb_experimental_query_status_details_t tiledb_query_status_details_t
* Add C API doc for tiledb_array_upgrade_version * Configuration changes + Add c_id_attributes to conf.py for parsing TILEDB_* + Rename typedef tiledb_query_status_details_t to tiledb_experimental_query_status_details_t + `breathe-doc/breathe#543 * Refactor changes + Rename struct tiledb_query_status_details_t to tiledb_experimental_query_status_details_t + typedef tiledb_experimental_query_status_details_t tiledb_query_status_details_t
* Add C API doc for tiledb_array_upgrade_version * Configuration changes + Add c_id_attributes to conf.py for parsing TILEDB_* + Rename typedef tiledb_query_status_details_t to tiledb_experimental_query_status_details_t + `breathe-doc/breathe#543 * Refactor changes + Rename struct tiledb_query_status_details_t to tiledb_experimental_query_status_details_t + typedef tiledb_experimental_query_status_details_t tiledb_query_status_details_t
The following concept is perfectly valid C code:
For a C++ project, of course, the typedef is redundant, but for a C project, it is not.
foo_t
andstruct foo_t
are two distinct items.Doxygen renders this correctly, putting the
foo_t
documentation in a "Typedef Documentation" section andstruct foo_t
in a "Data Structures" section. The typedef has a link to the structure.When I use Breathe to embed the header's documentation into a Sphinx file with
it generates a warning, saying that
foo_t
is a duplicate definition:In the Sphinx-generated HTML output, I do see the two items listed in their proper sections.
foo_t
in the "Typedefs" section andstruct foo_t
in the (unlabeled) structures section, but I can only link to the typedef. References to:c:type:`foo_t`
correctly links to thefoo_t
typedef, but references to:c:struct:`foo_t`
links to the same location (it should link to thestruct foo_t
structure).This problem does not happen if the struct and the typedef use different symbols:
but I shouldn't have to make such a change in my code. It is perfectly valid C for the struct name and the typedef name to be the same.
I also understand that this should be a problem in C++, where the typedef is redundant. But I've explicitly configured Breathe to use the C domain, so it should know that this is not C++ code:
Somewhere in Breathe, the code does not distinguish between different C language constructs that share the same name. For example, all of the following are distinct language elements:
typedef ... foo_t
- referenceable via:c:type:`foo_t`
struct foo_t
- referenceable via:c:struct:`foo_t`
union foo_t
- referenceable via:c:union:`foo_t`
enum foo_t
- referenceable via:c:enum:`foo_t`
I'm not sure what the best fix is, but please see if there is something that can be done.
The text was updated successfully, but these errors were encountered: