Doxygen requires security guards to be documented

Please do not pay attention to the strangeness of the following minimal example (I would have to make it much larger to justify why I am doing this):

File test.cpp:

#include "ah" int main() { return 0; } 

Ah file:

 namespace N { // without namespace all is well! #include "bh" } 

Bh file:

 /// \file #ifndef GUARD #define GUARD struct A {}; #define CMD 5 // without this, all is well! #endif 

Doxygen 1.8.11 complains:

 warning: Member GUARD (macro definition) of file ah is not documented. 

The first thing interesting is this warning indicates ah . Secondly, if one of the commented lines is deleted, the warning disappears. What's going on here?

+5
source share
1 answer

You can use conditional documentation to suppress Doxygen warnings like this

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

Please note that I wrapped #endif in cond s, because otherwise you will get an if-endif mismatch warning:

 /home/user/doxygen/bh:13: warning: More #endif than #if found. 
0
source

Source: https://habr.com/ru/post/1259088/


All Articles