【问题标题】:Doxygen C preprocessor macros documentation styleDoxygen C 预处理器宏文档样式
【发布时间】:2023-03-10 11:05:01
【问题描述】:

我刚刚注意到 Doxygen 为 C 预处理器宏生成文档的方式很有趣。在Doxygen's manual/////!/** */)中创建块cmets的三种样式中,只有前两种样式(/////!)会在文件的宏列表中显示简要说明。

我的问题是:这是设计使然吗?我有控制这个的配置选项吗?我找不到任何信息表明 Javadoc 样式的行为应不同于 Qt 和 C++ 样式。

我尝试使用 MULTILINE_CPP_IS_BRIEF 配置选项,但没有任何效果。

test.c

/**
 * @file test.c
 * @brief A test
 */

#include <stdio.h>

/** This is a define that doesn't have a brief explanation on the macro list */
#define DEFINE_A   1 
/// This is another define, it's brief explanation appears on the file's macro list
#define DEFINE_B   2
//! This is another define, it's brief explanation appears on the file's macro list
#define DEFINE_C   3 

#define DEFINE_D   4 /**<  This is a define that doesn't have a brief explanation on the file's macro list */
#define DEFINE_F   4 ///< This is another define, it's brief explanation appears on the file's macro list
#define DEFINE_G   4 //!< This is another define, it's brief explanation appears on the file's macro list

/**
 * A simple test function
 *
 * @param[in] x An integer argument
 * @return always zero
 */
int test_fcn( int x )
{
    return x*x;
}

int main(void)
{
    return test_fcn( 3 );
}

测试.h

/** @file */

/**My Preprocessor Macro.*/ 
#define TEST_DEFINE(x) (x*x) 

/**
 * @defgroup TEST_GROUP Test Group
 *
 * @{
 */

/** Test AAA documentation. */
#define TEST_AAA (1)
/** Test BBB documentation. */
#define TEST_BBB (2)
/** Test CCC documentation. */
#define TEST_CCC (3)
/** @} */

Doxyfile

PROJECT_NAME           = "test"
OUTPUT_DIRECTORY       = doc_out
INPUT                  = test.c test.h
#MULTILINE_CPP_IS_BRIEF = NO
MULTILINE_CPP_IS_BRIEF = YES

我在 Windows 7 64 位上使用 Doxygen 1.8.15。

谢谢!

【问题讨论】:

    标签: macros c-preprocessor doxygen


    【解决方案1】:

    问得太快了。我正在寻找的选项是JAVADOC_AUTOBRIEF=YES

    不过,有一件奇怪的事情。这些应该是

    的默认值
    JAVADOC_AUTOBRIEF      = NO
    QT_AUTOBRIEF           = NO
    MULTILINE_CPP_IS_BRIEF = NO
    

    实际默认行为是

    JAVADOC_AUTOBRIEF      = NO
    QT_AUTOBRIEF           = YES
    MULTILINE_CPP_IS_BRIEF = YES
    

    如果我对我的 Doxygen 文件使用以下选项:

    JAVADOC_AUTOBRIEF      = NO
    QT_AUTOBRIEF           = NO
    MULTILINE_CPP_IS_BRIEF = NO
    

    我从 Javadoc、Qt 和 C++ 样式中得到不同的行为,我觉得这是错误的。

    谢谢!

    附:

    Doxygen -x 针对以下 Doxyfile:

    PROJECT_NAME           = "test"
    OUTPUT_DIRECTORY       = doc_out
    INPUT                  = test.c test.h
    JAVADOC_AUTOBRIEF      = YES
    QT_AUTOBRIEF           = NO
    MULTILINE_CPP_IS_BRIEF = NO
    

    给予:

    # doxygen.exe -x Doxyfile
    # Difference with default Doxyfile 1.8.15
    PROJECT_NAME           = test
    OUTPUT_DIRECTORY       = doc_out
    JAVADOC_AUTOBRIEF      = YES
    INPUT                  = test.c \
                             test.h
    

    似乎QT_AUTOBRIEF 没有做任何事情(即使QT_AUTOBRIEF=NO,我也会得到DEFINE_CDEFINE_G 的简短描述)。

    谢谢!

    【讨论】:

    • 你能不能用&lt;your_doxyfile&gt; 你的 Doxyfile 做一个doxygen -x &lt;your_doxyfile&gt;,它会给出错误的结果并将结果也放在你的答案中?
    猜你喜欢
    • 2019-10-07
    • 1970-01-01
    • 2020-02-09
    • 2015-08-28
    • 2018-06-18
    • 2011-01-26
    • 1970-01-01
    • 2023-03-13
    • 2012-11-16
    相关资源
    最近更新 更多