2016-11-01 106 views
5

請不要介意下面的小例子的陌生感Doxygen的要求(我會讓它更大的證明,爲什麼我做的事情這樣):,一個包括後衛被記錄

檔測試。 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. 

首先有趣的是,該警告提到a.h。第二個是如果任何一條評論行被刪除,警告消失。這裏發生了什麼?

+0

'啊'沒有包括守衛? –

+0

@old_mountain僅用於示例的最小化。 – AlwaysLearning

回答

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 

注意,我包#endifcond S,否則你會得到IF-ENDIF不匹配的警告:

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

這是一種解決方法。但是發生了什麼?爲什麼當我沒有定義'CMD'時警告消失了? – AlwaysLearning