Doxygen要求记录包含防守

问题描述 投票:5回答:1

请不要介意以下最小例子的陌生感(我必须把它做得更大才能证明我为什么这样做):

文件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。第二个是,如果任一注释行被除去,警告消失。这里发生了什么?

c++ doxygen include-guards
1个回答
0
投票

您可以使用conditional documentationsuppress 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

请注意,我用#endifs包装了cond,否则你会得到if-endif不匹配警告:

/home/user/doxygen/b.h:13: warning: More #endif's than #if's found.
© www.soinside.com 2019 - 2024. All rights reserved.