Is it possible for Doxygen to exclude undocumented functions from generated XML?

You can use \cond to hide parts of the source code from Doxygen. This avoids the need to use the preprocessor as in Harry's answer.

For example, here foo will not be seen by Doxygen, and hence not documented:

/** \cond */
void foo(int a);
/** \endcond */

/**
 * "bar" function description
 * @param b sample param
 */
void bar(int b);

Furthermore, it is possible to add section labels to \cond, and control which sections are included by listing them in the ENABLED_SECTIONS configuration option.

For example:

/// \cond CLASS_A
/// This function foos `a`.
void foo(int a);
/// \endcond

/// \cond CLASS_B
/// This function bars `b`.
void bar(int b);
/// \endcond

By setting ENABLED_SECTIONS = CLASS_A CLASS_B, both functions will show up in the documentation. Leaving one of the labels out will hide the corresponding function.


Before reading any further make sure EXTRACT_ALL is set to NO.

I'm not a fan of the following solution but it does work. Use doxygen's preprocessor

#ifdef PROJECT_NO_DOC
void foo(int a); 
#endif /* PROJECT_NO_DOC */

/**
 *  * "bar" function description
 *   * @param b sample param
 *    */
void bar(int b); 

Note, in their docs you have to set a PREDEFINED macro but at least in my version of doxygen this was not required. Their docs specify to do it this way set a predefined macro in the config to do it for you

#ifndef DOXYGEN_SHOULD_SKIP_THIS

 /* code that must be skipped by Doxygen */

#endif /* DOXYGEN_SHOULD_SKIP_THIS */

around the blocks that should be hidden and put:

PREDEFINED = DOXYGEN_SHOULD_SKIP_THIS

in the config file then all blocks should be skipped by doxygen as long as

ENABLE_PREPROCESSING = YES

There are other methods but they come with additional constraints ie to make sure no static method appear in your public docs you can set EXTRACT_STATIC to NO.

Tags:

Doxygen