Say I have:
#define MY_MACRO(FOO) void FOO();
MY_MACRO(hi);
MY_MACRO(hey);
MY_MACRO(hello);
#undef MY_MACRO
I want the macros to be expanded by doxygen, which I am able to do by configuring it the right way:
ENABLE_PREPROCESSING = YES
MACRO_EXPANSION = YES
EXPAND_ONLY_PREDEF = YES
EXPAND_AS_DEFINED = MY_MACRO
This enables me to see the expanded result of the macros as documented APIs in the doxygen output (functions hi
, hey
, and hello
). That is all good so far. But the problem is that, doxygen also documents MY_MACRO
as a define. However, I do not want the clients of the API to know about MY_MACRO
, since it is undefed and is not usable by them, and should not be visible to them.
I have EXTRACT_ALL = YES
in my doxygen configuration and I do not want to change that. I have tried the following configuration without success:
PREDEFINED = DOXYGEN_SKIP_FOR_USERS
With the following code:
#ifndef DOXYGEN_SKIP_FOR_USERS
#define MY_MACRO(FOO) void FOO();
#endif /*DOXYGEN_SKIP_FOR_USERS*/
MY_MACRO(hi);
MY_MACRO(hey);
MY_MACRO(hello);
#undef MY_MACRO
This hides the documentation of the define, but of course prevents the expansion, so I do not get the functions documented in the generated API.
I would appreciate your help.
The section "Special Commands" lists the \def command, and the section "Automatic link generation" describes what you want to link to the macro. Use \def to document a macro separate from the declaration. Use #MACRO(params) to auto-link to said macro definition.
Supposing that MY_
is the prefix that you are using consistently in your code :) I would use the prefix MY__
(two underscores) for internal macros and then put something like
EXCLUDE_SYMBOLS = MY__*
in the Doxygen
configuration file.
Edit: the double underscore inside symbols is reserved for C++ (not for C). So if you want to be compatible with C and C++ you should choose some other type of convention. Unfortunately a leading underscore is reserved, too, so _MY_
wouldn't do neither.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With