Skip to content
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

Trying to document function named "i_calloc()" produces unwanted links #10735

Open
connorkauf opened this issue Mar 13, 2024 · 6 comments
Open
Labels
bug C/C++ needinfo reported bug is incomplete, please add additional info

Comments

@connorkauf
Copy link

When trying to document the following function:

/**
 * @ingroup module_index_allocators
 * @brief The default allocator.
 *
 * Allocates `(nmemb x size)` bytes of storage and initializes it to all bits zero.
 *
 * @param[in] nmemb The number of members to allocate.
 * @param[in] size The size of each member in bytes.
 * @return On success, a pointer to the allocated space. Otherwise a null pointer.
 */
void* i_calloc(std::size_t nmemb, std::size_t size);

Doxygen produces false links that point to this function.
Nearly all function arguments as well as C++ keywords are mapped to this.
Looks like doxygen creates a bunch of these:

<a class="el" href="group__module__index__allocators.html#ga14c058754ff52f9070c24631c36c91cd">const</a>

This happens only for i_calloc() and NOT for i_malloc().
It also does NOT happen for the templated version of i_calloc():

template <typename T>
T* i_calloc(std::size_t nmemb);
@albert-github albert-github added needinfo reported bug is incomplete, please add additional info C/C++ labels Mar 13, 2024
@albert-github
Copy link
Collaborator

Based on the given, incomplete, example it is not possible to tell what the problem might be, so

  • Can you please attach a, small, self contained example (source+configuration file in a, compressed, tar or zip file!) that allows us to reproduce the problem? Please don't add external links as they might not be persistent (also references to GitHub repositories are considered non persistent).
  • Please also specify the full doxygen version used (doxygen -v).

@connorkauf
Copy link
Author

I could not create a smaller example in order to recreate the issue, so here is the (slightly changed) complete project. It is relatively small, I hope this is not an inconvenience.

cla3pdoxy.tar.gz

The function that seems to create the problem is located in file:
include/cla3p/support/imalloc.hpp line 88 and the corresponding documentation is currently deactivated (single star in comment)

You can generate the documentation by cd-ing to documentation/cla3p and running doxygen Doxyfile

There already exist two versions of the documentation, one that is correct (with i_calloc doc deactivated, folder documentation/cla3p/html_correct) and another one that generates false links throughout the documentation to the mentioned function that happens when the i_calloc doc is activated (folder documentation/cla3p/html_false_links).

You can go to "Module Index" > "Allocators" in the documentation to visit the page describing the allocators.

I am using the latest version of Doxygen: 1.10.0 (ebc57c6) on Ubuntu Linux 22.04 (wsl)

Hope this helps, let me know if you need additional info.

@albert-github
Copy link
Collaborator

To make things clear with what you mean with:

Doxygen produces false links that point to this function.

In the "good" output we see (I colored the links red so they are better visible):
image

and in the "false" output we see:
image

So the words void T_ELEM, ptr nmemb are incorrectly linked / colored. Only the i_calloc function is linked / colored correctly.

I did some investigations and it looks like that i_calloc is present in

  • examples/cla3p/src/ex01c_dense_vector_create_from_aux_data.cpp
  • examples/cla3p/src/ex02d_dense_matrix_create_from_aux_data.cpp
  • examples/cla3p/src/ex06d_sparse_matrix_create_from_aux_data.cpp
  • include/cla3p/support/imalloc.hpp

whilst i_malloc is only present in

  • include/cla3p/support/imalloc.hpp

changing the name i_calloc in all the (3) examples solves the issue, but is of course not a solution.

@albert-github
Copy link
Collaborator

albert-github commented Mar 18, 2024

Bisecting gave the following result (9a8b3da ):

9a8b3dad55672e36f59c04bbfcb29621394c5e5a is the first bad commit
commit 9a8b3dad55672e36f59c04bbfcb29621394c5e5a
Date:   Sun Jun 18 20:15:42 2023 +0200

    issue #7580 No autolink for template functions

 src/code.l             |  1 +
 src/pycode.l           |  1 +
 src/symbolresolver.cpp | 32 +++++++++++++++++++++++++-------
 src/symbolresolver.h   |  5 ++++-
 src/util.cpp           |  4 ++--
 src/util.h             |  1 +
 6 files changed, 34 insertions(+), 10 deletions(-)

@connorkauf
Copy link
Author

That is correct. Basically in the "false" case, false links are created for keywords like "void", "static", "default" as well as for argument names. This happens not only in the "Allocators" page, but throughout the entire documentation. I thought it was a matter of naming convention that caused this behavior, hence the "i_calloc" reference, but maybe it is something else as i did some name changing and the problem persisted.

@connorkauf
Copy link
Author

Another thing i noticed (do not know if it is relevant) :
Go to "Quick Start" > "Vectors" > "Dense" > "Create"
In the first example titled "Default creation" the function call "info()" is not always linked to the documentation.
This is a minor issue but maybe it can help identifying the "i_calloc" issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug C/C++ needinfo reported bug is incomplete, please add additional info
Projects
None yet
Development

No branches or pull requests

2 participants