doxygen: fix and improve macro expansion configuration options #1353
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Workaround doxgyen/doxygen#11495 and doxygen/doxygen#11496 which are affecting CXX-2745 API documentation by tidying up the preprocessor-related Doxygen configuration options following #1301. Since all relevant macro definitions are now visible, they can be expanded as-is with
MACRO_EXPANSION = YESwithout usingEXPAND_AS_DEFINED.EXPAND_ONLY_PREDEF = YESandSKIP_FUNCTION_MACROS = YESare no longer required to guard against the attempted expansion of complex macros, as all problematic expansions are already being guarded with\cond DOXYGEN_DISABLE(these options do not help us avoid these issues) and we do not parse non-header files (where most other macros, including those from external libraries, are used).Due to the complexity of export macro definitions confusing the Doxygen preprocessor (notably their expansion into
__attribute__and__declspecspecifiers),PREDEFINEDis used to replace the definitions of*_ABI_EXPORT,*_ABI_CDECL, and*_ABI_EXPORT_CDECLwith simpler alternatives. All three must be predefined to fully avoid preprocessor and parser failures.Given the
*_ABI_EXPORT=predefinitions, the*_ABI_EXPORTmacro is never defined in code due to the#ifndefguard in the generated export header. A Doxygen preprocessor branch which unconditionally defines the export macro (as a stub:...) is needed to satisfy the\defspecial command's requirement that the documented macro is defined in code prior to the doc comment.