氧要求包含保护文件
Doxygen demands that an include-guard be documented
请不要介意下面这个最小的例子的奇怪之处(我必须把它做得更大来证明为什么我这样做):
文件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
氧1.8.11抱怨:
warning: Member GUARD (macro definition) of file a.h is not documented.
第一个有趣的事情是警告提到了a.h
。第二个问题是,如果任何注释行被删除,警告就会消失。这是怎么回事?
您可以使用条件文档来抑制氧气警告,如:
//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
s包装了#endif
,否则你会得到if-end不匹配警告:
/home/user/doxygen/b.h:13: warning: More #endif's than #if's found.
相关文章:
- 有充分的理由在h文件中使用include保护而不是cpp文件吗
- 为什么您需要C++头文件的包含保护
- C2011: 'Card':"类"类型重新定义(尽管使用了包含保护并且没有在文件中重新定义.cpp类)
- 无法在 Cocos2dx 中使用受密码保护的 zip 文件
- 在带有类型保护的模板文件中使用前向声明
- 标头保护文件中结构的重复符号
- 使用 #pragma 一次,#ifndef 在同一文件中包含保护
- 是否可以解密受 cenc 保护的 MPEG-DASH 文件?
- 保护外部数据文件免受未经授权的修改
- 可以将标头文件包含在多个源文件中,而无需重复保护
- 如果目标文件已经具有标头保护,我们是否应该用 #ifndef 来保护 #include
- 为什么在2.CPP文件中包含此头文件(带头保护)会导致命名冲突
- 读取文件并将其存储在C 中的保护变量中
- C++:通过简单的添加示例了解头文件和头保护
- Microsoft如何保护SQL Server二进制文件免受反向工程的影响
- 保护输入和输出文件描述符时出错
- 检测受密码保护的 MS Office 文件在 C/C++
- 使用创建文件功能创建文件会导致写保护文件
- 在 Linux 中打开文件。我不想创建写保护文件
- 氧要求包含保护文件