Skip to content

CXX-2814 Remove BSONCXX_POLY_USE_STD_EXPERIMENTAL from polyfill options #1089

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 2 commits into from
Jan 29, 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
8 changes: 0 additions & 8 deletions .evergreen/compile.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ set -o pipefail
: "${REQUIRED_CXX_STANDARD:-}"
: "${RUN_DISTCHECK:-}"
: "${USE_POLYFILL_BOOST:-}"
: "${USE_POLYFILL_STD_EXPERIMENTAL:-}"
: "${USE_SANITIZER_ASAN:-}"
: "${USE_SANITIZER_UBSAN:-}"
: "${USE_STATIC_LIBS:-}"
Expand Down Expand Up @@ -136,13 +135,6 @@ esac
export CMAKE_GENERATOR="${generator:?}"
export CMAKE_GENERATOR_PLATFORM="${platform:-}"

if [[ "${USE_POLYFILL_STD_EXPERIMENTAL:-}" == "ON" ]]; then
cmake_flags+=(
"-DCMAKE_CXX_STANDARD=14"
"-DBSONCXX_POLY_USE_STD_EXPERIMENTAL=ON"
)
fi

if [[ "${USE_POLYFILL_BOOST:-}" == "ON" ]]; then
cmake_flags+=("-DBSONCXX_POLY_USE_BOOST=ON")
fi
Expand Down
19 changes: 0 additions & 19 deletions .mci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -469,7 +469,6 @@ functions:
- REQUIRED_CXX_STANDARD
- RUN_DISTCHECK
- USE_POLYFILL_BOOST
- USE_POLYFILL_STD_EXPERIMENTAL
- USE_SANITIZER_ASAN
- USE_SANITIZER_UBSAN
- USE_STATIC_LIBS
Expand Down Expand Up @@ -1685,24 +1684,6 @@ buildvariants:
- name: build_example_with_add_subdirectory
- name: uninstall_check

# TODO CXX-2260 Upgrade std::experimental tasks to use Ubuntu 18.04 and mongodb_latest
# after bug fixes with newer g++ versions.
- name: ubuntu1604-debug-std-experimental
display_name: "Ubuntu 16.04 Debug (std::experimental) (MongoDB 4.4)"
expansions:
build_type: "Debug"
USE_POLYFILL_STD_EXPERIMENTAL: ON
mongodb_version: "4.4"
example_projects_cxx_standard: 14
use_mongocryptd: true # crypt_shared is not available for Ubuntu 16.04
run_on:
- ubuntu1604-build
tasks:
- name: compile_and_test_with_shared_libs
- name: compile_and_test_with_shared_libs_extra_alignment
- name: compile_and_test_with_static_libs
- name: compile_and_test_with_static_libs_extra_alignment

