首页 > 解决方案 > Doxygen 不生成任何文档

问题描述

没有为我的 C 存储库的任何函数生成文档

我的配置:

# Difference with default Doxyfile 1.9.1
PROJECT_NAME           = WLib
OUTPUT_DIRECTORY       = doxy
OPTIMIZE_OUTPUT_FOR_C  = YES
EXTRACT_ALL            = YES
CASE_SENSE_NAMES       = NO
HIDE_SCOPE_NAMES       = YES
INPUT                  = .
FILE_PATTERNS          = *.c \
                         *.h
RECURSIVE              = YES

编辑代码:

/** \fn     Array Fill
 *  \param  sa  size of the array A in bytes
 *  \param  a   the array A
 *  \param  sb  size of the array B in bytes
 *  \param  b   the array B
 *  \brief  Takes two arrays and their sizes. Fills the array A with as many
 *          instances of array B as the size of array A can handle.
 *  \return The array A
 *  Method:
 *      -#  If /e a = NULL, then the array of size /e sa will be allocated
 *      -#  If /e b = NULL and /e sb = 0, then array will be filled with zeros
 *      -#  If /e sb = 0, the function does nothing and returns NULL
 *      -#  Declares a variable /e i, this is be the pointer offset
 *      -#  Assignes array /e b to array /e a offsetted by /e i, and incriments
 *          /e i by /e sb. This step is repeated until less than sb bytes are
 *          left untreated
 *      -#  Assignes the remaining part of array /e a with whatever piece of 
 *          array /e b fits
 */
VO* afl(register    const   U16 sa, 
        register            VO* a, 
        register            U8  sb, 
        register    const   VO* b   ) {
...
}

标签: doxygen

解决方案


提供的代码在运行时直接给出答案,并给出警告:

warning: documented symbol 'Array Fill' was not declared or defined.

查看我们在这里看到的代码时:

\fn     Array Fill

但从我们了解到的文档中:

\fn(函数声明)

指示注释块包含函数的文档(全局或作为类的成员)。仅当注释块未放置在函数声明或定义的前面(或后面)时才需要此命令。

如果您的注释块位于函数声明或定义之前,则可以(并且应该避免冗余)省略此命令。

包含参数的完整函数声明应在 \fn 命令后的一行中指定,因为参数在行尾结束!

此外,在文档中的给定示例中:

  const char *member(char,int) throw(std::out_of_range);

/*! \fn const char *Fn_Test::member(char c,int n) 
 *  \brief A member function.
 *  \param c a character.
 *  \param n an integer.
 *  \exception std::out_of_range parameter is out of range.
 *  \return a character pointer.
 */

换句话说,\fn命令的语法在这种情况下应该是:

\fn     VO* afl(register const U16 sa, register VO* a, register U8 sb, register const VO* b)

笔记:

  1. \fn命令通常用于函数文档不直接使用函数字体的情况。在问题的情况下,该\fn命令不是必需的。
  2. 看起来\fn这里是在命令的上下文中使用的,\brief而在\brief命令的上下文中使用的\details命令。

推荐阅读