请不要介意以下最小例子的陌生感(我必须把它做得更大才能证明我为什么这样做):
文件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投诉:
warning: Member GUARD (macro definition) of file a.h is not documented.
首先有趣的是,该警告提到a.h
。第二个是,如果任一注释行被除去,警告消失。这里发生了什么?
您可以使用conditional documentation来suppress Doxygen警告:
//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
请注意,我用#endif
s包装了cond
,否则你会得到if-endif不匹配警告:
/home/user/doxygen/b.h:13: warning: More #endif's than #if's found.