考虑以下示例。
/// \addtogroup api Foo Group
/// @{
/**
* This class is well-documented.
*/
struct ThreadContext {
/// Storage for the ThreadInvocation object that contains the function and
/// arguments for a new thread.
struct alignas(CACHE_LINE_SIZE) {
/// This data is glorious.
char data[CACHE_LINE_SIZE];
} threadInvocation;
};
/// @}
当我对此运行
doxygen
时,收到以下警告。Doxygen/Main.h:13: warning: Member threadInvocation (variable) of class ThreadContext is not documented.
以
Storage for the ...
开头的注释应该引用threadInvocation
对象,但是doxygen认为它引用的是匿名struct
。我如何告诉doxygen我希望文档引用
threadInvocation
成员? 最佳答案
在深入研究doxygen documentation之后,我发现doxygen实际上允许几乎在任何地方记录大多数代码。为了记录threadInvocation
并避免有关不记录匿名struct
的警告,我必须这样编写代码。
/// \addtogroup api Foo Group
/// @{
/**
* This class is well-documented.
*/
struct ThreadContext {
/// \var threadInvocation
/// Storage for the ThreadInvocation object that contains the function and
/// arguments for a new thread.
/// \cond SuppressDoxygen
struct alignas(CACHE_LINE_SIZE) {
/// This data is glorious.
char data[CACHE_LINE_SIZE];
}
/// \endcond
threadInvocation;
};
/// @}