Skip to content

CXX-3171 Remove obsolete export macros #1260

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Nov 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 1 addition & 13 deletions Doxyfile
Original file line number Diff line number Diff line change
Expand Up @@ -2434,23 +2434,11 @@ PREDEFINED = BSONCXX_ABI_EXPORT_CDECL(...)=__VA_ARGS__ \
EXPAND_AS_DEFINED = BSONCXX_ABI_CDECL \
BSONCXX_ABI_EXPORT \
BSONCXX_ABI_NO_EXPORT \
BSONCXX_API \
BSONCXX_CALL \
BSONCXX_DEPRECATED \
BSONCXX_DEPRECATED_EXPORT \
BSONCXX_DEPRECATED_NO_EXPORT \
BSONCXX_INLINE \
BSONCXX_PRIVATE \
MONGOCXX_ABI_CDECL \
MONGOCXX_ABI_EXPORT \
MONGOCXX_ABI_NO_EXPORT \
MONGOCXX_API \
MONGOCXX_CALL \
MONGOCXX_DEPRECATED \
MONGOCXX_DEPRECATED_EXPORT \
MONGOCXX_DEPRECATED_NO_EXPORT \
MONGOCXX_INLINE \
MONGOCXX_PRIVATE
MONGOCXX_DEPRECATED

