【问题标题】:Doxygen demands that an include-guard be documentedDoxygen 要求记录包含保护
【发布时间】:2017-03-14 11:29:33
【问题描述】:

请不要介意以下最小示例的奇怪之处(我必须将其放大很多才能证明我这样做的原因):

文件 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。第二个是如果删除了任何注释行,警告就会消失。这是怎么回事?

【问题讨论】:

  • a.h 没有包括警卫?
  • @old_mountain 仅用于示例的最小化。

标签: c++ doxygen include-guards


【解决方案1】:

您可以像这样使用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

注意我用conds 包裹了#endif,否则你会得到if-endif 不匹配警告:

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

【讨论】:

  • 这是一种解决方法。但是发生了什么事?为什么我没有定义CMD时警告消失了?
猜你喜欢
  • 2019-10-05
  • 1970-01-01
  • 2011-09-14
  • 1970-01-01
  • 1970-01-01
  • 2013-10-22
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多