cdoxygenduplicatesdoxygen-addtogroup

C and doxygen - removing duplicates of variable documentation


I'm documenting my C code with doxygen. For better readability I group documentation of every .c/.h file pair (sometimes also more files) with defgroup and addtogroup (see doxygen in c: grouping of defines). The file pages look fine, but on the group/module pages all variable documentation is doubled. There are 2 entries for every variable that's declared (with extern) in the header file and defined in the .c file (in the summary as well as in the description part). Functions and everything else is listed just once...

How do I get rid of the douplicate variable documentation on group/module pages?

My source files look like this: .h file:

/** @file
*   blabla
*   @author bla
*/
/// @addtogroup MY_GRP
/// @{
#define SOMEDEF1 1
/// @name Special defs
/// @{
#define SOMEDEF2 2
/// @}
enum someenum {
    foo,
    bar
};

extern int some_variables;

extern void some_proc(int baz);

/// @}

.c file:

/** @file
 *  blabla
 *  @author bla
 */
/** @defgroup MY_GRP A test group.
  * Description
  */
/// @{
#include "my.h"

/// Important variable.
int some_variable;

/** Important proc
 *  Description
 *  @param baz need this
 */
void some_proc(int baz) {
// code
}

/// @}

Solution

  • Could not really solve the problem but found me a workarround: I use the INPUT_FILTER option with grep -Eve "extern" (cygwin) to sort out all lines with "extern" functions or variable declarations. Since I only document actual function implementations and variable definitions everything with "extern" in front of it has no documentation anyways and can be removed for doxygen. This indeed also removes all duplicate entries for variables in the doxygen output.