开发者

Doxygen - Expand macros but ignore #if?

Is it possible to tell Doxygen to expand macros but ignore other preprocessor directives?

Take the following into account:

#if defined(linux)
  #define OS_LINUX
  int function()开发者_如何学编程 { /* ... */ }
  // Other functions defined for Linux
#elif defined(__WIN32__)
  #define OS_WINDOWS
  int function() { /* ... */ }
  // Other functions defined for Windows
#else
  #error "OS unsupported."
#endif

In this case, I want the functions for both Windows and Linux to show up, but I also want the macros OS_LINUX and OS_WINDOWS to show up in the documentation as well. Is there a way to document both macros while ignoring the #ifs?


No, you cannot do that you will have to build the documentation for each configuration separately. However if both Windows and Linux have the same interfaces defined, the documentation will surely be the same for both functions in any case?

By default if Doxygen finds documentation for a declaration in a header and documentation for corresponding definitions in source-files, the documentation in the header will be used. In this case you can use this to your advantage by only placing Doxygen mark-up in the header files. Normally the interfaces will be identical cross-platform and you will have a single header, but multiple implementations for each platform, either in separate sources or using conditional compilation.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