繁体   English   中英

Doxygen要求记录包含保护

[英]Doxygen demands that an include-guard be documented

请不要介意以下最小示例的奇怪之处(我必须将其扩大得更多,以证明我为什么以此方式行事):

文件test.cpp:

#include "a.h"

int main() {
  return 0;
}

文件啊:

namespace N { // without namespace all is well!
#include "b.h"
}

文件bh:

/// \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.

第一件有趣的事是警告中提到了ah 第二个问题是,如果删除任一注释行,则警告消失。 这里发生了什么?

您可以使用条件文档禁止 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

请注意,我用cond包裹#endif ,因为否则会收到if-endif不匹配警告:

/home/user/doxygen/b.h:13: warning: More #endif's than #if's found.

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM