Doxygen要求记录包含保护 [英] Doxygen demands that an include-guard be documented
问题描述
请不要介意以下最小示例的奇怪之处(我必须将它扩大得更多,以证明为什么我这样做是有道理的):
Please do not mind the strangeness of the following minimal example (I would have to make it much larger to justify why I am doing things this way):
文件test.cpp:
File test.cpp:
#include "a.h"
int main() {
return 0;
}
文件a.h:
namespace N { // without namespace all is well!
#include "b.h"
}
文件b.h:
/// \file
#ifndef GUARD
#define GUARD
struct A {};
#define CMD 5 // without this, all is well!
#endif
Doxygen 1.8.11抱怨:
Doxygen 1.8.11 complains:
warning: Member GUARD (macro definition) of file a.h is not documented.
第一个有趣的事情是警告中提到了a.h
.第二个问题是,如果删除任一注释行,则警告消失.这是怎么回事?
The first interesting thing is that the warning mentions a.h
. The second one is that if either of the commented lines is removed, the warning disappears. What is going on here?
推荐答案
You may use conditional documentation to suppress Doxygen warnings like this:
//b.h
/// \file
//! @cond SuppressGuard
#ifndef GUARD
#define GUARD
//! @endcond
struct A {};
//! @cond SuppressCmd
#define CMD 5 // without this, all is well!
//! @endcond
//! @cond SuppressGuard
#endif
//! @endcond
请注意,我用cond
包裹了#endif
,因为否则会收到if-endif不匹配警告:
Note that I wrapped #endif
with cond
s, because otherwise you'll get if-endif mismatch warning:
/home/user/doxygen/b.h:13: warning: More #endif's than #if's found.
这篇关于Doxygen要求记录包含保护的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!