Doxygen documenting commented #define
c++, c-preprocessor, comments, documentation, doxygen
Solution
Not sure if it is a best option, but you can use the approach below.
Modify configuration file to include `PREDEFINED` parameter:
ENABLE_PREPROCESSING = YES
MACRO_EXPANSION = YES
EXPAND_ONLY_PREDEF = YES
PREDEFINED = "DOXYGEN=1"
In your code, do the following:
#if DOXYGEN
#define nAsserts
#endif
Doxygen follows own preprocessor and can conditionally include/exclude source module sections.
Problem
I'm new to Doxygen and recently run into a problem which I could not solve. I have this piece of documented code: ``` /*! \def nAsserts Uncomment that line so that all asserts would be removed */ //#define nAsserts ``` and it's supposed to tell the user to uncomment that line when they wish to remove all asserts but doxygen is returning me a warning: warning: documentation for unknown define nAsserts found I think the problem is that doxygen ignores all commented codes so is that any way to fix this or work around it?