简体   繁体   中英

Doxygen with *.in file

I generate functions with *.in files

   class Foo
   {
   public:
   ...

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

   ...
   };

and want to use Doxygen. The Doxygen configuration looks like:

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

I can see the *.in files in the documentation but not the functions in the class. Additionally Doxygen creates following warning

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

Does somebody know how to use Doxygen with *.in files? Is actually possible to use Doxygen with generated-code?

If you read the Doxygen preprocessing documentation you will see that

Source files that are used as input to doxygen can be parsed by doxygen's built-in C-preprocessor.

And

By default doxygen does only partial preprocessing. That is, it evaluates conditional compilation statements (like #if) and evaluates macro definitions, but it does not perform macro expansion.

This default behavior can be changed:

In case you want to expand the CONST_STRING macro, you should set the MACRO_EXPANSION tag in the config file to YES .

So the solution is to not run the *.in files through Doxygen, but instead set the MACRO_EXPANSION configuration variable to YES , and the macros will be fully expanded and their expansions should be parsed.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM