Handling two different functions with the same name in Doxygen

I have a C project that contains two functions with the same name, but each of them is within a different group / module ( @defgroup ).

These functions are combined into different binaries, but I need the documentation to be closely cross-referenced, so I need to reference ( @ref ) these functions (among other places) from every other module.

When I make a simple @ref name-of-the-function , it always refers to the one that is in the file that was previously in the file tree. How can I refer to another?

+6
source share
3 answers

As far as I can see: doxygen auto-join does not support having multiple functions with the same name.

If there are several functions / methods with the same name, doxygen will simply associate the first function found, as described in the question. Call schedules will also be incorrect. This applies to all languages, not just C.

This has been reported as an error several times:

The Known Issues section of Doxygen docs also describes a similar issue:

It is not possible to insert a function that is not a member of f into class A using the \ related or \ relatedalso command if class A already has a member with the name f and the same argument list.


There is some hope; someone suggested a patch for better handling of functions with the same name: 656694 - getDefs cannot resolve local function names if the same global name exists .

This patch implements the following two strategies for resolving duplicate names. First, if the name is defined in the current file, use the local name. Secondly, try matching names using the prototype definition.

This will partially solve the problem. Unfortunately, since 2012, the ticket has not seen activity ...

+2
source

Could this work for you?

The example splits into two files ac and bc , with only one function (crash).

file ac

 /** * \defgroup agroup Group A */ /** * the function in a, * see also \link bc myfunc() \endlink the other one * \ingroup agroup */ void myfunc() { ; } 

bc file

 /** * \defgroup bgroup Group B */ /** * the function in b, * see also \link ac myfunc() \endlink the other one * \ingroup bgroup */ void myfunc() { ; } 

as you can see, myfunc() has a name clash. I put a link to another function in the documentation.

I assigned a function name file name .

I compiled it with doxygen and the links worked (they linked to each function documentation with a different function).

+1
source

The solution that works for me in doxygen 1.8.13 is to provide an explicit link with an HTML <a></a> tag. For example, I have a function QF_run() , which is defined in three different files qv.c , qk.c and qxk.c Here are three links to these three definitions:

 <a href="qv_8c.html#a779a1bc9482e2d489dc87751cd100fdb"><b>QF_run()</b></a> <a href="qk_8c.html#a779a1bc9482e2d489dc87751cd100fdb"><b>QF_run()</b></a> <a href="qxk_8c.html#a779a1bc9482e2d489dc87751cd100fdb"><b>QF_run()</b></a> 

These links appear in HTML output just like automatically generated links. Links are also stable unless you change the function name.

To get the hash value for your function, just open your documentation in a browser and copy the link after the # sign.

0
source

Source: https://habr.com/ru/post/981118/


All Articles