- name: ubuntu2004-debug-valgrind-latest
display_name: "Valgrind Ubuntu 20.04 Debug (MongoDB Latest)"
expansions:
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ Changes prior to 3.9.0 are documented as [release notes on GitHub](https://githu
Use `find_package(bsoncxx)` and `find_package(mongocxx)` instead.
- Accordingly, `LIBBSONCXX_*` and `LIBMONGOCXX_*` CMake variables provided by the legacy CMake package config files are no longer supported. Use the `mongo::bsoncxx_*` and `mongo::mongocxx_*` CMake targets instead.
- Note: manually setting compile definitions, include directories, and link libraries is unnecessary with target-based CMake. The former `LIBBSONCXX_*` and `LIBMONGOCXX_*` CMake variables are superseded by the `target_link_libraries()` CMake command, which automatically propagates the necessary compile definitions, include directories, and link libraries to dependent targets via `mongo::bsoncxx_*` and `mongo::mongocxx_*` interface properties.
- Experimental C++ standard library as a polyfill option via `BSONCXX_POLY_USE_STD_EXPERIMENTAL`.

## 3.9.0

Expand Down
4 changes: 0 additions & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -460,10 +460,6 @@ if(NOT(TARGET dist OR TARGET distcheck))
list(APPEND polyfill_flags "-DBSONCXX_POLY_USE_MNMLSTC=${BSONCXX_POLY_USE_MNMLSTC}")
endif()

if(NOT "${BSONCXX_POLY_USE_STD_EXPERIMENTAL}" STREQUAL "")
list(APPEND polyfill_flags "-DBSONCXX_POLY_USE_STD_EXPERIMENTAL=${BSONCXX_POLY_USE_STD_EXPERIMENTAL}")
endif()

if(NOT "${BSONCXX_POLY_USE_SYSTEM_MNMLSTC}" STREQUAL "")
list(APPEND polyfill_flags "-DBSONCXX_POLY_USE_SYSTEM_MNMLSTC=${BSONCXX_POLY_USE_SYSTEM_MNMLSTC}")
endif()
Expand Down
5 changes: 1 addition & 4 deletions cmake/BsoncxxUtil.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -55,22 +55,19 @@ function(bsoncxx_add_library TARGET OUTPUT_NAME LINK_TYPE)
# Library used for C++17 polyfills:
# - 'm' for mnmlstc/core.
# - 'b' for Boost.
# - 'x' for experimental standard library.
# - 'i' for bsoncxx implementations.
# - 's' for standard library (no polyfill).
if(1)
if(BSONCXX_POLY_USE_MNMLSTC)
set(polyfill "m")
elseif(BSONCXX_POLY_USE_BOOST)
set(polyfill "b")
elseif(BSONCXX_POLY_USE_STD_EXPERIMENTAL)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Remove # - 'x' for experimental standard library. above.

set(polyfill "x")
elseif(0) # CXX-2796: reserved for bsoncxx implementations as polyfill.
set(polyfill "i")
elseif(BSONCXX_POLY_USE_STD)
set(polyfill "s")
else()
message(FATAL_ERROR "could not determine polyfill library: must be one of [mbxis]")
message(FATAL_ERROR "could not determine polyfill library: must be one of [mbis]")
endif()

set_target_properties(${TARGET} PROPERTIES INTERFACE_BSONCXX_ABI_TAG_POLYFILL_LIBRARY ${polyfill})
Expand Down
3 changes: 0 additions & 3 deletions cmake/make_dist/MakeDistCheck.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,6 @@ function (RUN_DIST_CHECK PACKAGE_PREFIX EXT)
if (NOT "${BSONCXX_POLY_USE_MNMLSTC}" STREQUAL "")
list(APPEND polyfill_flags "-DBSONCXX_POLY_USE_MNMLSTC=${BSONCXX_POLY_USE_MNMLSTC}")
endif()
if (NOT "${BSONCXX_POLY_USE_STD_EXPERIMENTAL}" STREQUAL "")
list(APPEND polyfill_flags "-DBSONCXX_POLY_USE_STD_EXPERIMENTAL=${BSONCXX_POLY_USE_STD_EXPERIMENTAL}")
endif()
if (NOT "${BSONCXX_POLY_USE_SYSTEM_MNMLSTC}" STREQUAL "")
list(APPEND polyfill_flags "-DBSONCXX_POLY_USE_SYSTEM_MNMLSTC=${BSONCXX_POLY_USE_SYSTEM_MNMLSTC}")
endif()
Expand Down
9 changes: 0 additions & 9 deletions docs/content/mongocxx-v3/installation/linux.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,6 @@ must choose one of the following implementations for these features:
only option if you are using a version of MSVC that does not support
C++17.

`std::experimental`
Select with `-DBSONCXX_POLY_USE_STD_EXPERIMENTAL=1`. If your
toolchain's standard library provides `optional` and
`string_view` in the namespace `std::experimental`, you can use
this option. Be aware that your standard library's
`std::experimental` implementation may change over time,
breaking binary compatibility in unexpected ways. Note that this
polyfill is *not* recommended and is unsupported.

Most users should be fine sticking with the default. However, if you
have an existing application which makes heavy use of one of the
available libraries, you may prefer to build the mongocxx driver
Expand Down
9 changes: 0 additions & 9 deletions docs/content/mongocxx-v3/installation/macos.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,6 @@ must choose one of the following implementations for these features:
only option if you are using a version of MSVC that does not support
C++17.

`std::experimental`
Select with `-DBSONCXX_POLY_USE_STD_EXPERIMENTAL=1`. If your
toolchain's standard library provides `optional` and
`string_view` in the namespace `std::experimental`, you can use
this option. Be aware that your standard library's
`std::experimental` implementation may change over time,
breaking binary compatibility in unexpected ways. Note that this
polyfill is *not* recommended and is unsupported.

Most users should be fine sticking with the default. However, if you
have an existing application which makes heavy use of one of the
available libraries, you may prefer to build the mongocxx driver
Expand Down
9 changes: 0 additions & 9 deletions docs/content/mongocxx-v3/installation/windows.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,6 @@ must choose one of the following implementations for these features:
only option if you are using a version of MSVC that does not support
C++17.

`std::experimental`
Select with `-DBSONCXX_POLY_USE_STD_EXPERIMENTAL=1`. If your
toolchain's standard library provides `optional` and
`string_view` in the namespace `std::experimental`, you can use
this option. Be aware that your standard library's
`std::experimental` implementation may change over time,
breaking binary compatibility in unexpected ways. Note that this
polyfill is *not* recommended and is unsupported.

Most users should be fine sticking with the default. However, if you
have an existing application which makes heavy use of one of the
available libraries, you may prefer to build the mongocxx driver
Expand Down
8 changes: 1 addition & 7 deletions src/bsoncxx/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ set(BSONCXX_VERSION ${BSONCXX_VERSION_NO_EXTRA}${BSONCXX_VERSION_EXTRA})
message(STATUS "bsoncxx version: ${BSONCXX_VERSION}")

option(BSONCXX_POLY_USE_MNMLSTC "Use MNMLSTC/core for stdx polyfills" OFF)
option(BSONCXX_POLY_USE_STD_EXPERIMENTAL "Use std::experimental for stdx polyfills" OFF)
option(BSONCXX_POLY_USE_SYSTEM_MNMLSTC "Obtain mnmlstc/core from system" OFF)
option(BSONCXX_POLY_USE_BOOST "Use boost for stdx polyfills" OFF)
option(BSONCXX_POLY_USE_STD "Use C++17 std library for stdx polyfills" OFF)
Expand All @@ -31,7 +30,7 @@ set(BSONCXX_OUTPUT_BASENAME "bsoncxx" CACHE STRING "Output bsoncxx library base
# Count how many polyfill options are true-ish
set(BSONCXX_POLY_OPTIONS_SET 0)

foreach(BSONCXX_POLY_OPTION ${BSONCXX_POLY_USE_MNMLSTC} ${BSONCXX_POLY_USE_STD_EXPERIMENTAL} ${BSONCXX_POLY_USE_BOOST} ${BSONCXX_POLY_USE_STD})
foreach(BSONCXX_POLY_OPTION ${BSONCXX_POLY_USE_MNMLSTC} ${BSONCXX_POLY_USE_BOOST} ${BSONCXX_POLY_USE_STD})
if(${BSONCXX_POLY_OPTION})
MATH(EXPR BSONCXX_POLY_OPTIONS_SET "${BSONCXX_POLY_OPTIONS_SET}+1")
endif()
Expand Down Expand Up @@ -63,11 +62,6 @@ if(NOT BSONCXX_POLY_USE_MNMLSTC AND BSONCXX_POLY_USE_SYSTEM_MNMLSTC)
MESSAGE(FATAL_ERROR "Can't specify system mnmlstc when not using mnmlstc")
endif()

# Can only use STD_EXPERIMENTAL in C++14 mode
if(BSONCXX_POLY_USE_STD_EXPERIMENTAL AND CMAKE_CXX_STANDARD LESS 14)
message(FATAL_ERROR "Can only use BSONCXX_POLY_USE_STD_EXPERIMENTAL if CMAKE_CXX_STANDARD is 14 or higher")
endif()

set(BSONCXX_BOOST_PKG_DEP "") # Required by bsoncxx-config.cmake.in.

if(BSONCXX_POLY_USE_BOOST)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,6 @@ BSONCXX_POP_WARNINGS();
#pragma pop_macro("BSONCXX_INLINE_NAMESPACE_END")
#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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,6 @@
#undef BSONCXX_INLINE_NAMESPACE_END
#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")
Expand Down
17 changes: 0 additions & 17 deletions src/bsoncxx/include/bsoncxx/v_noabi/bsoncxx/stdx/optional.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,23 +54,6 @@ using ::boost::make_optional;
} // namespace v_noabi
} // namespace bsoncxx

