Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Handling two different functions with the same name in Doxygen

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

These functions each compile into a different binary, but I need the documentation to be closely cross-referenced, so I need to refer (@ref) to these functions (among other places) from each other's module.

When I do simple @ref name-of-the-function, it always links to the one which resides in file which is earlier in the file tree. How can I link to the other one?

like image 832
Matěj Zábský Avatar asked Mar 03 '12 18:03

Matěj Zábský


1 Answers

As far as I can see: doxygen's autolinking does not support having multiple functions with the same name.

If there are multiple functions/methods with the same name, doxygen will simply link the first one it finds, as described in the question. The call graphs will also be incorrect. This seems to apply to all languages, not just to C.

This has been reported as a bug multiple times:

  • #3676 bad links in source code browser for multiple functions of same name
  • #5448 Different Static Functions With Same Name Confusion
  • #979 Mismatched documentation for functions having same name
  • #3724 \relates confused on multiple static functions with the same name

The section "Known problems" in doxygen's docs also describes a similar problem:

It is not possible to insert a non-member function f in a class A using the \relates or \relatesalso command, if class A already has a member with name f and the same argument list.


There is some hope; someone proposed a patch to better handle functions with the same name: #4365 getDefs fails to resolve local function names if same global name exist.

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

This would partly solve the problem. Unfortunately, the ticket has seen no activity since 2012...

like image 58
sleske Avatar answered Oct 04 '22 19:10

sleske