# 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
Expand Down
2 changes: 1 addition & 1 deletion etc/coding_guidelines.md
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ class foo {
private:
friend baz;

class MONGOCXX_PRIVATE impl;
class impl;
std::unique_ptr<impl> _impl;

};
Expand Down
9 changes: 3 additions & 6 deletions src/bsoncxx/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,9 @@ if(1)
function(bsoncxx_install_export_header TARGET)
set(bsoncxx_export_header_custom_content "")
string(APPEND bsoncxx_export_header_custom_content
"\n"
"#undef BSONCXX_DEPRECATED_EXPORT\n"
"#undef BSONCXX_DEPRECATED_NO_EXPORT\n"
"\n"
"#if defined(_MSC_VER)\n"
"#define BSONCXX_ABI_CDECL __cdecl\n"
Expand All @@ -164,12 +167,6 @@ if(1)
"#endif\n"
"\n"
"#define BSONCXX_ABI_EXPORT_CDECL(...) BSONCXX_ABI_EXPORT __VA_ARGS__ BSONCXX_ABI_CDECL\n"
"\n"
"// For backward compatibility. Use BSONCXX_ABI_EXPORT_CDECL instead.\n"
"#define BSONCXX_API BSONCXX_ABI_EXPORT\n"
"\n"
"// For backward compatibility. Use BSONCXX_ABI_NO_EXPORT instead.\n"
"#define BSONCXX_PRIVATE BSONCXX_ABI_NO_EXPORT\n"
)
generate_export_header(${TARGET}
BASE_NAME BSONCXX_ABI
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@ class sub_array {
///
/// Inductive base-case for the variadic append(...)
///
BSONCXX_INLINE
void append() {}

private:
Expand All @@ -72,7 +71,6 @@ class sub_array {
//
// Concatenates another bson array directly.
//
BSONCXX_INLINE
void append_(concatenate_array array) {
_core->concatenate(array.view());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@ class sub_document {
///
/// Inductive base-case for the variadic append(...)
///
BSONCXX_INLINE
void append() {}

private:
Expand Down Expand Up @@ -92,7 +91,6 @@ class sub_document {
//
// Concatenates another bson document directly.
//
BSONCXX_INLINE
void append_(concatenate_doc doc) {
_core->concatenate(doc);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,6 @@

// clang-format on

// For backward compatibility. Use `inline` instead.
#define BSONCXX_INLINE inline BSONCXX_ABI_NO_EXPORT

// For backward compatibility. Use BSONCXX_ABI_EXPORT_CDECL instead.
#define BSONCXX_CALL BSONCXX_ABI_CDECL

///
/// @file
/// Provides macros for internal use.
Expand Down
10 changes: 0 additions & 10 deletions src/bsoncxx/include/bsoncxx/v_noabi/bsoncxx/config/postlude.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,6 @@
// See the License for the specific language governing permissions and
// limitations under the License.

// compiler.hpp
#undef BSONCXX_INLINE
#pragma pop_macro("BSONCXX_INLINE")
#undef BSONCXX_CALL
#pragma pop_macro("BSONCXX_CALL")

// config.hpp (generated by CMake)
#undef BSONCXX_POLY_USE_MNMLSTC
#pragma pop_macro("BSONCXX_POLY_USE_MNMLSTC")
Expand Down Expand Up @@ -46,11 +40,7 @@
#pragma pop_macro("BSONCXX_ABI_NO_EXPORT")
#pragma pop_macro("BSONCXX_ABI_CDECL")
#pragma pop_macro("BSONCXX_ABI_EXPORT_CDECL")
#pragma pop_macro("BSONCXX_API")
#pragma pop_macro("BSONCXX_PRIVATE")
#pragma pop_macro("BSONCXX_DEPRECATED")
#pragma pop_macro("BSONCXX_DEPRECATED_EXPORT")
#pragma pop_macro("BSONCXX_DEPRECATED_NO_EXPORT")

// prelude.hpp
#undef BSONCXX_UNREACHABLE
Expand Down
12 changes: 0 additions & 12 deletions src/bsoncxx/include/bsoncxx/v_noabi/bsoncxx/config/prelude.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,6 @@
#undef BSONCXX_FWD

// compiler.hpp
#pragma push_macro("BSONCXX_INLINE")
#undef BSONCXX_INLINE
#pragma push_macro("BSONCXX_CALL")
#undef BSONCXX_CALL
#pragma push_macro("BSONCXX_IF_MSVC")
#undef BSONCXX_IF_MSVC
#pragma push_macro("BSONCXX_IF_GCC")
Expand Down Expand Up @@ -95,16 +91,8 @@
#undef BSONCXX_ABI_CDECL
#pragma push_macro("BSONCXX_ABI_EXPORT_CDECL")
#undef BSONCXX_ABI_EXPORT_CDECL
#pragma push_macro("BSONCXX_API")
#undef BSONCXX_API
#pragma push_macro("BSONCXX_PRIVATE")
#undef BSONCXX_PRIVATE
#pragma push_macro("BSONCXX_DEPRECATED")
#undef BSONCXX_DEPRECATED
#pragma push_macro("BSONCXX_DEPRECATED_EXPORT")
#undef BSONCXX_DEPRECATED
#pragma push_macro("BSONCXX_DEPRECATED_NO_EXPORT")
#undef BSONCXX_DEPRECATED

#include <bsoncxx/config/util.hpp>
//
Expand Down
44 changes: 0 additions & 44 deletions src/bsoncxx/include/bsoncxx/v_noabi/bsoncxx/fwd.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -206,34 +206,6 @@
///
#define BSONCXX_ABI_EXPORT_CDECL(...) BSONCXX_ABI_EXPORT __VA_ARGS__ BSONCXX_ABI_CDECL

///
/// @ingroup bsoncxx-v_noabi-bsoncxx-config-export-hpp
/// Equivalent to @ref BSONCXX_ABI_EXPORT.
///
/// @warning For internal use only!
///
/// @note This is a symbol visibility control macro, NOT a declaration of public API. Public API vs.
/// private API is determined by the placement of the entity being declared (e.g. in a public
/// header, as a public class member, etc.) or by documentation (e.g. absence of "For internal use
/// only!" warnings). See [API and ABI
/// Versioning](https://www.mongodb.com/docs/languages/cpp/cpp-driver/current/api-abi-versioning/).
///
#define BSONCXX_API BSONCXX_ABI_EXPORT

///
/// @ingroup bsoncxx-v_noabi-bsoncxx-config-export-hpp
/// Equivalent to `inline` with @ref BSONCXX_ABI_NO_EXPORT.
///
/// @warning For internal use only!
///
/// @note This is a symbol visibility control macro, NOT a declaration of private API. Public API
/// vs. private API is determined by the placement of the entity being declared (e.g. in a detail
/// header, as a private class member, etc.) or by documentation (e.g. "For internal use only!",
/// absence of documentation, etc.). See [API and ABI
/// Versioning](https://www.mongodb.com/docs/languages/cpp/cpp-driver/current/api-abi-versioning/).
///
#define BSONCXX_PRIVATE inline BSONCXX_ABI_NO_EXPORT

///
/// @ingroup bsoncxx-v_noabi-bsoncxx-config-export-hpp
/// Declares the associated entity as deprecated.
Expand All @@ -242,22 +214,6 @@
///
#define BSONCXX_DEPRECATED

///
/// @ingroup bsoncxx-v_noabi-bsoncxx-config-export-hpp
/// Equivalent to @ref BSONCXX_API and @ref BSONCXX_DEPRECATED.
///
/// @warning For internal use only!
///
#define BSONCXX_DEPRECATED_EXPORT

///
/// @ingroup bsoncxx-v_noabi-bsoncxx-config-export-hpp
/// Equivalent to @ref BSONCXX_PRIVATE and @ref BSONCXX_DEPRECATED.
///
/// @warning For internal use only!
///
#define BSONCXX_DEPRECATED_NO_EXPORT

///
/// @} <!-- bsoncxx/v_noabi/bsoncxx/config/export.hpp -->
///
Expand Down
8 changes: 0 additions & 8 deletions src/bsoncxx/test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -85,10 +85,6 @@ if(ENABLE_MACRO_GUARD_TESTS)
PROJECT_NAME bsoncxx
PROJECT_TEST_PROPERTIES_TARGET bsoncxx::test_properties
GUARDED_MACROS
# compiler.hpp
BSONCXX_INLINE
BSONCXX_CALL

# config.hpp (generated by CMake)
BSONCXX_POLY_USE_MNMLSTC
BSONCXX_POLY_USE_SYSTEM_MNMLSTC
Expand All @@ -109,11 +105,7 @@ if(ENABLE_MACRO_GUARD_TESTS)
BSONCXX_ABI_NO_EXPORT
BSONCXX_ABI_EXPORT_CDECL
BSONCXX_ABI_EXPORT_CDECL_TESTING
BSONCXX_API
BSONCXX_PRIVATE
BSONCXX_DEPRECATED
BSONCXX_DEPRECATED_EXPORT
BSONCXX_DEPRECATED_NO_EXPORT

# prelude.hpp
BSONCXX_UNREACHABLE
Expand Down
14 changes: 4 additions & 10 deletions src/mongocxx/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,9 @@ if(1)
function(mongocxx_install_export_header TARGET)
set(mongocxx_export_header_custom_content "")
string(APPEND mongocxx_export_header_custom_content
"\n"
"#undef MONGOCXX_DEPRECATED_EXPORT\n"
"#undef MONGOCXX_DEPRECATED_NO_EXPORT\n"
"\n"
"#if defined(_MSC_VER)\n"
"#define MONGOCXX_ABI_CDECL __cdecl\n"
Expand All @@ -111,20 +114,11 @@ if(1)
"#endif\n"
"\n"
"#define MONGOCXX_ABI_EXPORT_CDECL(...) MONGOCXX_ABI_EXPORT __VA_ARGS__ MONGOCXX_ABI_CDECL\n"
"\n"
"// For backward compatibility. Use MONGOCXX_ABI_EXPORT_CDECL instead.\n"
"#define MONGOCXX_API MONGOCXX_ABI_EXPORT\n"
"\n"
"// For backward compatibility. Use MONGOCXX_ABI_NO_EXPORT instead.\n"
"#define MONGOCXX_PRIVATE MONGOCXX_ABI_NO_EXPORT\n"
"\n"
"// Declare the entity as deprecated.\n"
"#define MONGOCXX_DEPRECATED MONGOCXX_ABI_DEPRECATED\n"
)
generate_export_header(${TARGET}
BASE_NAME MONGOCXX_ABI
EXPORT_MACRO_NAME MONGOCXX_ABI_EXPORT
DEPRECATED_MACRO_NAME MONGOCXX_ABI_DEPRECATED
DEPRECATED_MACRO_NAME MONGOCXX_DEPRECATED
EXPORT_FILE_NAME ${PROJECT_BINARY_DIR}/lib/mongocxx/v_noabi/mongocxx/config/export.hpp
STATIC_DEFINE MONGOCXX_STATIC
CUSTOM_CONTENT_FROM_VARIABLE mongocxx_export_header_custom_content
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,6 @@
// See the License for the specific language governing permissions and
// limitations under the License.

// For backward compatibility. Use `inline` instead.
#define MONGOCXX_INLINE inline MONGOCXX_ABI_NO_EXPORT

// For backward compatibility. Use MONGOCXX_ABI_EXPORT_CDECL instead.
#define MONGOCXX_CALL MONGOCXX_ABI_CDECL
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove MONGOCXX_INLINE and MONGOCXX_CALL from prelude/postlude headers and macro guard checks.


///
/// @file
/// Provides macros for internal use.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,6 @@
// See the License for the specific language governing permissions and
// limitations under the License.

// compiler.hpp
#undef MONGOCXX_INLINE
#pragma pop_macro("MONGOCXX_INLINE")
#undef MONGOCXX_CALL
#pragma pop_macro("MONGOCXX_CALL")

// version.hpp (generated by CMake)
#undef MONGOCXX_VERSION_STRING
#pragma pop_macro("MONGOCXX_VERSION_STRING")
Expand All @@ -37,11 +31,7 @@
#pragma pop_macro("MONGOCXX_ABI_NO_EXPORT")
#pragma pop_macro("MONGOCXX_ABI_CDECL")
#pragma pop_macro("MONGOCXX_ABI_EXPORT_CDECL")
#pragma pop_macro("MONGOCXX_API")
#pragma pop_macro("MONGOCXX_PRIVATE")
#pragma pop_macro("MONGOCXX_DEPRECATED")
#pragma pop_macro("MONGOCXX_DEPRECATED_EXPORT")
#pragma pop_macro("MONGOCXX_DEPRECATED_NO_EXPORT")
#endif

// prelude.hpp
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,6 @@
// See the License for the specific language governing permissions and
// limitations under the License.

// compiler.hpp
#pragma push_macro("MONGOCXX_INLINE")
#undef MONGOCXX_INLINE
#pragma push_macro("MONGOCXX_CALL")
#undef MONGOCXX_CALL

// version.hpp (generated by CMake)
#pragma push_macro("MONGOCXX_VERSION_STRING")
#undef MONGOCXX_VERSION_STRING
Expand All @@ -41,16 +35,8 @@
#undef MONGOCXX_ABI_CDECL
#pragma push_macro("MONGOCXX_ABI_EXPORT_CDECL")
#undef MONGOCXX_ABI_EXPORT_CDECL
#pragma push_macro("MONGOCXX_API")
#undef MONGOCXX_API
#pragma push_macro("MONGOCXX_PRIVATE")
#undef MONGOCXX_PRIVATE
#pragma push_macro("MONGOCXX_DEPRECATED")
#undef MONGOCXX_DEPRECATED
#pragma push_macro("MONGOCXX_DEPRECATED_EXPORT")
#undef MONGOCXX_DEPRECATED_EXPORT
#pragma push_macro("MONGOCXX_DEPRECATED_NO_EXPORT")
#undef MONGOCXX_DEPRECATED_NO_EXPORT
#endif

#include <mongocxx/config/compiler.hpp>
Expand Down
44 changes: 0 additions & 44 deletions src/mongocxx/include/mongocxx/v_noabi/mongocxx/fwd.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -203,34 +203,6 @@
///
#define MONGOCXX_ABI_EXPORT_CDECL(...) MONGOCXX_ABI_EXPORT __VA_ARGS__ MONGOCXX_ABI_CDECL

///
/// @ingroup mongocxx-v_noabi-mongocxx-config-export-hpp
/// Equivalent to @ref MONGOCXX_ABI_EXPORT.
///
/// @warning For internal use only!
///
/// @note This is a symbol visibility control macro, NOT a declaration of public API. Public API vs.
/// private API is determined by the placement of the entity being declared (e.g. in a public
/// header, as a public class member, etc.) or by documentation (e.g. absence of "For internal use
/// only!" warnings). See [API and ABI
/// Versioning](https://www.mongodb.com/docs/languages/cpp/cpp-driver/current/api-abi-versioning/).
///
#define MONGOCXX_API MONGOCXX_ABI_EXPORT

///
/// @ingroup mongocxx-v_noabi-mongocxx-config-export-hpp
/// Equivalent to `inline` with @ref MONGOCXX_ABI_NO_EXPORT.
///
/// @warning For internal use only!
///
/// @note This is a symbol visibility control macro, NOT a declaration of private API. Public API
/// vs. private API is determined by the placement of the entity being declared (e.g. in a detail
/// header, as a private class member, etc.) or by documentation (e.g. "For internal use only!",
/// absence of documentation, etc.). See [API and ABI
/// Versioning](https://www.mongodb.com/docs/languages/cpp/cpp-driver/current/api-abi-versioning/).
///
#define MONGOCXX_PRIVATE inline MONGOCXX_ABI_NO_EXPORT

///
/// @ingroup mongocxx-v_noabi-mongocxx-config-export-hpp
/// Declares the associated entity as deprecated.
Expand All @@ -239,22 +211,6 @@
///
#define MONGOCXX_DEPRECATED

///
/// @ingroup mongocxx-v_noabi-mongocxx-config-export-hpp
/// Equivalent to @ref MONGOCXX_API and @ref MONGOCXX_DEPRECATED.
///
/// @warning For internal use only!
///
#define MONGOCXX_DEPRECATED_EXPORT

///
/// @ingroup mongocxx-v_noabi-mongocxx-config-export-hpp
/// Equivalent to @ref MONGOCXX_PRIVATE and @ref MONGOCXX_DEPRECATED.
///
/// @warning For internal use only!
///
#define MONGOCXX_DEPRECATED_NO_EXPORT

///
/// @} <!-- mongocxx/v_noabi/mongocxx/config/export.hpp -->
///
Expand Down
Loading