doxygen 宏定义/宏编译/条件编译/预处理/预编译 不处理、忽略条件、分析所有条件、满足所有条件的方法
#if defined(ENABLE_DEVICE_CRITICAL_LOCK_UNLOCK_CMDS)
#ifdef ENABLE_BOOT_CMD

这里把ENABLE_PREPROCESSING取消选中
MACRO_EXPANSION
注意,doxygen现在将展开所有宏定义(如果需要的话递归地)。这往往太多了。因此,doxygen还允许您只扩展那些显式指定的定义。为此,您必须将EXPAND_ONLY_PREDEF标签设置为YES,并在PREDEFINED或EXPAND_AS_DEFINED标签之后指定宏定义。
EXPAND_ONLY_PREDEF
如果EXPAND_ONLY_PREDEF和MACRO_EXPANSION标签都被设置为YES,那么宏扩展仅限于PREDEFINED和EXPAND_AS_DEFINED标签指定的宏。
如果EXPAND_ONLY_PREDEF和MACRO_EXPANSION标签都被设置为YES,那么宏扩展仅限于PREDEFINED和EXPAND_AS_DEFINED标签指定的宏。
PREDEFINED
PREDEFINED标记可用于指定一个或多个在预处理器启动之前定义的宏名称(类似于例如gcc的-D选项)。The argument of the tag is a list of macros of the form: name or name=definition (no spaces). 如果省略 definition and the
PREDEFINED标记可用于指定一个或多个在预处理器启动之前定义的宏名称(类似于例如gcc的-D选项)。The argument of the tag is a list of macros of the form: name or name=definition (no spaces). 如果省略 definition and the
"="
,则假定为"=1"。要防止宏定义通过#undef递归展开而未定义,请使用:=操作符而不是=操作符。EXPAND_AS_DEFINED
如果MACRO_EXPANSION和EXPAND_ONLY_PREDEF标签被设置为YES,那么这个标签可以用来指定应该扩展的宏名称列表。将使用在源文件中找到的宏定义。如果您想使用不同的宏定义来推翻源代码中的定义,请使用PREDEFINED标记。
如果MACRO_EXPANSION和EXPAND_ONLY_PREDEF标签被设置为YES,那么这个标签可以用来指定应该扩展的宏名称列表。将使用在源文件中找到的宏定义。如果您想使用不同的宏定义来推翻源代码中的定义,请使用PREDEFINED标记。
示例
/*! A reference to an IID */
#ifdef __cplusplus
#define REFIID const IID &
#else
#define REFIID const IID *
#endif
/*! The IUnknown interface */
DECLARE_INTERFACE(IUnknown)
{
STDMETHOD(HRESULT,QueryInterface) (THIS_ REFIID iid, void **ppv) PURE;
STDMETHOD(ULONG,AddRef) (THIS) PURE;
STDMETHOD(ULONG,Release) (THIS) PURE;
};
ENABLE_PREPROCESSING = YES
MACRO_EXPANSION = YES
EXPAND_ONLY_PREDEF = YES
PREDEFINED = "DECLARE_INTERFACE(name)=class name" \
"STDMETHOD(result,name)=virtual result name" \
"PURE= = 0" \
THIS_= \
THIS= \
__cplusplus
MACRO_EXPANSION = YES
EXPAND_ONLY_PREDEF = YES
PREDEFINED = "DECLARE_INTERFACE(name)=class name" \
"STDMETHOD(result,name)=virtual result name" \
"PURE= = 0" \
THIS_= \
THIS= \
__cplusplus
/*! A reference to an IID */
#define REFIID
/*! The IUnknown interface */
class IUnknown
{
virtual HRESULT QueryInterface ( REFIID iid, void **ppv) = 0;
virtual ULONG AddRef (空) = 0;
virtual ULONG Release () = 0;
};
参考
https://stackoverflow.com/questions/41196305/doxygen-document-all-conditional-defines
https://stackoverflow.com/questions/26043007/make-doxygen-document-the-ifdef-parts-too
https://stackoverflow.com/questions/5370369/doxygen-expand-macros-but-ignore-if
https://www.doxygen.nl/manual/preprocessing.html
Doxyfile配置文件保存和与GUI frontend同步问题
GUI界面的选项修改不会和Doxyfile配置文件自动同步(点Run doxygen后也不会同步,但是修改是会影响Run的),必须要手动点击左上角的File-Save才能将修改保存到文件中
Specify additional command line options for running doxygen
Field to specify extra options used when running doxygen, e.g. for debugging purposes.
-d preprocessor
PREDEFINED和EXPAND_AS_DEFINED
PREDEFINED预定义的 意思就是要替换或者补充.c .h文件里的#define
比如说补充一些编译器内部定义的宏、makefile-D定义的宏
另请注意,通常由预处理器自动定义的预处理器定义(如
__cplusplus
)必须使用 doxygen 的解析器手动定义(这样做是因为这些定义通常是特定于平台/编译器的)。EXPAND_AS_DEFINED要展开的宏 意思是匹配.c .h文件里的#define,只对文件里本来有的宏定义生效
-d
static std::map< std::string, Debug::DebugMask > s_labels =
{
{ "preprocessor", Debug::Preprocessor },
{ "nolineno", Debug::NoLineNo },
{ "commentcnv", Debug::CommentCnv },
{ "commentscan", Debug::CommentScan },
{ "formula", Debug::Formula },
{ "printtree", Debug::PrintTree },
{ "time", Debug::Time },
{ "extcmd", Debug::ExtCmd },
{ "markdown", Debug::Markdown },
{ "filteroutput", Debug::FilterOutput },
{ "plantuml", Debug::Plantuml },
{ "fortranfixed2free", Debug::FortranFixed2Free },
{ "cite", Debug::Cite },
{ "rtf", Debug::Rtf },
{ "qhp", Debug::Qhp },
{ "tag", Debug::Tag },
{ "alias", Debug::Alias },
{ "entries", Debug::Entries },
{ "sections", Debug::Sections },
{ "lex", Debug::Lex },
{ "lex:code", Debug::Lex_code },
{ "lex:commentcnv", Debug::Lex_commentcnv },
{ "lex:commentscan", Debug::Lex_commentscan },
{ "lex:configimpl", Debug::Lex_configimpl },
{ "lex:constexp", Debug::Lex_constexp },
{ "lex:declinfo", Debug::Lex_declinfo },
{ "lex:defargs", Debug::Lex_defargs },
{ "lex:doctokenizer", Debug::Lex_doctokenizer },
{ "lex:fortrancode", Debug::Lex_fortrancode },
{ "lex:fortranscanner", Debug::Lex_fortranscanner },
{ "lex:lexcode", Debug::Lex_lexcode },
{ "lex:lexscanner", Debug::Lex_lexscanner },
{ "lex:pre", Debug::Lex_pre },
{ "lex:pycode", Debug::Lex_pycode },
{ "lex:pyscanner", Debug::Lex_pyscanner },
{ "lex:scanner", Debug::Lex_scanner },
{ "lex:sqlcode", Debug::Lex_sqlcode },
{ "lex:vhdlcode", Debug::Lex_vhdlcode },
{ "lex:xml", Debug::Lex_xml },
{ "lex:xmlcode", Debug::Lex_xmlcode },
};
{
{ "preprocessor", Debug::Preprocessor },
{ "nolineno", Debug::NoLineNo },
{ "commentcnv", Debug::CommentCnv },
{ "commentscan", Debug::CommentScan },
{ "formula", Debug::Formula },
{ "printtree", Debug::PrintTree },
{ "time", Debug::Time },
{ "extcmd", Debug::ExtCmd },
{ "markdown", Debug::Markdown },
{ "filteroutput", Debug::FilterOutput },
{ "plantuml", Debug::Plantuml },
{ "fortranfixed2free", Debug::FortranFixed2Free },
{ "cite", Debug::Cite },
{ "rtf", Debug::Rtf },
{ "qhp", Debug::Qhp },
{ "tag", Debug::Tag },
{ "alias", Debug::Alias },
{ "entries", Debug::Entries },
{ "sections", Debug::Sections },
{ "lex", Debug::Lex },
{ "lex:code", Debug::Lex_code },
{ "lex:commentcnv", Debug::Lex_commentcnv },
{ "lex:commentscan", Debug::Lex_commentscan },
{ "lex:configimpl", Debug::Lex_configimpl },
{ "lex:constexp", Debug::Lex_constexp },
{ "lex:declinfo", Debug::Lex_declinfo },
{ "lex:defargs", Debug::Lex_defargs },
{ "lex:doctokenizer", Debug::Lex_doctokenizer },
{ "lex:fortrancode", Debug::Lex_fortrancode },
{ "lex:fortranscanner", Debug::Lex_fortranscanner },
{ "lex:lexcode", Debug::Lex_lexcode },
{ "lex:lexscanner", Debug::Lex_lexscanner },
{ "lex:pre", Debug::Lex_pre },
{ "lex:pycode", Debug::Lex_pycode },
{ "lex:pyscanner", Debug::Lex_pyscanner },
{ "lex:scanner", Debug::Lex_scanner },
{ "lex:sqlcode", Debug::Lex_sqlcode },
{ "lex:vhdlcode", Debug::Lex_vhdlcode },
{ "lex:xml", Debug::Lex_xml },
{ "lex:xmlcode", Debug::Lex_xmlcode },
};