Expand non-functional macros in the oxygen documentation for C

I am trying to document my C code using doxygen. I have default values ​​set as C # define macros. (I know that C has no default values, but this is just an example)

eg:.

#define DEFAULT_WIDTH 100 #define DEFAULT_HEIGHT 200 

Inside doxygen, I added an alias that handles the default values ​​the way I want. Consider an example function below

 //! Initializes something //! @param width The width @default DEFAULT_WIDTH //! @param height The height @default DEFAULT_HEIGHT //! @return Result of initialization char initSomething(int width,int height); 

This will lead to the creation of documentation as I want, except for one important fact. DEFAULT_WIDTH and DEFAULT_HEIGHT are not expanding, I get macro names, not 100 and 200, respectively. I have MACRO_EXPANSION and ENABLE_PREPROCESSING.

What am I missing? Is there any way to achieve this with doxygen?

I am configuring doxygen with doxywizard and am currently testing on Windows.

EDIT: As ugoren points out, you can just document the macro, and then doxygen will link this documentation to them. This is how my current implementation in my project really is. But I'm trying to consider additional options - if they exist.

+1
source share
2 answers

I don’t think there is anything stronger than MACRO_EXPANSION and ENABLE_PREPROCESSING.
Probably the problem is that the macros in the comments usually do not expand. There is a good reason for this - imagine that the max macro is expanded inside the documentation.

You can document the macro so that documentation readers can easily find the real value.

+2
source

Add something like

 EXPAND_AS_DEFINED += DEFAULT_WIDTH 

to the doxygen configuration file.

(The P99 documentation is full of such macro extensions. The doxygen configuration file should come with the distribution.)

+2
source

All Articles