Doxygen要求记录包含保护 [英] Doxygen demands that an include-guard be documented

查看:125
本文介绍了Doxygen要求记录包含保护的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

请不要介意以下最小示例的奇怪之处(我必须将它扩大得更多,以证明为什么我这样做是有道理的):

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?

推荐答案

您可以使用条件文档抑制像这样的Doxygen警告:

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 conds, 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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