diff --git a/Doxyfile b/Doxyfile index 23b7f490ee..f8122c3679 100644 --- a/Doxyfile +++ b/Doxyfile @@ -604,7 +604,7 @@ HIDE_COMPOUND_REFERENCE= NO # the files that are included by a file in the documentation of that file. # The default value is: YES. -SHOW_INCLUDE_FILES = YES +SHOW_INCLUDE_FILES = NO # If the SHOW_GROUPED_MEMB_INC tag is set to YES then Doxygen will add for each # grouped member an include statement to the documentation, telling the reader @@ -2205,10 +2205,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_API= \ +PREDEFINED = BSONCXX_SATISFY_DOXYGEN_DEFINES \ + BSONCXX_API= \ BSONCXX_CALL= \ BSONCXX_DEPRECATED \ BSONCXX_INLINE= \ + MONGOCXX_SATISFY_DOXYGEN_DEFINES \ MONGOCXX_API= \ MONGOCXX_CALL= \ MONGOCXX_DEPRECATED \ diff --git a/src/bsoncxx/CMakeLists.txt b/src/bsoncxx/CMakeLists.txt index 1e241f55f6..e9ee62702d 100644 --- a/src/bsoncxx/CMakeLists.txt +++ b/src/bsoncxx/CMakeLists.txt @@ -155,13 +155,13 @@ if(1) BASE_NAME BSONCXX EXPORT_MACRO_NAME BSONCXX_API NO_EXPORT_MACRO_NAME BSONCXX_PRIVATE - EXPORT_FILE_NAME ${PROJECT_BINARY_DIR}/lib/bsoncxx/v_noabi/bsoncxx/config/export.hpp + EXPORT_FILE_NAME ${PROJECT_BINARY_DIR}/lib/bsoncxx/v1/bsoncxx/config/export.hpp STATIC_DEFINE BSONCXX_STATIC ) install(FILES - ${PROJECT_BINARY_DIR}/lib/bsoncxx/v_noabi/bsoncxx/config/export.hpp - DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/bsoncxx/v_noabi/bsoncxx/config + ${PROJECT_BINARY_DIR}/lib/bsoncxx/v1/bsoncxx/config/export.hpp + DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/bsoncxx/v1/bsoncxx/config COMPONENT dev ) endfunction() diff --git a/src/bsoncxx/include/CMakeLists.txt b/src/bsoncxx/include/CMakeLists.txt index ae5b3c7186..0f0437290a 100644 --- a/src/bsoncxx/include/CMakeLists.txt +++ b/src/bsoncxx/include/CMakeLists.txt @@ -42,9 +42,12 @@ set_dist_list(src_bsoncxx_include_DIST bsoncxx/v_noabi/bsoncxx/builder/stream/key_context.hpp bsoncxx/v_noabi/bsoncxx/builder/stream/single_context.hpp bsoncxx/v_noabi/bsoncxx/builder/stream/value_context.hpp + bsoncxx/v_noabi/bsoncxx/config/config.hpp bsoncxx/v_noabi/bsoncxx/config/compiler.hpp + bsoncxx/v_noabi/bsoncxx/config/export.hpp bsoncxx/v_noabi/bsoncxx/config/postlude.hpp bsoncxx/v_noabi/bsoncxx/config/prelude.hpp + bsoncxx/v_noabi/bsoncxx/config/version.hpp bsoncxx/v_noabi/bsoncxx/decimal128.hpp bsoncxx/v_noabi/bsoncxx/document/element.hpp bsoncxx/v_noabi/bsoncxx/document/value.hpp @@ -70,4 +73,7 @@ set_dist_list(src_bsoncxx_include_DIST bsoncxx/v_noabi/bsoncxx/util/functor.hpp bsoncxx/v_noabi/bsoncxx/validate.hpp bsoncxx/v_noabi/bsoncxx/view_or_value.hpp + bsoncxx/v1/bsoncxx/config/compiler.hpp + bsoncxx/v1/bsoncxx/config/postlude.hpp + bsoncxx/v1/bsoncxx/config/prelude.hpp ) diff --git a/src/bsoncxx/include/bsoncxx/v1/bsoncxx/config/compiler.hpp b/src/bsoncxx/include/bsoncxx/v1/bsoncxx/config/compiler.hpp new file mode 100644 index 0000000000..637174f975 --- /dev/null +++ b/src/bsoncxx/include/bsoncxx/v1/bsoncxx/config/compiler.hpp @@ -0,0 +1,42 @@ +// Copyright 2023 MongoDB Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/// +/// @file bsoncxx/v1/bsoncxx/config/compiler.hpp +/// +/// Declares macros that control compiler-specific behavior. +/// +/// @par Platform-Specific Behavior +/// Including this header disables MSVC warnings C4251 and C4275 via `#pragma warning(push)`. This +/// change is reverted by the postlude header via `#pragma warning(pop)`. +/// + +/// +/// The declared entity is a member of the public API but is excluded from ABI stability guarantees. +/// +#define BSONCXX_INLINE inline BSONCXX_PRIVATE + +/// +/// @def BSONCXX_CALL +/// Ensure the declared entity uses naming and calling conventions for C and C++. +/// +#if defined(_MSC_VER) +// Disable MSVC warnings that cause a lot of noise related to DLL visibility +// for types that we don't control (like std::unique_ptr). +#pragma warning(push) +#pragma warning(disable : 4251 4275) +#define BSONCXX_CALL __cdecl +#else +#define BSONCXX_CALL +#endif diff --git a/src/bsoncxx/include/bsoncxx/v1/bsoncxx/config/postlude.hpp b/src/bsoncxx/include/bsoncxx/v1/bsoncxx/config/postlude.hpp new file mode 100644 index 0000000000..923c09bfa8 --- /dev/null +++ b/src/bsoncxx/include/bsoncxx/v1/bsoncxx/config/postlude.hpp @@ -0,0 +1,78 @@ +// Copyright 2023 MongoDB Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/// +/// @file bsoncxx/v1/bsoncxx/config/postlude.hpp +/// +/// Macro guard postlude header for bsoncxx. +/// +/// Ensures any config macro defined in config headers do not leak their definition after inclusion. +/// +/// Restores prior definitions of conflicting macros that are guarded by the @ref +/// bsoncxx/v1/bsoncxx/config/prelude.hpp "matching prelude header". +/// +/// @warning Include of the postlude header must be preceeded by a matching include of the prelude +/// header. +/// +/// @note Include of the postlude header may be omitted if restoring prior definitions of +/// conflicting macros is not necessary, e.g. in source (.cpp) files. +/// + +// compiler.hpp +#undef BSONCXX_INLINE +#pragma pop_macro("BSONCXX_INLINE") +#if defined(_MSC_VER) +#pragma warning(pop) +#endif +#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") +#undef BSONCXX_POLY_USE_STD_EXPERIMENTAL +#pragma pop_macro("BSONCXX_POLY_USE_STD_EXPERIMENTAL") +#undef BSONCXX_POLY_USE_SYSTEM_MNMLSTC +#pragma pop_macro("BSONCXX_POLY_USE_SYSTEM_MNMLSTC") +#undef BSONCXX_POLY_USE_BOOST +#pragma pop_macro("BSONCXX_POLY_USE_BOOST") + +// export.hpp (generated by CMake) +#undef BSONCXX_API_H +#pragma pop_macro("BSONCXX_API_H") +#undef BSONCXX_API +#pragma pop_macro("BSONCXX_API") +#undef BSONCXX_PRIVATE +#pragma pop_macro("BSONCXX_PRIVATE") +#undef BSONCXX_DEPRECATED +#pragma pop_macro("BSONCXX_DEPRECATED") +#undef BSONCXX_DEPRECATED_EXPORT +#pragma pop_macro("BSONCXX_DEPRECATED_EXPORT") +#undef BSONCXX_DEPRECATED_NO_EXPORT +#pragma pop_macro("BSONCXX_DEPRECATED_NO_EXPORT") + +// version.hpp (generated by CMake) +#undef BSONCXX_VERSION_EXTRA +#pragma pop_macro("BSONCXX_VERSION_EXTRA") +#undef BSONCXX_VERSION_MAJOR +#pragma pop_macro("BSONCXX_VERSION_MAJOR") +#undef BSONCXX_VERSION_MINOR +#pragma pop_macro("BSONCXX_VERSION_MINOR") +#undef BSONCXX_VERSION_PATCH +#pragma pop_macro("BSONCXX_VERSION_PATCH") + +#if !defined(BSONCXX_V1_INSIDE_MACRO_GUARD_SCOPE) +#error "postlude header included without matching prelude header" +#endif +#undef BSONCXX_V1_INSIDE_MACRO_GUARD_SCOPE diff --git a/src/bsoncxx/include/bsoncxx/v1/bsoncxx/config/prelude.hpp b/src/bsoncxx/include/bsoncxx/v1/bsoncxx/config/prelude.hpp new file mode 100644 index 0000000000..c5e7251a34 --- /dev/null +++ b/src/bsoncxx/include/bsoncxx/v1/bsoncxx/config/prelude.hpp @@ -0,0 +1,167 @@ +// Copyright 2023 MongoDB Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/// +/// @file bsoncxx/v1/bsoncxx/config/prelude.hpp +/// +/// Macro guard prelude header for bsoncxx. +/// +/// Ensures any config macro defined in config headers do not conflict with existing definitions +/// prior to inclusion. To obtain config macros without macro guard behavior, include the +/// corresponding config header directly. +/// +/// Prior definitions of conflicting macros are restored by including the @ref +/// bsoncxx/v1/bsoncxx/config/postlude.hpp "matching postlude header". +/// +/// @warning Include of the prelude header twice in a row without a matching include of the postlude +/// header for the first include is forbidden (e.g. prelude -> prelude -> postlude -> postlude). +/// This is to enforce correct use of macro guard headers across transitive includes. +/// +/// @warning Include of the postlude header must be preceeded by a matching include of the prelude +/// header. +/// +/// @note Include of the matching postlude header may be omitted if restoring prior definitions of +/// conflicting macros is not necessary, e.g. in source (.cpp) files. +/// +/// @par Includes +/// @li bsoncxx/v1/bsoncxx/config/compiler.hpp +/// @li @ref bsoncxx-v1-bsoncxx-config-config-hpp "bsoncxx/v1/bsoncxx/config/config.hpp" +/// @li @ref bsoncxx-v1-bsoncxx-config-export-hpp "bsoncxx/v1/bsoncxx/config/export.hpp" +/// @li @ref bsoncxx-v1-bsoncxx-config-version-hpp "bsoncxx/v1/bsoncxx/config/version.hpp" +/// + +#if defined(BSONCXX_V1_INSIDE_MACRO_GUARD_SCOPE) +#error "prelude header included twice without matching postlude" +#endif + +/// Used to validate correct use of macro guard headers. +#define BSONCXX_V1_INSIDE_MACRO_GUARD_SCOPE + +// compiler.hpp +#pragma push_macro("BSONCXX_INLINE") +#undef BSONCXX_INLINE +#pragma push_macro("BSONCXX_CALL") +#undef BSONCXX_CALL + +// config.hpp (generated by CMake) +#pragma push_macro("BSONCXX_POLY_USE_MNMLSTC") +#undef BSONCXX_POLY_USE_MNMLSTC +#pragma push_macro("BSONCXX_POLY_USE_STD_EXPERIMENTAL") +#undef BSONCXX_POLY_USE_STD_EXPERIMENTAL +#pragma push_macro("BSONCXX_POLY_USE_SYSTEM_MNMLSTC") +#undef BSONCXX_POLY_USE_SYSTEM_MNMLSTC +#pragma push_macro("BSONCXX_POLY_USE_BOOST") +#undef BSONCXX_POLY_USE_BOOST + +// export.hpp (generated by CMake) +#pragma push_macro("BSONCXX_API_H") +#undef BSONCXX_API_H +#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_EXPORT +#pragma push_macro("BSONCXX_DEPRECATED_NO_EXPORT") +#undef BSONCXX_DEPRECATED_NO_EXPORT + +// version.hpp (generated by CMake) +#pragma push_macro("BSONCXX_VERSION_EXTRA") +#undef BSONCXX_VERSION_EXTRA +#pragma push_macro("BSONCXX_VERSION_MAJOR") +#undef BSONCXX_VERSION_MAJOR +#pragma push_macro("BSONCXX_VERSION_MINOR") +#undef BSONCXX_VERSION_MINOR +#pragma push_macro("BSONCXX_VERSION_PATCH") +#undef BSONCXX_VERSION_PATCH + +#include +#include +#include +#include + +// Doxygen does not account for generated header files. +// Document globally applicable macros and namespaces here. + +// Doxygen complains if it cannot find at least one `#define` of a documented macro. Use dummy +// `#define` for macros in generated config headers within this block to satisfy Doxygen. +#if defined(BSONCXX_SATISFY_DOXYGEN_DEFINES) +/// @defgroup bsoncxx-v1-bsoncxx-config-config-hpp bsoncxx/v1/bsoncxx/config/config.hpp +/// A generated config header declaring macros dependent on bsoncxx library configuration. +/// @sa bsoncxx/v1/bsoncxx/config/prelude.hpp +/// @{ + +/// Defined when the bsoncxx library is configured to use experimental standard library headers for +/// C++17 polyfills. +#define BSONCXX_POLY_USE_STD_EXPERIMENTAL +/// Defined when the bsoncxx library is configured to use mnmlstc/core headers for C++17 +/// polyfills. +#define BSONCXX_POLY_USE_MNMLSTC +/// Defined when the bsoncxx library is configured to use external mnmlstc/core headers already +/// installed on the system instead of bundling mnmlstc/core headers with the bsoncxx library. +#define BSONCXX_POLY_USE_SYSTEM_MNMLSTC +/// Defined when the bsoncxx library is configured to use Boost library headers for C++17 +/// polyfills. +#define BSONCXX_POLY_USE_BOOST +/// Defined when the bsoncxx library is configured to use standard library headers for C++17 +/// polyfills. +#define BSONCXX_POLY_USE_STD + +/// @} + +/// @defgroup bsoncxx-v1-bsoncxx-config-export-hpp bsoncxx/v1/bsoncxx/config/export.hpp +/// A generated config header declaring macros that control symbol export behavior. +/// @sa bsoncxx/v1/bsoncxx/config/prelude.hpp +/// @{ + +/// Header guard macro generated by CMake. +#define BSONCXX_API_H +/// The declared entity is a member of the public API. +#define BSONCXX_API +/// The declared entity is excluded from the public API. +#define BSONCXX_PRIVATE +/// The declared entity is deprecated. +#define BSONCXX_DEPRECATED +/// The declared entity is a deprecated member of the public API. +#define BSONCXX_DEPRECATED_EXPORT +/// The declared entity is deprecated and excluded from the public API. +#define BSONCXX_DEPRECATED_NO_EXPORT + +/// @} + +/// @defgroup bsoncxx-v1-bsoncxx-config-version-hpp bsoncxx/v1/bsoncxx/config/version.hpp +/// A generated config header declaring macros describing the bsoncxx library API version number. +/// @sa bsoncxx/v1/bsoncxx/config/prelude.hpp +/// @{ + +/// The API major version number for this bsoncxx library. +#define BSONCXX_VERSION_MAJOR +/// The API minor version number for this bsoncxx library. +#define BSONCXX_VERSION_MINOR +/// The API patch version number for this bsoncxx library. +#define BSONCXX_VERSION_PATCH +/// Additional API version labels for this bsoncxx library. +#define BSONCXX_VERSION_EXTRA + +/// @} + +#endif // defined(BSONCXX_SATISFY_DOXYGEN_DEFINES) + +/// @namespace bsoncxx +/// The top-level namespace for bsoncxx library entities. + +/// @namespace bsoncxx::v1 +/// Declares entities compatible with stable ABI version 1. diff --git a/src/bsoncxx/include/bsoncxx/v_noabi/bsoncxx/config/compiler.hpp b/src/bsoncxx/include/bsoncxx/v_noabi/bsoncxx/config/compiler.hpp index 6fdf6000a1..bddd75c694 100644 --- a/src/bsoncxx/include/bsoncxx/v_noabi/bsoncxx/config/compiler.hpp +++ b/src/bsoncxx/include/bsoncxx/v_noabi/bsoncxx/config/compiler.hpp @@ -12,21 +12,13 @@ // See the License for the specific language governing permissions and // limitations under the License. -#if defined(_MSC_VER) - -// Disable MSVC warnings that cause a lot of noise related to DLL visibility -// for types that we don't control (like std::unique_ptr). -#pragma warning(push) -#pragma warning(disable : 4251 4275) - -#define BSONCXX_INLINE inline BSONCXX_PRIVATE - -#define BSONCXX_CALL __cdecl - -#else - -#define BSONCXX_INLINE inline BSONCXX_PRIVATE - -#define BSONCXX_CALL - -#endif +/// +/// @file bsoncxx/v_noabi/bsoncxx/config/compiler.hpp +/// +/// Remains for backward compatibility. +/// +/// @par Includes +/// @li bsoncxx/v1/bsoncxx/config/compiler.hpp +/// + +#include diff --git a/src/bsoncxx/include/bsoncxx/v_noabi/bsoncxx/config/config.hpp b/src/bsoncxx/include/bsoncxx/v_noabi/bsoncxx/config/config.hpp new file mode 100644 index 0000000000..c4b63f5c11 --- /dev/null +++ b/src/bsoncxx/include/bsoncxx/v_noabi/bsoncxx/config/config.hpp @@ -0,0 +1,35 @@ +// Copyright 2023 MongoDB Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/// +/// @file bsoncxx/v_noabi/bsoncxx/config/config.hpp +/// +/// Remains for backward compatibility. +/// +/// @par Includes +/// @li @ref bsoncxx-v1-bsoncxx-config-config-hpp "bsoncxx/v1/bsoncxx/config/config.hpp" +/// + +#include + +/// +/// Begins the declaration of entities in the unstable ABI namespace `v_noabi`. +/// @deprecated This macro is no longer used to declare the `v_noabi` namespace. +/// +#define BSONCXX_INLINE_NAMESPACE_BEGIN inline namespace v_noabi { +/// +/// Ends the declaration of entities in the unstable ABI namespace `v_noabi`. +/// @deprecated This macro is no longer used to declare the `v_noabi` namespace. +/// +#define BSONCXX_INLINE_NAMESPACE_END } // namespace v_noabi diff --git a/src/bsoncxx/include/bsoncxx/v_noabi/bsoncxx/config/export.hpp b/src/bsoncxx/include/bsoncxx/v_noabi/bsoncxx/config/export.hpp new file mode 100644 index 0000000000..b2e51bedce --- /dev/null +++ b/src/bsoncxx/include/bsoncxx/v_noabi/bsoncxx/config/export.hpp @@ -0,0 +1,24 @@ +// Copyright 2023 MongoDB Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/// +/// @file bsoncxx/v_noabi/bsoncxx/config/export.hpp +/// +/// Remains for backward compatibility. +/// +/// @par Includes +/// @li @ref bsoncxx-v1-bsoncxx-config-export-hpp "bsoncxx/v1/bsoncxx/config/export.hpp" +/// + +#include diff --git a/src/bsoncxx/include/bsoncxx/v_noabi/bsoncxx/config/postlude.hpp b/src/bsoncxx/include/bsoncxx/v_noabi/bsoncxx/config/postlude.hpp index 2d18d353f3..23cdfd14a3 100644 --- a/src/bsoncxx/include/bsoncxx/v_noabi/bsoncxx/config/postlude.hpp +++ b/src/bsoncxx/include/bsoncxx/v_noabi/bsoncxx/config/postlude.hpp @@ -12,6 +12,16 @@ // See the License for the specific language governing permissions and // limitations under the License. +/// +/// @file bsoncxx/v_noabi/bsoncxx/config/postlude.hpp +/// +/// Macro guard postlude header for bsoncxx. +/// +/// Guards config macros defined and used by v_noabi headers. +/// +/// @sa bsoncxx/v1/bsoncxx/config/postlude.hpp +/// + // compiler.hpp #undef BSONCXX_INLINE #pragma pop_macro("BSONCXX_INLINE") diff --git a/src/bsoncxx/include/bsoncxx/v_noabi/bsoncxx/config/prelude.hpp b/src/bsoncxx/include/bsoncxx/v_noabi/bsoncxx/config/prelude.hpp index b5c0432b87..59c8de43bc 100644 --- a/src/bsoncxx/include/bsoncxx/v_noabi/bsoncxx/config/prelude.hpp +++ b/src/bsoncxx/include/bsoncxx/v_noabi/bsoncxx/config/prelude.hpp @@ -12,6 +12,27 @@ // See the License for the specific language governing permissions and // limitations under the License. +/// +/// @file bsoncxx/v_noabi/bsoncxx/config/prelude.hpp +/// +/// Macro guard prelude header for bsoncxx. +/// +/// Guards config macros defined and used by v_noabi headers. +/// +/// @note For backward compatibility, correct include of macro guard headers is not enforced (e.g. +/// missing include of the postlude header prior to a another include of the prelude header). +/// +/// @note For backward compatibility, the `BSONCXX_ENUM` X macro is also guarded. +/// +/// @sa bsoncxx/v1/bsoncxx/config/prelude.hpp +/// +/// @par Includes +/// @li bsoncxx/v_noabi/bsoncxx/config/compiler.hpp +/// @li bsoncxx/v_noabi/bsoncxx/config/config.hpp +/// @li bsoncxx/v_noabi/bsoncxx/config/export.hpp +/// @li bsoncxx/v_noabi/bsoncxx/config/version.hpp +/// + // compiler.hpp #pragma push_macro("BSONCXX_INLINE") #undef BSONCXX_INLINE @@ -32,16 +53,6 @@ #pragma push_macro("BSONCXX_POLY_USE_BOOST") #undef BSONCXX_POLY_USE_BOOST -// version.hpp (generated by CMake) -#pragma push_macro("BSONCXX_VERSION_EXTRA") -#undef BSONCXX_VERSION_EXTRA -#pragma push_macro("BSONCXX_VERSION_MAJOR") -#undef BSONCXX_VERSION_MAJOR -#pragma push_macro("BSONCXX_VERSION_MINOR") -#undef BSONCXX_VERSION_MINOR -#pragma push_macro("BSONCXX_VERSION_PATCH") -#undef BSONCXX_VERSION_PATCH - // export.hpp (generated by CMake) #pragma push_macro("BSONCXX_API_H") #undef BSONCXX_API_H @@ -60,6 +71,16 @@ #pragma push_macro("BSONCXX_NO_DEPRECATED") #undef BSONCXX_NO_DEPRECATED +// version.hpp (generated by CMake) +#pragma push_macro("BSONCXX_VERSION_EXTRA") +#undef BSONCXX_VERSION_EXTRA +#pragma push_macro("BSONCXX_VERSION_MAJOR") +#undef BSONCXX_VERSION_MAJOR +#pragma push_macro("BSONCXX_VERSION_MINOR") +#undef BSONCXX_VERSION_MINOR +#pragma push_macro("BSONCXX_VERSION_PATCH") +#undef BSONCXX_VERSION_PATCH + #include #include #include @@ -67,6 +88,7 @@ #pragma push_macro("BSONCXX_UNREACHABLE") #undef BSONCXX_UNREACHABLE +/// Call `std::abort()` if control flow enters this code path. #define BSONCXX_UNREACHABLE std::abort() // CXX-2769: out-of-place, but remains for backward compatibility. @@ -76,17 +98,8 @@ // Doxygen does not account for generated header files. // Document globally applicable macros and namespaces here. -/// -/// @namespace bsoncxx -/// The top-level namespace for bsoncxx library entities. -/// - -/// /// @namespace bsoncxx::v_noabi /// Entities declared in this namespace do not have a stable ABI. -/// -/// /// @namespace bsoncxx::v_noabi::stdx /// Declares polyfills for C++17 forward compatibility. -/// diff --git a/src/bsoncxx/include/bsoncxx/v_noabi/bsoncxx/config/version.hpp b/src/bsoncxx/include/bsoncxx/v_noabi/bsoncxx/config/version.hpp new file mode 100644 index 0000000000..9a06e609a6 --- /dev/null +++ b/src/bsoncxx/include/bsoncxx/v_noabi/bsoncxx/config/version.hpp @@ -0,0 +1,24 @@ +// Copyright 2023 MongoDB Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/// +/// @file bsoncxx/v_noabi/bsoncxx/config/version.hpp +/// +/// Remains for backward compatibility. +/// +/// @par Includes +/// @li @ref bsoncxx-v1-bsoncxx-config-version-hpp "bsoncxx/v1/bsoncxx/config/version.hpp" +/// + +#include diff --git a/src/bsoncxx/lib/CMakeLists.txt b/src/bsoncxx/lib/CMakeLists.txt index 4b528dda20..46bc45541b 100644 --- a/src/bsoncxx/lib/CMakeLists.txt +++ b/src/bsoncxx/lib/CMakeLists.txt @@ -17,6 +17,10 @@ list(APPEND bsoncxx_sources bsoncxx/v_noabi/bsoncxx/array/value.cpp bsoncxx/v_noabi/bsoncxx/array/view.cpp bsoncxx/v_noabi/bsoncxx/builder/core.cpp + bsoncxx/v_noabi/bsoncxx/config/compiler.cpp + bsoncxx/v_noabi/bsoncxx/config/config.cpp + bsoncxx/v_noabi/bsoncxx/config/export.cpp + bsoncxx/v_noabi/bsoncxx/config/version.cpp bsoncxx/v_noabi/bsoncxx/decimal128.cpp bsoncxx/v_noabi/bsoncxx/document/element.cpp bsoncxx/v_noabi/bsoncxx/document/value.cpp @@ -30,6 +34,10 @@ list(APPEND bsoncxx_sources bsoncxx/v_noabi/bsoncxx/types/bson_value/value.cpp bsoncxx/v_noabi/bsoncxx/types/bson_value/view.cpp bsoncxx/v_noabi/bsoncxx/validate.cpp + bsoncxx/v1/bsoncxx/config/compiler.cpp + bsoncxx/v1/bsoncxx/config/config.cpp + bsoncxx/v1/bsoncxx/config/export.cpp + bsoncxx/v1/bsoncxx/config/version.cpp ) list(TRANSFORM bsoncxx_sources PREPEND "${CMAKE_CURRENT_SOURCE_DIR}/") set(bsoncxx_sources "${bsoncxx_sources}" PARENT_SCOPE) @@ -45,19 +53,19 @@ endif() # Generate and install public headers. if(1) configure_file( - bsoncxx/v_noabi/bsoncxx/config/config.hpp.in - bsoncxx/v_noabi/bsoncxx/config/config.hpp + bsoncxx/v1/bsoncxx/config/config.hpp.in + bsoncxx/v1/bsoncxx/config/config.hpp ) configure_file( - bsoncxx/v_noabi/bsoncxx/config/version.hpp.in - bsoncxx/v_noabi/bsoncxx/config/version.hpp + bsoncxx/v1/bsoncxx/config/version.hpp.in + bsoncxx/v1/bsoncxx/config/version.hpp ) install(FILES - ${CMAKE_CURRENT_BINARY_DIR}/bsoncxx/v_noabi/bsoncxx/config/config.hpp - ${CMAKE_CURRENT_BINARY_DIR}/bsoncxx/v_noabi/bsoncxx/config/version.hpp - DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/bsoncxx/v_noabi/bsoncxx/config + ${CMAKE_CURRENT_BINARY_DIR}/bsoncxx/v1/bsoncxx/config/config.hpp + ${CMAKE_CURRENT_BINARY_DIR}/bsoncxx/v1/bsoncxx/config/version.hpp + DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/bsoncxx/v1/bsoncxx/config COMPONENT dev ) endif() @@ -68,11 +76,13 @@ set_dist_list(src_bsoncxx_lib_DIST bsoncxx/v_noabi/bsoncxx/array/value.cpp bsoncxx/v_noabi/bsoncxx/array/view.cpp bsoncxx/v_noabi/bsoncxx/builder/core.cpp - bsoncxx/v_noabi/bsoncxx/config/config.hpp.in + bsoncxx/v_noabi/bsoncxx/config/compiler.cpp + bsoncxx/v_noabi/bsoncxx/config/config.cpp + bsoncxx/v_noabi/bsoncxx/config/export.cpp bsoncxx/v_noabi/bsoncxx/config/private/config.hh.in bsoncxx/v_noabi/bsoncxx/config/private/postlude.hh bsoncxx/v_noabi/bsoncxx/config/private/prelude.hh - bsoncxx/v_noabi/bsoncxx/config/version.hpp.in + bsoncxx/v_noabi/bsoncxx/config/version.cpp bsoncxx/v_noabi/bsoncxx/decimal128.cpp bsoncxx/v_noabi/bsoncxx/document/element.cpp bsoncxx/v_noabi/bsoncxx/document/value.cpp @@ -95,4 +105,10 @@ set_dist_list(src_bsoncxx_lib_DIST bsoncxx/v_noabi/bsoncxx/types/bson_value/view.cpp bsoncxx/v_noabi/bsoncxx/types/private/convert.hh bsoncxx/v_noabi/bsoncxx/validate.cpp + bsoncxx/v1/bsoncxx/config/compiler.cpp + bsoncxx/v1/bsoncxx/config/config.cpp + bsoncxx/v1/bsoncxx/config/config.hpp.in + bsoncxx/v1/bsoncxx/config/export.cpp + bsoncxx/v1/bsoncxx/config/version.cpp + bsoncxx/v1/bsoncxx/config/version.hpp.in ) diff --git a/src/bsoncxx/lib/bsoncxx/v1/bsoncxx/config/compiler.cpp b/src/bsoncxx/lib/bsoncxx/v1/bsoncxx/config/compiler.cpp new file mode 100644 index 0000000000..2911e09378 --- /dev/null +++ b/src/bsoncxx/lib/bsoncxx/v1/bsoncxx/config/compiler.cpp @@ -0,0 +1,23 @@ +// Copyright 2023 MongoDB Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#include + +#if !defined(BSONCXX_INLINE) +#error "BSONCXX_INLINE is not defined!" +#endif + +#if !defined(BSONCXX_CALL) +#error "BSONCXX_CALL is not defined!" +#endif diff --git a/src/bsoncxx/lib/bsoncxx/v1/bsoncxx/config/config.cpp b/src/bsoncxx/lib/bsoncxx/v1/bsoncxx/config/config.cpp new file mode 100644 index 0000000000..858f854a71 --- /dev/null +++ b/src/bsoncxx/lib/bsoncxx/v1/bsoncxx/config/config.cpp @@ -0,0 +1,21 @@ +// Copyright 2023 MongoDB Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#include + +#if !defined(BSONCXX_POLY_USE_MNMLSTC) && !defined(BSONCXX_POLY_USE_STD_EXPERIMENTAL) && \ + !defined(BSONCXX_POLY_USE_SYSTEM_MNMLSTC) && !defined(BSONCXX_POLY_USE_BOOST) && \ + !defined(BSONCXX_POLY_USE_STD) +#error "at least one bsoncxx polyfill library feature macro should be defined!" +#endif diff --git a/src/bsoncxx/lib/bsoncxx/v_noabi/bsoncxx/config/config.hpp.in b/src/bsoncxx/lib/bsoncxx/v1/bsoncxx/config/config.hpp.in similarity index 85% rename from src/bsoncxx/lib/bsoncxx/v_noabi/bsoncxx/config/config.hpp.in rename to src/bsoncxx/lib/bsoncxx/v1/bsoncxx/config/config.hpp.in index e4a2a6704c..990cc56847 100644 --- a/src/bsoncxx/lib/bsoncxx/v_noabi/bsoncxx/config/config.hpp.in +++ b/src/bsoncxx/lib/bsoncxx/v1/bsoncxx/config/config.hpp.in @@ -17,6 +17,3 @@ #cmakedefine BSONCXX_POLY_USE_SYSTEM_MNMLSTC #cmakedefine BSONCXX_POLY_USE_BOOST #cmakedefine BSONCXX_POLY_USE_STD - -#define BSONCXX_INLINE_NAMESPACE_BEGIN inline namespace v_noabi { -#define BSONCXX_INLINE_NAMESPACE_END } // namespace v_noabi diff --git a/src/bsoncxx/lib/bsoncxx/v1/bsoncxx/config/export.cpp b/src/bsoncxx/lib/bsoncxx/v1/bsoncxx/config/export.cpp new file mode 100644 index 0000000000..44c75cb892 --- /dev/null +++ b/src/bsoncxx/lib/bsoncxx/v1/bsoncxx/config/export.cpp @@ -0,0 +1,39 @@ +// Copyright 2023 MongoDB Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#include + +#if !defined(BSONCXX_API_H) +#error "BSONCXX_API_H is not defined!" +#endif + +#if !defined(BSONCXX_API) +#error "BSONCXX_API is not defined!" +#endif + +#if !defined(BSONCXX_PRIVATE) +#error "BSONCXX_PRIVATE is not defined!" +#endif + +#if !defined(BSONCXX_DEPRECATED) +#error "BSONCXX_DEPRECATED is not defined!" +#endif + +#if !defined(BSONCXX_DEPRECATED_EXPORT) +#error "BSONCXX_DEPRECATED_EXPORT is not defined!" +#endif + +#if !defined(BSONCXX_DEPRECATED_NO_EXPORT) +#error "BSONCXX_DEPRECATED_NO_EXPORT is not defined!" +#endif diff --git a/src/bsoncxx/lib/bsoncxx/v1/bsoncxx/config/version.cpp b/src/bsoncxx/lib/bsoncxx/v1/bsoncxx/config/version.cpp new file mode 100644 index 0000000000..210bb3c0f1 --- /dev/null +++ b/src/bsoncxx/lib/bsoncxx/v1/bsoncxx/config/version.cpp @@ -0,0 +1,31 @@ +// Copyright 2023 MongoDB Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#include + +#if !defined(BSONCXX_VERSION_MAJOR) +#error "BSONCXX_VERSION_MAJOR is not defined!" +#endif + +#if !defined(BSONCXX_VERSION_MINOR) +#error "BSONCXX_VERSION_MINOR is not defined!" +#endif + +#if !defined(BSONCXX_VERSION_PATCH) +#error "BSONCXX_VERSION_PATCH is not defined!" +#endif + +#if !defined(BSONCXX_VERSION_EXTRA) +#error "BSONCXX_VERSION_EXTRA is not defined!" +#endif diff --git a/src/bsoncxx/lib/bsoncxx/v_noabi/bsoncxx/config/version.hpp.in b/src/bsoncxx/lib/bsoncxx/v1/bsoncxx/config/version.hpp.in similarity index 100% rename from src/bsoncxx/lib/bsoncxx/v_noabi/bsoncxx/config/version.hpp.in rename to src/bsoncxx/lib/bsoncxx/v1/bsoncxx/config/version.hpp.in diff --git a/src/mongocxx/lib/mongocxx/v_noabi/mongocxx/config/config.hpp.in b/src/bsoncxx/lib/bsoncxx/v_noabi/bsoncxx/config/compiler.cpp similarity index 71% rename from src/mongocxx/lib/mongocxx/v_noabi/mongocxx/config/config.hpp.in rename to src/bsoncxx/lib/bsoncxx/v_noabi/bsoncxx/config/compiler.cpp index c43b6f4285..cea3e78bad 100644 --- a/src/mongocxx/lib/mongocxx/v_noabi/mongocxx/config/config.hpp.in +++ b/src/bsoncxx/lib/bsoncxx/v_noabi/bsoncxx/config/compiler.cpp @@ -1,4 +1,4 @@ -// Copyright 2014 MongoDB Inc. +// Copyright 2023 MongoDB Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -12,5 +12,12 @@ // See the License for the specific language governing permissions and // limitations under the License. -#define MONGOCXX_INLINE_NAMESPACE_BEGIN inline namespace v_noabi { -#define MONGOCXX_INLINE_NAMESPACE_END } // namespace v_noabi +#include + +#if !defined(BSONCXX_INLINE) +#error "BSONCXX_INLINE is not defined!" +#endif + +#if !defined(BSONCXX_CALL) +#error "BSONCXX_CALL is not defined!" +#endif diff --git a/src/bsoncxx/lib/bsoncxx/v_noabi/bsoncxx/config/config.cpp b/src/bsoncxx/lib/bsoncxx/v_noabi/bsoncxx/config/config.cpp new file mode 100644 index 0000000000..50c67f7087 --- /dev/null +++ b/src/bsoncxx/lib/bsoncxx/v_noabi/bsoncxx/config/config.cpp @@ -0,0 +1,29 @@ +// Copyright 2023 MongoDB Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#include + +#if !defined(BSONCXX_INLINE_NAMESPACE_BEGIN) +#error "BSONCXX_INLINE_NAMESPACE_BEGIN is not defined!" +#endif + +#if !defined(BSONCXX_INLINE_NAMESPACE_END) +#error "BSONCXX_INLINE_NAMESPACE_END is not defined!" +#endif + +#if !defined(BSONCXX_POLY_USE_MNMLSTC) && !defined(BSONCXX_POLY_USE_STD_EXPERIMENTAL) && \ + !defined(BSONCXX_POLY_USE_SYSTEM_MNMLSTC) && !defined(BSONCXX_POLY_USE_BOOST) && \ + !defined(BSONCXX_POLY_USE_STD) +#error "at least one bsoncxx polyfill library feature macro should be defined!" +#endif diff --git a/src/bsoncxx/lib/bsoncxx/v_noabi/bsoncxx/config/export.cpp b/src/bsoncxx/lib/bsoncxx/v_noabi/bsoncxx/config/export.cpp new file mode 100644 index 0000000000..bc6d78560d --- /dev/null +++ b/src/bsoncxx/lib/bsoncxx/v_noabi/bsoncxx/config/export.cpp @@ -0,0 +1,39 @@ +// Copyright 2023 MongoDB Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#include + +#if !defined(BSONCXX_API_H) +#error "BSONCXX_API_H is not defined!" +#endif + +#if !defined(BSONCXX_API) +#error "BSONCXX_API is not defined!" +#endif + +#if !defined(BSONCXX_PRIVATE) +#error "BSONCXX_PRIVATE is not defined!" +#endif + +#if !defined(BSONCXX_DEPRECATED) +#error "BSONCXX_DEPRECATED is not defined!" +#endif + +#if !defined(BSONCXX_DEPRECATED_EXPORT) +#error "BSONCXX_DEPRECATED_EXPORT is not defined!" +#endif + +#if !defined(BSONCXX_DEPRECATED_NO_EXPORT) +#error "BSONCXX_DEPRECATED_NO_EXPORT is not defined!" +#endif diff --git a/src/bsoncxx/lib/bsoncxx/v_noabi/bsoncxx/config/version.cpp b/src/bsoncxx/lib/bsoncxx/v_noabi/bsoncxx/config/version.cpp new file mode 100644 index 0000000000..7629ddcb5c --- /dev/null +++ b/src/bsoncxx/lib/bsoncxx/v_noabi/bsoncxx/config/version.cpp @@ -0,0 +1,31 @@ +// Copyright 2023 MongoDB Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#include + +#if !defined(BSONCXX_VERSION_MAJOR) +#error "BSONCXX_VERSION_MAJOR is not defined!" +#endif + +#if !defined(BSONCXX_VERSION_MINOR) +#error "BSONCXX_VERSION_MINOR is not defined!" +#endif + +#if !defined(BSONCXX_VERSION_PATCH) +#error "BSONCXX_VERSION_PATCH is not defined!" +#endif + +#if !defined(BSONCXX_VERSION_EXTRA) +#error "BSONCXX_VERSION_EXTRA is not defined!" +#endif diff --git a/src/bsoncxx/test/CMakeLists.txt b/src/bsoncxx/test/CMakeLists.txt index b505b81356..9c3e563068 100644 --- a/src/bsoncxx/test/CMakeLists.txt +++ b/src/bsoncxx/test/CMakeLists.txt @@ -83,14 +83,14 @@ if(ENABLE_MACRO_GUARD_TESTS) BSONCXX_VERSION_MAJOR BSONCXX_VERSION_MINOR BSONCXX_VERSION_PATCH - BSONCXX_API_H # export.hpp (generated by CMake) + BSONCXX_API_H # v1 export.hpp (generated by CMake) BSONCXX_API BSONCXX_PRIVATE BSONCXX_DEPRECATED BSONCXX_DEPRECATED_EXPORT BSONCXX_DEPRECATED_NO_EXPORT - DEFINE_NO_DEPRECATED - BSONCXX_NO_DEPRECATED + DEFINE_NO_DEPRECATED # CXX-2770: unused, but still guarded. + BSONCXX_NO_DEPRECATED # CXX-2770: unused, but still guarded. BSONCXX_UNREACHABLE # prelude.hpp INCLUDE_PATTERNS "include/*.hpp" # Public headers. diff --git a/src/mongocxx/CMakeLists.txt b/src/mongocxx/CMakeLists.txt index 4fe323f6d6..9618d5ade4 100644 --- a/src/mongocxx/CMakeLists.txt +++ b/src/mongocxx/CMakeLists.txt @@ -105,13 +105,13 @@ if(1) BASE_NAME MONGOCXX EXPORT_MACRO_NAME MONGOCXX_API NO_EXPORT_MACRO_NAME MONGOCXX_PRIVATE - EXPORT_FILE_NAME ${PROJECT_BINARY_DIR}/lib/mongocxx/v_noabi/mongocxx/config/export.hpp + EXPORT_FILE_NAME ${PROJECT_BINARY_DIR}/lib/mongocxx/v1/mongocxx/config/export.hpp STATIC_DEFINE MONGOCXX_STATIC ) install(FILES - ${PROJECT_BINARY_DIR}/lib/mongocxx/v_noabi/mongocxx/config/export.hpp - DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/mongocxx/v_noabi/mongocxx/config + ${PROJECT_BINARY_DIR}/lib/mongocxx/v1/mongocxx/config/export.hpp + DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/mongocxx/v1/mongocxx/config COMPONENT dev ) endfunction() diff --git a/src/mongocxx/include/CMakeLists.txt b/src/mongocxx/include/CMakeLists.txt index a6b686dbbb..a98e24a494 100644 --- a/src/mongocxx/include/CMakeLists.txt +++ b/src/mongocxx/include/CMakeLists.txt @@ -27,8 +27,11 @@ set_dist_list(src_mongocxx_include_DIST mongocxx/v_noabi/mongocxx/client.hpp mongocxx/v_noabi/mongocxx/collection.hpp mongocxx/v_noabi/mongocxx/config/compiler.hpp + mongocxx/v_noabi/mongocxx/config/config.hpp + mongocxx/v_noabi/mongocxx/config/export.hpp mongocxx/v_noabi/mongocxx/config/postlude.hpp mongocxx/v_noabi/mongocxx/config/prelude.hpp + mongocxx/v_noabi/mongocxx/config/version.hpp mongocxx/v_noabi/mongocxx/cursor.hpp mongocxx/v_noabi/mongocxx/database.hpp mongocxx/v_noabi/mongocxx/events/command_failed_event.hpp @@ -123,4 +126,7 @@ set_dist_list(src_mongocxx_include_DIST mongocxx/v_noabi/mongocxx/validation_criteria.hpp mongocxx/v_noabi/mongocxx/write_concern.hpp mongocxx/v_noabi/mongocxx/write_type.hpp + mongocxx/v1/mongocxx/config/compiler.hpp + mongocxx/v1/mongocxx/config/postlude.hpp + mongocxx/v1/mongocxx/config/prelude.hpp ) diff --git a/src/mongocxx/include/mongocxx/v1/mongocxx/config/compiler.hpp b/src/mongocxx/include/mongocxx/v1/mongocxx/config/compiler.hpp new file mode 100644 index 0000000000..38493db617 --- /dev/null +++ b/src/mongocxx/include/mongocxx/v1/mongocxx/config/compiler.hpp @@ -0,0 +1,42 @@ +// Copyright 2023 MongoDB Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/// +/// @file mongocxx/v1/mongocxx/config/compiler.hpp +/// +/// Declares macros that control compiler-specific behavior. +/// +/// @par Platform-Specific Behavior +/// Including this header disables MSVC warnings C4251 and C4275 via `#pragma warning(push)`. This +/// change is reverted by the postlude header via `#pragma warning(pop)`. +/// + +/// +/// The declared entity is a member of the public API but is excluded from ABI stability guarantees. +/// +#define MONGOCXX_INLINE inline MONGOCXX_PRIVATE + +/// +/// @def MONGOCXX_CALL +/// Ensure the declared entity uses naming and calling conventions for C and C++. +/// +#if defined(_MSC_VER) +// Disable MSVC warnings that cause a lot of noise related to DLL visibility +// for types that we don't control (like std::unique_ptr). +#pragma warning(push) +#pragma warning(disable : 4251 4275) +#define MONGOCXX_CALL __cdecl +#else +#define MONGOCXX_CALL +#endif diff --git a/src/mongocxx/include/mongocxx/v1/mongocxx/config/postlude.hpp b/src/mongocxx/include/mongocxx/v1/mongocxx/config/postlude.hpp new file mode 100644 index 0000000000..867f7482f5 --- /dev/null +++ b/src/mongocxx/include/mongocxx/v1/mongocxx/config/postlude.hpp @@ -0,0 +1,75 @@ +// Copyright 2023 MongoDB Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/// +/// @file mongocxx/v1/mongocxx/config/postlude.hpp +/// +/// Macro guard postlude header for mongocxx. +/// +/// Ensures any config macro defined in config headers do not leak their definition after inclusion. +/// +/// Restores prior definitions of conflicting macros that are guarded by the @ref +/// mongocxx/v1/mongocxx/config/prelude.hpp "matching prelude header". +/// +/// @warning Include of the postlude header must be preceeded by a matching include of the prelude +/// header. +/// +/// @note Include of the postlude header may be omitted if restoring prior definitions of +/// conflicting macros is not necessary, e.g. in source (.cpp) files. +/// +/// @par Includes +/// @li bsoncxx/v1/bsoncxx/config/postlude.hpp. +/// + +// compiler.hpp +#undef MONGOCXX_INLINE +#pragma pop_macro("MONGOCXX_INLINE") +#if defined(_MSC_VER) +#pragma warning(pop) +#endif +#undef MONGOCXX_CALL +#pragma pop_macro("MONGOCXX_CALL") + +// export.hpp (generated by CMake) +#undef MONGOCXX_API_H +#pragma pop_macro("MONGOCXX_API_H") +#undef MONGOCXX_API +#pragma pop_macro("MONGOCXX_API") +#undef MONGOCXX_PRIVATE +#pragma pop_macro("MONGOCXX_PRIVATE") +#undef MONGOCXX_DEPRECATED +#pragma pop_macro("MONGOCXX_DEPRECATED") +#undef MONGOCXX_DEPRECATED_EXPORT +#pragma pop_macro("MONGOCXX_DEPRECATED_EXPORT") +#undef MONGOCXX_DEPRECATED_NO_EXPORT +#pragma pop_macro("MONGOCXX_DEPRECATED_NO_EXPORT") + +// version.hpp (generated by CMake) +#undef MONGOCXX_VERSION_STRING +#pragma pop_macro("MONGOCXX_VERSION_STRING") +#undef MONGOCXX_VERSION_EXTRA +#pragma pop_macro("MONGOCXX_VERSION_EXTRA") +#undef MONGOCXX_VERSION_MAJOR +#pragma pop_macro("MONGOCXX_VERSION_MAJOR") +#undef MONGOCXX_VERSION_MINOR +#pragma pop_macro("MONGOCXX_VERSION_MINOR") +#undef MONGOCXX_VERSION_PATCH +#pragma pop_macro("MONGOCXX_VERSION_PATCH") + +#if !defined(MONGOCXX_V1_INSIDE_MACRO_GUARD_SCOPE) +#error "postlude header included without matching prelude header" +#endif +#undef MONGOCXX_V1_INSIDE_MACRO_GUARD_SCOPE + +#include diff --git a/src/mongocxx/include/mongocxx/v1/mongocxx/config/prelude.hpp b/src/mongocxx/include/mongocxx/v1/mongocxx/config/prelude.hpp new file mode 100644 index 0000000000..fe65aee2ee --- /dev/null +++ b/src/mongocxx/include/mongocxx/v1/mongocxx/config/prelude.hpp @@ -0,0 +1,139 @@ +// Copyright 2023 MongoDB Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/// +/// @file mongocxx/v1/mongocxx/config/prelude.hpp +/// +/// Macro guard prelude header for mongocxx. +/// +/// Ensures any config macro defined in config headers do not conflict with existing definitions +/// prior to inclusion. To obtain config macros without macro guard behavior, include the +/// corresponding config header directly. +/// +/// Prior definitions of conflicting macros are restored by including the @ref +/// mongocxx/v1/mongocxx/config/postlude.hpp "matching postlude header". +/// +/// @warning Include of the prelude header twice in a row without a matching include of the postlude +/// header for the first include is forbidden (e.g. prelude -> prelude -> postlude -> postlude). +/// This is to enforce correct use of macro guard headers across transitive includes. +/// +/// @warning Include of the postlude header must be preceeded by a matching include of the prelude +/// header. +/// +/// @note Include of the matching postlude header may be omitted if restoring prior definitions of +/// conflicting macros is not necessary, e.g. in source (.cpp) files. +/// +/// @par Includes +/// @li bsoncxx/v1/bsoncxx/config/prelude.hpp +/// @li mongocxx/v1/mongocxx/config/compiler.hpp +/// @li @ref mongocxx-v1-mongocxx-config-export-hpp "mongocxx/v1/mongocxx/config/export.hpp" +/// @li @ref mongocxx-v1-mongocxx-config-version-hpp "mongocxx/v1/mongocxx/config/version.hpp" +/// + +#include + +#if defined(MONGOCXX_V1_INSIDE_MACRO_GUARD_SCOPE) +#error "prelude header included twice without matching postlude" +#endif + +/// Used to validate correct use of macro guard headers. +#define MONGOCXX_V1_INSIDE_MACRO_GUARD_SCOPE + +// compiler.hpp +#pragma push_macro("MONGOCXX_INLINE") +#undef MONGOCXX_INLINE +#pragma push_macro("MONGOCXX_CALL") +#undef MONGOCXX_CALL + +// export.hpp (generated by CMake) +#pragma push_macro("MONGOCXX_API_H") +#undef MONGOCXX_API_H +#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 + +// version.hpp (generated by CMake) +#pragma push_macro("MONGOCXX_VERSION_STRING") +#undef MONGOCXX_VERSION_STRING +#pragma push_macro("MONGOCXX_VERSION_EXTRA") +#undef MONGOCXX_VERSION_EXTRA +#pragma push_macro("MONGOCXX_VERSION_MAJOR") +#undef MONGOCXX_VERSION_MAJOR +#pragma push_macro("MONGOCXX_VERSION_MINOR") +#undef MONGOCXX_VERSION_MINOR +#pragma push_macro("MONGOCXX_VERSION_PATCH") +#undef MONGOCXX_VERSION_PATCH + +#include +#include +#include + +// Doxygen does not account for generated header files. +// Document globally applicable macros and namespaces here. + +// Doxygen complains if it cannot find at least one `#define` of a documented macro. Use dummy +// `#define` for macros in generated config headers within this block to satisfy Doxygen. +#if defined(MONGOCXX_SATISFY_DOXYGEN_DEFINES) +/// @defgroup mongocxx-v1-mongocxx-config-export-hpp mongocxx/v1/mongocxx/config/export.hpp +/// A generated config header declaring macros that control symbol export behavior. +/// @sa bsoncxx/v1/bsoncxx/config/prelude.hpp +/// @{ + +/// Header guard macro generated by CMake. +#define MONGOCXX_API_H +/// The declared entity is a member of the public API. +#define MONGOCXX_API +/// The declared entity is excluded from the public API. +#define MONGOCXX_PRIVATE +/// The declared entity is deprecated. +#define MONGOCXX_DEPRECATED +/// The declared entity is a deprecated member of the public API. +#define MONGOCXX_DEPRECATED_EXPORT +/// The declared entity is deprecated and excluded from the public API. +#define MONGOCXX_DEPRECATED_NO_EXPORT + +/// @} + +/// @defgroup mongocxx-v1-mongocxx-config-version-hpp mongocxx/v1/mongocxx/config/version.hpp +/// A generated config header declaring macros describing the mongocxx library API version number. +/// @sa mongocxx/v1/mongocxx/config/prelude.hpp +/// @{ + +/// A string literal denoting the full API version number for this mongocxx library. +#define MONGOCXX_VERSION_STRING +/// The API major version number for this mongocxx library. +#define MONGOCXX_VERSION_MAJOR +/// The API minor version number for this mongocxx library. +#define MONGOCXX_VERSION_MINOR +/// The API patch version number for this mongocxx library. +#define MONGOCXX_VERSION_PATCH +/// Additional API version labels for this mongocxx library. +#define MONGOCXX_VERSION_EXTRA + +/// @} + +#endif // defined(MONGOCXX_SATISFY_DOXYGEN_DEFINES) + +/// @namespace mongocxx +/// The top-level namespace for mongocxx library entities. + +/// @namespace mongocxx::v1 +/// Declares entities compatible with stable ABI version 1. diff --git a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/config/compiler.hpp b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/config/compiler.hpp index c9dffc8328..fe2be96a0b 100644 --- a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/config/compiler.hpp +++ b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/config/compiler.hpp @@ -12,23 +12,13 @@ // See the License for the specific language governing permissions and // limitations under the License. -// TODO: DRY this definition with the one from bsoncxx/config/compiler.hpp per discussion -// here - https://github.com/mongodb/mongo-cxx-driver/pull/374#issuecomment-158179295 -#if defined(_MSC_VER) - -// Disable MSVC warnings that cause a lot of noise related to DLL visibility -// for types that we don't control (like std::unique_ptr). -#pragma warning(push) -#pragma warning(disable : 4251 4275) - -#define MONGOCXX_INLINE inline MONGOCXX_PRIVATE - -#define MONGOCXX_CALL __cdecl - -#else - -#define MONGOCXX_INLINE inline MONGOCXX_PRIVATE - -#define MONGOCXX_CALL - -#endif +/// +/// @file mongocxx/v_noabi/mongocxx/config/compiler.hpp +/// +/// Remains for backward compatibility. +/// +/// @par Includes +/// @li mongocxx/v1/mongocxx/config/compiler.hpp +/// + +#include diff --git a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/config/config.hpp b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/config/config.hpp new file mode 100644 index 0000000000..5063811519 --- /dev/null +++ b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/config/config.hpp @@ -0,0 +1,30 @@ +// Copyright 2014 MongoDB Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/// +/// @file mongocxx/v_noabi/mongocxx/config/config.hpp +/// +/// Remains for backward compatibility. +/// + +/// +/// Begins the declaration of entities in the unstable ABI namespace `v_noabi`. +/// @deprecated This macro is no longer used to declare the `v_noabi` namespace. +/// +#define MONGOCXX_INLINE_NAMESPACE_BEGIN inline namespace v_noabi { +/// +/// Ends the declaration of entities in the unstable ABI namespace `v_noabi`. +/// @deprecated This macro is no longer used to declare the `v_noabi` namespace. +/// +#define MONGOCXX_INLINE_NAMESPACE_END } // namespace v_noabi diff --git a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/config/export.hpp b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/config/export.hpp new file mode 100644 index 0000000000..630ffd726d --- /dev/null +++ b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/config/export.hpp @@ -0,0 +1,24 @@ +// Copyright 2023 MongoDB Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/// +/// @file mongocxx/v_noabi/mongocxx/config/export.hpp +/// +/// Remains for backward compatibility. +/// +/// @par Includes +/// @li @ref mongocxx-v1-mongocxx-config-export-hpp "mongocxx/v1/mongocxx/config/export.hpp" +/// + +#include diff --git a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/config/postlude.hpp b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/config/postlude.hpp index 2a81f3530a..092e2cb83a 100644 --- a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/config/postlude.hpp +++ b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/config/postlude.hpp @@ -12,6 +12,16 @@ // See the License for the specific language governing permissions and // limitations under the License. +/// +/// @file mongocxx/v_noabi/mongocxx/config/postlude.hpp +/// +/// Macro guard postlude header for mongocxx. +/// +/// Guards config macros defined and used by v_noabi headers. +/// +/// @sa mongocxx/v1/mongocxx/config/postlude.hpp +/// + // compiler.hpp #undef MONGOCXX_INLINE #pragma pop_macro("MONGOCXX_INLINE") @@ -27,18 +37,6 @@ #undef MONGOCXX_INLINE_NAMESPACE_END #pragma pop_macro("MONGOCXX_INLINE_NAMESPACE_END") -// version.hpp (generated by CMake) -#undef MONGOCXX_VERSION_STRING -#pragma pop_macro("MONGOCXX_VERSION_STRING") -#undef MONGOCXX_VERSION_EXTRA -#pragma pop_macro("MONGOCXX_VERSION_EXTRA") -#undef MONGOCXX_VERSION_MAJOR -#pragma pop_macro("MONGOCXX_VERSION_MAJOR") -#undef MONGOCXX_VERSION_MINOR -#pragma pop_macro("MONGOCXX_VERSION_MINOR") -#undef MONGOCXX_VERSION_PATCH -#pragma pop_macro("MONGOCXX_VERSION_PATCH") - // export.hpp (generated by CMake) #undef MONGOCXX_API_H #pragma pop_macro("MONGOCXX_API_H") @@ -57,6 +55,18 @@ #undef MONGOCXX_NO_DEPRECATED #pragma pop_macro("MONGOCXX_NO_DEPRECATED") +// version.hpp (generated by CMake) +#undef MONGOCXX_VERSION_STRING +#pragma pop_macro("MONGOCXX_VERSION_STRING") +#undef MONGOCXX_VERSION_EXTRA +#pragma pop_macro("MONGOCXX_VERSION_EXTRA") +#undef MONGOCXX_VERSION_MAJOR +#pragma pop_macro("MONGOCXX_VERSION_MAJOR") +#undef MONGOCXX_VERSION_MINOR +#pragma pop_macro("MONGOCXX_VERSION_MINOR") +#undef MONGOCXX_VERSION_PATCH +#pragma pop_macro("MONGOCXX_VERSION_PATCH") + // prelude.hpp #undef MONGOCXX_UNREACHABLE #pragma pop_macro("MONGOCXX_UNREACHABLE") diff --git a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/config/prelude.hpp b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/config/prelude.hpp index 674bf835b5..c3521a1412 100644 --- a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/config/prelude.hpp +++ b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/config/prelude.hpp @@ -12,6 +12,25 @@ // See the License for the specific language governing permissions and // limitations under the License. +/// +/// @file mongocxx/v_noabi/mongocxx/config/prelude.hpp +/// +/// Macro guard prelude header for mongocxx. +/// +/// Guards config macros defined and used by v_noabi headers. +/// +/// @note For backward compatibility, correct include of macro guard headers is not enforced (e.g. +/// missing include of the postlude header prior to a another include of the prelude header). +/// +/// @sa mongocxx/v1/mongocxx/config/prelude.hpp +/// +/// @par Includes +/// @li mongocxx/v_noabi/mongocxx/config/compiler.hpp +/// @li mongocxx/v_noabi/mongocxx/config/config.hpp +/// @li mongocxx/v_noabi/mongocxx/config/export.hpp +/// @li mongocxx/v_noabi/mongocxx/config/version.hpp +/// + // compiler.hpp #pragma push_macro("MONGOCXX_INLINE") #undef MONGOCXX_INLINE @@ -24,18 +43,6 @@ #pragma push_macro("MONGOCXX_INLINE_NAMESPACE_END") #undef MONGOCXX_INLINE_NAMESPACE_END -// version.hpp (generated by CMake) -#pragma push_macro("MONGOCXX_VERSION_STRING") -#undef MONGOCXX_VERSION_STRING -#pragma push_macro("MONGOCXX_VERSION_EXTRA") -#undef MONGOCXX_VERSION_EXTRA -#pragma push_macro("MONGOCXX_VERSION_MAJOR") -#undef MONGOCXX_VERSION_MAJOR -#pragma push_macro("MONGOCXX_VERSION_MINOR") -#undef MONGOCXX_VERSION_MINOR -#pragma push_macro("MONGOCXX_VERSION_PATCH") -#undef MONGOCXX_VERSION_PATCH - // export.hpp (generated by CMake) #pragma push_macro("MONGOCXX_API_H") #undef MONGOCXX_API_H @@ -54,6 +61,18 @@ #pragma push_macro("MONGOCXX_NO_DEPRECATED") #undef MONGOCXX_NO_DEPRECATED +// version.hpp (generated by CMake) +#pragma push_macro("MONGOCXX_VERSION_STRING") +#undef MONGOCXX_VERSION_STRING +#pragma push_macro("MONGOCXX_VERSION_EXTRA") +#undef MONGOCXX_VERSION_EXTRA +#pragma push_macro("MONGOCXX_VERSION_MAJOR") +#undef MONGOCXX_VERSION_MAJOR +#pragma push_macro("MONGOCXX_VERSION_MINOR") +#undef MONGOCXX_VERSION_MINOR +#pragma push_macro("MONGOCXX_VERSION_PATCH") +#undef MONGOCXX_VERSION_PATCH + #include #include #include @@ -62,17 +81,11 @@ // TODO: Find a way to DRY this with BSONCXX_UNREACHABLE #pragma push_macro("MONGOCXX_UNREACHABLE") #undef MONGOCXX_UNREACHABLE +/// Call `std::abort()` if control flow enters this code path. #define MONGOCXX_UNREACHABLE std::abort() // Doxygen does not account for generated header files. // Document globally applicable macros and namespaces here. -/// -/// @namespace mongocxx -/// The top-level namespace for mongocxx library entities. -/// - -/// /// @namespace mongocxx::v_noabi /// Entities declared in this namespace do not have a stable ABI. -/// diff --git a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/config/version.hpp b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/config/version.hpp new file mode 100644 index 0000000000..a43c34f04b --- /dev/null +++ b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/config/version.hpp @@ -0,0 +1,24 @@ +// Copyright 2023 MongoDB Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/// +/// @file mongocxx/v_noabi/mongocxx/config/version.hpp +/// +/// Remains for backward compatibility. +/// +/// @par Includes +/// @li @ref mongocxx-v1-mongocxx-config-version-hpp "mongocxx/v1/mongocxx/config/version.hpp" +/// + +#include diff --git a/src/mongocxx/lib/CMakeLists.txt b/src/mongocxx/lib/CMakeLists.txt index 65e37e2c1f..d87b1c6d2f 100644 --- a/src/mongocxx/lib/CMakeLists.txt +++ b/src/mongocxx/lib/CMakeLists.txt @@ -20,6 +20,9 @@ list(APPEND mongocxx_sources mongocxx/v_noabi/mongocxx/client_session.cpp mongocxx/v_noabi/mongocxx/collection.cpp mongocxx/v_noabi/mongocxx/cursor.cpp + mongocxx/v_noabi/mongocxx/config/compiler.cpp + mongocxx/v_noabi/mongocxx/config/export.cpp + mongocxx/v_noabi/mongocxx/config/version.cpp mongocxx/v_noabi/mongocxx/database.cpp mongocxx/v_noabi/mongocxx/events/command_failed_event.cpp mongocxx/v_noabi/mongocxx/events/command_started_event.cpp @@ -106,6 +109,9 @@ list(APPEND mongocxx_sources mongocxx/v_noabi/mongocxx/uri.cpp mongocxx/v_noabi/mongocxx/validation_criteria.cpp mongocxx/v_noabi/mongocxx/write_concern.cpp + mongocxx/v1/mongocxx/config/compiler.cpp + mongocxx/v1/mongocxx/config/export.cpp + mongocxx/v1/mongocxx/config/version.cpp ) list(TRANSFORM mongocxx_sources PREPEND "${CMAKE_CURRENT_SOURCE_DIR}/") set(mongocxx_sources "${mongocxx_sources}" PARENT_SCOPE) @@ -133,19 +139,13 @@ endif() # Generate and install public headers. if(1) configure_file( - mongocxx/v_noabi/mongocxx/config/version.hpp.in - mongocxx/v_noabi/mongocxx/config/version.hpp - ) - - configure_file( - mongocxx/v_noabi/mongocxx/config/config.hpp.in - mongocxx/v_noabi/mongocxx/config/config.hpp + mongocxx/v1/mongocxx/config/version.hpp.in + mongocxx/v1/mongocxx/config/version.hpp ) install(FILES - ${CMAKE_CURRENT_BINARY_DIR}/mongocxx/v_noabi/mongocxx/config/config.hpp - ${CMAKE_CURRENT_BINARY_DIR}/mongocxx/v_noabi/mongocxx/config/version.hpp - DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/mongocxx/v_noabi/mongocxx/config + ${CMAKE_CURRENT_BINARY_DIR}/mongocxx/v1/mongocxx/config/version.hpp + DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/mongocxx/v1/mongocxx/config COMPONENT dev ) endif() @@ -158,11 +158,13 @@ set_dist_list(src_mongocxx_lib_DIST mongocxx/v_noabi/mongocxx/client_session.cpp mongocxx/v_noabi/mongocxx/client.cpp mongocxx/v_noabi/mongocxx/collection.cpp - mongocxx/v_noabi/mongocxx/config/config.hpp.in + mongocxx/v_noabi/mongocxx/config/compiler.cpp + mongocxx/v_noabi/mongocxx/config/config.cpp + mongocxx/v_noabi/mongocxx/config/export.cpp mongocxx/v_noabi/mongocxx/config/private/config.hh.in mongocxx/v_noabi/mongocxx/config/private/postlude.hh mongocxx/v_noabi/mongocxx/config/private/prelude.hh - mongocxx/v_noabi/mongocxx/config/version.hpp.in + mongocxx/v_noabi/mongocxx/config/version.cpp mongocxx/v_noabi/mongocxx/cursor.cpp mongocxx/v_noabi/mongocxx/database.cpp mongocxx/v_noabi/mongocxx/events/command_failed_event.cpp @@ -283,4 +285,8 @@ set_dist_list(src_mongocxx_lib_DIST mongocxx/v_noabi/mongocxx/uri.cpp mongocxx/v_noabi/mongocxx/validation_criteria.cpp mongocxx/v_noabi/mongocxx/write_concern.cpp + mongocxx/v1/mongocxx/config/compiler.cpp + mongocxx/v1/mongocxx/config/export.cpp + mongocxx/v1/mongocxx/config/version.cpp + mongocxx/v1/mongocxx/config/version.hpp.in ) diff --git a/src/mongocxx/lib/mongocxx/v1/mongocxx/config/compiler.cpp b/src/mongocxx/lib/mongocxx/v1/mongocxx/config/compiler.cpp new file mode 100644 index 0000000000..67ebd425ef --- /dev/null +++ b/src/mongocxx/lib/mongocxx/v1/mongocxx/config/compiler.cpp @@ -0,0 +1,23 @@ +// Copyright 2023 MongoDB Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#include + +#if !defined(MONGOCXX_INLINE) +#error "MONGOCXX_INLINE is not defined!" +#endif + +#if !defined(MONGOCXX_CALL) +#error "MONGOCXX_CALL is not defined!" +#endif diff --git a/src/mongocxx/lib/mongocxx/v1/mongocxx/config/export.cpp b/src/mongocxx/lib/mongocxx/v1/mongocxx/config/export.cpp new file mode 100644 index 0000000000..3ee1d85076 --- /dev/null +++ b/src/mongocxx/lib/mongocxx/v1/mongocxx/config/export.cpp @@ -0,0 +1,39 @@ +// Copyright 2023 MongoDB Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#include + +#if !defined(MONGOCXX_API_H) +#error "MONGOCXX_API_H is not defined!" +#endif + +#if !defined(MONGOCXX_API) +#error "MONGOCXX_API is not defined!" +#endif + +#if !defined(MONGOCXX_PRIVATE) +#error "MONGOCXX_PRIVATE is not defined!" +#endif + +#if !defined(MONGOCXX_DEPRECATED) +#error "MONGOCXX_DEPRECATED is not defined!" +#endif + +#if !defined(MONGOCXX_DEPRECATED_EXPORT) +#error "MONGOCXX_DEPRECATED_EXPORT is not defined!" +#endif + +#if !defined(MONGOCXX_DEPRECATED_NO_EXPORT) +#error "MONGOCXX_DEPRECATED_NO_EXPORT is not defined!" +#endif diff --git a/src/mongocxx/lib/mongocxx/v1/mongocxx/config/version.cpp b/src/mongocxx/lib/mongocxx/v1/mongocxx/config/version.cpp new file mode 100644 index 0000000000..70e9b6c013 --- /dev/null +++ b/src/mongocxx/lib/mongocxx/v1/mongocxx/config/version.cpp @@ -0,0 +1,35 @@ +// Copyright 2023 MongoDB Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#include + +#if !defined(MONGOCXX_VERSION_STRING) +#error "MONGOCXX_VERSION_STRING is not defined!" +#endif + +#if !defined(MONGOCXX_VERSION_MAJOR) +#error "MONGOCXX_VERSION_MAJOR is not defined!" +#endif + +#if !defined(MONGOCXX_VERSION_MINOR) +#error "MONGOCXX_VERSION_MINOR is not defined!" +#endif + +#if !defined(MONGOCXX_VERSION_PATCH) +#error "MONGOCXX_VERSION_PATCH is not defined!" +#endif + +#if !defined(MONGOCXX_VERSION_EXTRA) +#error "MONGOCXX_VERSION_EXTRA is not defined!" +#endif diff --git a/src/mongocxx/lib/mongocxx/v_noabi/mongocxx/config/version.hpp.in b/src/mongocxx/lib/mongocxx/v1/mongocxx/config/version.hpp.in similarity index 100% rename from src/mongocxx/lib/mongocxx/v_noabi/mongocxx/config/version.hpp.in rename to src/mongocxx/lib/mongocxx/v1/mongocxx/config/version.hpp.in diff --git a/src/mongocxx/lib/mongocxx/v_noabi/mongocxx/config/compiler.cpp b/src/mongocxx/lib/mongocxx/v_noabi/mongocxx/config/compiler.cpp new file mode 100644 index 0000000000..e2d819e051 --- /dev/null +++ b/src/mongocxx/lib/mongocxx/v_noabi/mongocxx/config/compiler.cpp @@ -0,0 +1,23 @@ +// Copyright 2023 MongoDB Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#include + +#if !defined(MONGOCXX_INLINE) +#error "MONGOCXX_INLINE is not defined!" +#endif + +#if !defined(MONGOCXX_CALL) +#error "MONGOCXX_CALL is not defined!" +#endif diff --git a/src/mongocxx/lib/mongocxx/v_noabi/mongocxx/config/config.cpp b/src/mongocxx/lib/mongocxx/v_noabi/mongocxx/config/config.cpp new file mode 100644 index 0000000000..363cdda733 --- /dev/null +++ b/src/mongocxx/lib/mongocxx/v_noabi/mongocxx/config/config.cpp @@ -0,0 +1,23 @@ +// Copyright 2023 MongoDB Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#include + +#if !defined(MONGOCXX_INLINE_NAMESPACE_BEGIN) +#error "MONGOCXX_INLINE_NAMESPACE_BEGIN is not defined!" +#endif + +#if !defined(MONGOCXX_INLINE_NAMESPACE_END) +#error "MONGOCXX_INLINE_NAMESPACE_END is not defined!" +#endif diff --git a/src/mongocxx/lib/mongocxx/v_noabi/mongocxx/config/export.cpp b/src/mongocxx/lib/mongocxx/v_noabi/mongocxx/config/export.cpp new file mode 100644 index 0000000000..0e0d0e9c41 --- /dev/null +++ b/src/mongocxx/lib/mongocxx/v_noabi/mongocxx/config/export.cpp @@ -0,0 +1,39 @@ +// Copyright 2023 MongoDB Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#include + +#if !defined(MONGOCXX_API_H) +#error "MONGOCXX_API_H is not defined!" +#endif + +#if !defined(MONGOCXX_API) +#error "MONGOCXX_API is not defined!" +#endif + +#if !defined(MONGOCXX_PRIVATE) +#error "MONGOCXX_PRIVATE is not defined!" +#endif + +#if !defined(MONGOCXX_DEPRECATED) +#error "MONGOCXX_DEPRECATED is not defined!" +#endif + +#if !defined(MONGOCXX_DEPRECATED_EXPORT) +#error "MONGOCXX_DEPRECATED_EXPORT is not defined!" +#endif + +#if !defined(MONGOCXX_DEPRECATED_NO_EXPORT) +#error "MONGOCXX_DEPRECATED_NO_EXPORT is not defined!" +#endif diff --git a/src/mongocxx/lib/mongocxx/v_noabi/mongocxx/config/version.cpp b/src/mongocxx/lib/mongocxx/v_noabi/mongocxx/config/version.cpp new file mode 100644 index 0000000000..78f17cfea9 --- /dev/null +++ b/src/mongocxx/lib/mongocxx/v_noabi/mongocxx/config/version.cpp @@ -0,0 +1,35 @@ +// Copyright 2023 MongoDB Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#include + +#if !defined(MONGOCXX_VERSION_STRING) +#error "MONGOCXX_VERSION_STRING is not defined!" +#endif + +#if !defined(MONGOCXX_VERSION_MAJOR) +#error "MONGOCXX_VERSION_MAJOR is not defined!" +#endif + +#if !defined(MONGOCXX_VERSION_MINOR) +#error "MONGOCXX_VERSION_MINOR is not defined!" +#endif + +#if !defined(MONGOCXX_VERSION_PATCH) +#error "MONGOCXX_VERSION_PATCH is not defined!" +#endif + +#if !defined(MONGOCXX_VERSION_EXTRA) +#error "MONGOCXX_VERSION_EXTRA is not defined!" +#endif diff --git a/src/mongocxx/test/CMakeLists.txt b/src/mongocxx/test/CMakeLists.txt index d9ec79e5db..9917f6585f 100644 --- a/src/mongocxx/test/CMakeLists.txt +++ b/src/mongocxx/test/CMakeLists.txt @@ -320,8 +320,8 @@ if(ENABLE_MACRO_GUARD_TESTS) MONGOCXX_DEPRECATED MONGOCXX_DEPRECATED_EXPORT MONGOCXX_DEPRECATED_NO_EXPORT - DEFINE_NO_DEPRECATED - MONGOCXX_NO_DEPRECATED + DEFINE_NO_DEPRECATED # CXX-2770: unused, but still guarded. + MONGOCXX_NO_DEPRECATED # CXX-2770: unused, but still guarded. MONGOCXX_UNREACHABLE # prelude.hpp MONGOCXX_ENABLE_SSL # config.hh (generated by CMake) MONGOCXX_COMPILER_ID