【问题标题】:Doxygen with *.in file带有 *.in 文件的 Doxygen
【发布时间】:2018-09-14 06:18:29
【问题描述】:

我用 *.in 文件生成函数

   class Foo
   {
   public:
   ...

      #define FUNCTION(returnType, getterName) \
         returnType getterName(uint8_t iValue) const;
      #include "Functions.in"
      #undef FUNCTION

   ...
   };

并想使用 Doxygen。 Doxygen 配置如下所示:

...
INPUT                  = Path/To/Foo
...
FILE_PATTERNS          = *.in \
                         *.c \
                         *.cc \
                         *.cxx \
                         *.cpp \
                         *.c++ 
...
SEARCH_INCLUDES        = YES
...
INCLUDE_PATH           = Path/To/Foo
...

我可以在文档中看到 *.in 文件,但看不到类中的函数。此外,Doxygen 会产生以下警告

Foo.h:10: warning: include file Functions.in not found, perhaps you forgot to add its directory to INCLUDE_PATH?

有人知道如何将 Doxygen 与 *.in 文件一起使用吗?实际上可以将 Doxygen 与生成代码一起使用吗?

【问题讨论】:

    标签: c++ documentation doxygen


    【解决方案1】:

    如果您阅读the Doxygen preprocessing documentation,您会看到

    用作 doxygen 输入的源文件可以由 doxygen 的内置 C 预处理器解析。

    默认情况下,doxygen 只进行部分预处理。也就是说,它评估条件编译语句(如#if)并评估宏定义,但它不执行宏扩展。

    可以更改此默认行为:

    如果你想扩展 CONST_STRING 宏,你应该将配置文件中的MACRO_EXPANSION标签设置为YES

    所以解决方案是通过 Doxygen 运行 *.in 文件,而是将 MACRO_EXPANSION 配置变量设置为 YES,宏将完全展开,它们的展开应该被解析。

    【讨论】:

    • 另一个问题可能是*.in文件没有被正确识别,应该通过告诉doxygen它是C文件来让doxygen知道,见EXTENSION_MAPPING
    • 感谢您的帮助!
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2021-10-18
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-05-31
    相关资源
    最近更新 更多