From 9dd3aedec9b640cf7051af6a9fbd71bdabc815f2 Mon Sep 17 00:00:00 2001 From: Ezra Chung Date: Fri, 14 Mar 2025 11:53:07 -0500 Subject: [PATCH] doxygen: fix and improve macro expansion configuration options --- Doxyfile | 19 ++++++++----------- src/bsoncxx/CMakeLists.txt | 5 +++++ src/mongocxx/CMakeLists.txt | 5 +++++ 3 files changed, 18 insertions(+), 11 deletions(-) diff --git a/Doxyfile b/Doxyfile index b74116b92f..3c84c6e80a 100644 --- a/Doxyfile +++ b/Doxyfile @@ -2397,7 +2397,7 @@ MACRO_EXPANSION = YES # The default value is: NO. # This tag requires that the tag ENABLE_PREPROCESSING is set to YES. -EXPAND_ONLY_PREDEF = YES +EXPAND_ONLY_PREDEF = NO # If the SEARCH_INCLUDES tag is set to YES, the include files in the # INCLUDE_PATH will be searched if a #include is found. @@ -2430,8 +2430,12 @@ INCLUDE_FILE_PATTERNS = # recursively expanded use the := operator instead of the = operator. # This tag requires that the tag ENABLE_PREPROCESSING is set to YES. -PREDEFINED = BSONCXX_ABI_EXPORT_CDECL(...)=__VA_ARGS__ \ +PREDEFINED = BSONCXX_ABI_CDECL= \ + BSONCXX_ABI_EXPORT= \ + BSONCXX_ABI_EXPORT_CDECL(...)=__VA_ARGS__ \ BSONCXX_PRIVATE_DOXYGEN_PREPROCESSOR= \ + MONGOCXX_ABI_CDECL= \ + MONGOCXX_ABI_EXPORT= \ MONGOCXX_ABI_EXPORT_CDECL(...)=__VA_ARGS__ \ MONGOCXX_PRIVATE_DOXYGEN_PREPROCESSOR= @@ -2442,14 +2446,7 @@ PREDEFINED = BSONCXX_ABI_EXPORT_CDECL(...)=__VA_ARGS__ \ # definition found in the source code. # This tag requires that the tag ENABLE_PREPROCESSING is set to YES. -EXPAND_AS_DEFINED = BSONCXX_ABI_CDECL \ - BSONCXX_ABI_EXPORT \ - BSONCXX_ABI_NO_EXPORT \ - BSONCXX_DEPRECATED \ - MONGOCXX_ABI_CDECL \ - MONGOCXX_ABI_EXPORT \ - MONGOCXX_ABI_NO_EXPORT \ - MONGOCXX_DEPRECATED +EXPAND_AS_DEFINED = # If the SKIP_FUNCTION_MACROS tag is set to YES then Doxygen's preprocessor will # remove all references to function-like macros that are alone on a line, have @@ -2459,7 +2456,7 @@ EXPAND_AS_DEFINED = BSONCXX_ABI_CDECL \ # The default value is: YES. # This tag requires that the tag ENABLE_PREPROCESSING is set to YES. -SKIP_FUNCTION_MACROS = YES +SKIP_FUNCTION_MACROS = NO #--------------------------------------------------------------------------- # Configuration options related to external references diff --git a/src/bsoncxx/CMakeLists.txt b/src/bsoncxx/CMakeLists.txt index 5c18db21be..05b22be563 100644 --- a/src/bsoncxx/CMakeLists.txt +++ b/src/bsoncxx/CMakeLists.txt @@ -153,6 +153,11 @@ if(1) /// @warning For internal use only! /// +// Doxygen `PREDEFINED` does not define the macro *in code* as required by `@def`. +#if defined(BSONCXX_PRIVATE_DOXYGEN_PREPROCESSOR) +#define BSONCXX_ABI_EXPORT ... +#endif + /// /// @def BSONCXX_ABI_EXPORT /// @hideinitializer diff --git a/src/mongocxx/CMakeLists.txt b/src/mongocxx/CMakeLists.txt index e92198c7bb..4651d4a4a5 100644 --- a/src/mongocxx/CMakeLists.txt +++ b/src/mongocxx/CMakeLists.txt @@ -121,6 +121,11 @@ if(1) #define MONGOCXX_ABI_EXPORT_CDECL(...) MONGOCXX_ABI_EXPORT __VA_ARGS__ MONGOCXX_ABI_CDECL +// Doxygen `PREDEFINED` does not define the macro *in code* as required by `@def`. +#if defined(MONGOCXX_PRIVATE_DOXYGEN_PREPROCESSOR) +#define MONGOCXX_ABI_EXPORT ... +#endif + /// /// @file /// Provides macros to control the set of symbols exported in the ABI.