#elif defined(BSONCXX_POLY_USE_STD_EXPERIMENTAL)

#include <experimental/optional>

namespace bsoncxx {
namespace v_noabi {
namespace stdx {

using ::std::experimental::make_optional;
using ::std::experimental::nullopt;
using ::std::experimental::nullopt_t;
using ::std::experimental::optional;

} // namespace stdx
} // namespace v_noabi
} // namespace bsoncxx

#elif defined(BSONCXX_POLY_USE_STD)

#include <optional>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
// See the License for the specific language governing permissions and
// limitations under the License.

#cmakedefine BSONCXX_POLY_USE_STD_EXPERIMENTAL
#cmakedefine BSONCXX_POLY_USE_MNMLSTC
#cmakedefine BSONCXX_POLY_USE_SYSTEM_MNMLSTC
#cmakedefine BSONCXX_POLY_USE_BOOST
Expand Down
1 change: 0 additions & 1 deletion src/bsoncxx/test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,6 @@ if(ENABLE_MACRO_GUARD_TESTS)
BSONCXX_INLINE_NAMESPACE_BEGIN # config.hpp (generated by CMake)
BSONCXX_INLINE_NAMESPACE_END
BSONCXX_POLY_USE_MNMLSTC
BSONCXX_POLY_USE_STD_EXPERIMENTAL
BSONCXX_POLY_USE_SYSTEM_MNMLSTC
BSONCXX_POLY_USE_BOOST
BSONCXX_VERSION_EXTRA # version.hpp (generated by CMake)
Expand Down