Alw*_*ing 5 c++ doxygen include-guards
请不要介意以下最小例子的陌生感(我必须把它做得更大才能证明我为什么这样做):
文件test.cpp:
#include "a.h"
int main() {
return 0;
}
Run Code Online (Sandbox Code Playgroud)
档案啊:
namespace N { // without namespace all is well!
#include "b.h"
}
Run Code Online (Sandbox Code Playgroud)
文件bh:
/// \file
#ifndef GUARD
#define GUARD
struct A {};
#define CMD 5 // without this, all is well!
#endif
Run Code Online (Sandbox Code Playgroud)
Doxygen 1.8.11抱怨:
warning: Member GUARD (macro definition) of file a.h is not documented.
Run Code Online (Sandbox Code Playgroud)
第一个有趣的事情是警告提到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
Run Code Online (Sandbox Code Playgroud)
请注意,我用 s 包裹起来#endif,cond否则你会收到 if-endif 不匹配警告:
/home/user/doxygen/b.h:13: warning: More #endif's than #if's found.
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
313 次 |
| 最近记录: |