From f2899638b32a5e0f43cea8639fbdbb2abea0aa3c Mon Sep 17 00:00:00 2001 From: Francesco Biscani Date: Sat, 25 Nov 2023 15:11:02 +0100 Subject: [PATCH 1/6] Bump to 1.0.0, introduce patch version, beginning of ABI versioning and semantic versioning. --- CMakeLists.txt | 20 ++++++++++---------- config.hpp.in | 2 ++ doc/definitions.rst | 13 ++++++++++--- mp++-config.cmake.in | 3 +++ 4 files changed, 25 insertions(+), 13 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 22e275f6..5cea04cc 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -12,7 +12,10 @@ if(NOT CMAKE_BUILD_TYPE) FORCE) endif() -project(mp++ VERSION 0.27 LANGUAGES CXX C) +project(mp++ VERSION 1.0.0 LANGUAGES CXX C) + +# Setup the mp++ ABI version number. +set(MPPP_ABI_VERSION 15) list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake" "${CMAKE_CURRENT_SOURCE_DIR}/cmake/yacma") @@ -277,8 +280,8 @@ if(MPPP_BUILD_STATIC_LIBRARY) else() # Setup of the mp++ shared library. add_library(mp++ SHARED "${MPPP_SRC_FILES}") - set_property(TARGET mp++ PROPERTY VERSION "14.0") - set_property(TARGET mp++ PROPERTY SOVERSION 14) + set_property(TARGET mp++ PROPERTY VERSION "${MPPP_ABI_VERSION}.0") + set_property(TARGET mp++ PROPERTY SOVERSION ${MPPP_ABI_VERSION}) set_property(TARGET mp++ PROPERTY DEFINE_SYMBOL "mppp_EXPORTS") set_target_properties(mp++ PROPERTIES CXX_VISIBILITY_PRESET hidden) set_target_properties(mp++ PROPERTIES VISIBILITY_INLINES_HIDDEN TRUE) @@ -455,13 +458,10 @@ install(FILES install(EXPORT mp++_export NAMESPACE mp++:: DESTINATION "${MPPP_INSTALL_LIBDIR}/cmake/mp++") # Take care of versioning. include(CMakePackageConfigHelpers) -# NOTE: SameMinorVersion available only -# since CMake 3.11. -if(${CMAKE_VERSION} VERSION_LESS "3.11.0") - write_basic_package_version_file("${CMAKE_CURRENT_BINARY_DIR}/mp++-config-version.cmake" COMPATIBILITY SameMajorVersion) -else() - write_basic_package_version_file("${CMAKE_CURRENT_BINARY_DIR}/mp++-config-version.cmake" COMPATIBILITY SameMinorVersion) -endif() +# NOTE: since we use semantic versioning, the correct setting here is SameMajorVersion: it requires equality +# in the major version, but higher minor versions will be considered compatible. So, if mp++ 2.0.0 is requested +# and 2.1.0 is found, then all is good. However, the reverse will lead to a failure. +write_basic_package_version_file("${CMAKE_CURRENT_BINARY_DIR}/mp++-config-version.cmake" COMPATIBILITY SameMajorVersion) install(FILES "${CMAKE_CURRENT_BINARY_DIR}/mp++-config-version.cmake" DESTINATION "${MPPP_INSTALL_LIBDIR}/cmake/mp++") # This is just a simple counter variable, internal use only. diff --git a/config.hpp.in b/config.hpp.in index a24228bd..3070be8f 100644 --- a/config.hpp.in +++ b/config.hpp.in @@ -14,6 +14,8 @@ #define MPPP_VERSION_STRING "@mp++_VERSION@" #define MPPP_VERSION_MAJOR @mp++_VERSION_MAJOR@ #define MPPP_VERSION_MINOR @mp++_VERSION_MINOR@ +#define MPPP_VERSION_PATCH @mp++_VERSION_PATCH@ +#define MPPP_ABI_VERSION @MPPP_ABI_VERSION@ #cmakedefine MPPP_GMP_HAVE_MPN_DIVEXACT_1 @MPPP_ENABLE_MPFR@ #cmakedefine MPPP_MPFR_HAVE_MPFR_GET_Q diff --git a/doc/definitions.rst b/doc/definitions.rst index c8c26795..8ff7baa1 100644 --- a/doc/definitions.rst +++ b/doc/definitions.rst @@ -8,17 +8,24 @@ Macros and definitions .. c:macro:: MPPP_VERSION_STRING This definition expands to a string literal containing the full version of the mp++ library - (e.g., for version 0.6 this macro expands to ``"0.6"``). + (e.g., for version 1.2.3 this macro expands to ``"1.2.3"``). .. c:macro:: MPPP_VERSION_MAJOR This definition expands to an integral literal corresponding to the major mp++ version (e.g., - for version 0.6, this macro expands to ``0``). + for version 1.2.3, this macro expands to ``1``). .. c:macro:: MPPP_VERSION_MINOR This definition expands to an integral literal corresponding to the minor mp++ version (e.g., - for version 0.6, this macro expands to ``6``). + for version 1.2.3, this macro expands to ``2``). + +.. c:macro:: MPPP_VERSION_PATCH + + .. versionadded:: 1.0.0 + + This definition expands to an integral literal corresponding to the patch mp++ version (e.g., + for version 1.2.3, this macro expands to ``3``). .. c:macro:: MPPP_WITH_QUADMATH diff --git a/mp++-config.cmake.in b/mp++-config.cmake.in index f8feba8c..f55303e4 100644 --- a/mp++-config.cmake.in +++ b/mp++-config.cmake.in @@ -33,6 +33,9 @@ set(mp++_WITH_FMT @MPPP_WITH_FMT@) set(mp++_WITH_ARB @MPPP_WITH_ARB@) set(mp++_WITH_QUADMATH @MPPP_WITH_QUADMATH@) +# Export the ABI version. +set(mp++_ABI_VERSION @MPPP_ABI_VERSION@) + # Restore original module path. set(CMAKE_MODULE_PATH "${_MPPP_CONFIG_OLD_MODULE_PATH}") unset(_MPPP_CONFIG_OLD_MODULE_PATH) From 812eab42b88d123c7bf10d03903172891d9224af Mon Sep 17 00:00:00 2001 From: Francesco Biscani Date: Sat, 25 Nov 2023 15:12:08 +0100 Subject: [PATCH 2/6] Update chagelog, doc tweak. --- doc/changelog.rst | 5 +++++ doc/index.rst | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/doc/changelog.rst b/doc/changelog.rst index e362a274..847e450f 100644 --- a/doc/changelog.rst +++ b/doc/changelog.rst @@ -4,6 +4,11 @@ Changelog 1.0.0 (unreleased) ------------------ +New +~~~ + +- mp++ now uses semantic versioning. + Fix ~~~ diff --git a/doc/index.rst b/doc/index.rst index 493dcb72..7ab7b644 100644 --- a/doc/index.rst +++ b/doc/index.rst @@ -59,7 +59,7 @@ at `this link `__. not yet available in mp++'s stable releases. .. toctree:: - :maxdepth: 2 + :maxdepth: 1 installation.rst tutorial.rst From e10876e79a8176f9ead66b5748b0d817ff350fb8 Mon Sep 17 00:00:00 2001 From: Francesco Biscani Date: Sat, 25 Nov 2023 15:16:54 +0100 Subject: [PATCH 3/6] Doc additions. --- doc/reference.rst | 1 + doc/versioning.rst | 6 ++++++ 2 files changed, 7 insertions(+) create mode 100644 doc/versioning.rst diff --git a/doc/reference.rst b/doc/reference.rst index 1b9d0bf3..6e30ac3d 100644 --- a/doc/reference.rst +++ b/doc/reference.rst @@ -9,6 +9,7 @@ Before perusing the C++ reference, users are encouraged to first go through the .. toctree:: :maxdepth: 1 + versioning.rst definitions.rst namespaces.rst exceptions.rst diff --git a/doc/versioning.rst b/doc/versioning.rst new file mode 100644 index 00000000..b7369b2e --- /dev/null +++ b/doc/versioning.rst @@ -0,0 +1,6 @@ +Versioning +========== + +Beginning with version 1.0.0, mp++ adopts `semantic versioning `__. + +ABI compatibility is guaranteed only between patch versions. From 58b3fd736ce537b86a25303b4370dd650efcde48 Mon Sep 17 00:00:00 2001 From: Francesco Biscani Date: Sat, 25 Nov 2023 17:33:46 +0100 Subject: [PATCH 4/6] Implement ABI versioning. --- config.hpp.in | 25 +++++++++++++++++++++++ include/mp++/complex.hpp | 10 ++++----- include/mp++/complex128.hpp | 10 ++++----- include/mp++/concepts.hpp | 5 ++--- include/mp++/detail/fmt.hpp | 5 ++--- include/mp++/detail/gmp.hpp | 8 +++++--- include/mp++/detail/integer_literals.hpp | 5 ++--- include/mp++/detail/mpc.hpp | 7 ++++--- include/mp++/detail/mpfr.hpp | 7 ++++--- include/mp++/detail/parse_complex.hpp | 7 ++++--- include/mp++/detail/rational_literals.hpp | 5 ++--- include/mp++/detail/real128_literal.hpp | 5 ++--- include/mp++/detail/real_literals.hpp | 5 ++--- include/mp++/detail/type_traits.hpp | 5 ++--- include/mp++/detail/utils.hpp | 6 +++--- include/mp++/exceptions.hpp | 6 +++--- include/mp++/fwd.hpp | 5 ++--- include/mp++/integer.hpp | 10 ++++----- include/mp++/rational.hpp | 10 ++++----- include/mp++/real.hpp | 10 ++++----- include/mp++/real128.hpp | 10 ++++----- include/mp++/type_name.hpp | 5 ++--- src/complex.cpp | 5 ++--- src/complex128.cpp | 5 ++--- src/detail/arb.cpp | 5 ++--- src/detail/mpfr_arb_cleanup.cpp | 5 ++--- src/detail/parse_complex.cpp | 5 ++--- src/detail/utils.cpp | 5 ++--- src/integer.cpp | 5 ++--- src/rational.cpp | 5 ++--- src/real.cpp | 5 ++--- src/real128.cpp | 5 ++--- src/type_name.cpp | 6 ++---- 33 files changed, 112 insertions(+), 115 deletions(-) diff --git a/config.hpp.in b/config.hpp.in index 3070be8f..b8a0b152 100644 --- a/config.hpp.in +++ b/config.hpp.in @@ -37,6 +37,31 @@ // clang-format on // End of defines instantiated by CMake. +// Setup of the ABI versioning and tagging +// machinery. + +#if defined(__GNUC__) || defined(__clang__) + +#define MPPP_ABI_TAG_ATTR __attribute__((abi_tag)) + +#else + +#define MPPP_ABI_TAG_ATTR + +#endif + +// clang-format off +#define MPPP_BEGIN_NAMESPACE \ + namespace mppp \ + { \ + inline namespace v@MPPP_ABI_VERSION@ MPPP_ABI_TAG_ATTR \ + { + +#define MPPP_END_NAMESPACE \ + } \ + } +// clang-format on + // Compiler configuration. #if defined(__clang__) || defined(__GNUC__) || defined(__INTEL_COMPILER) diff --git a/include/mp++/complex.hpp b/include/mp++/complex.hpp index 5a5e15b8..17910a9e 100644 --- a/include/mp++/complex.hpp +++ b/include/mp++/complex.hpp @@ -61,8 +61,7 @@ #endif -namespace mppp -{ +MPPP_BEGIN_NAMESPACE // Detect real-valued interoperable types // for complex. @@ -3199,7 +3198,7 @@ inline rational &rational::operator=(const complex &c) return *this = static_cast>(c); } -} // namespace mppp +MPPP_END_NAMESPACE #if defined(MPPP_WITH_BOOST_S11N) @@ -3229,8 +3228,7 @@ struct formatter : mppp::detail::to_string_formatter { #include -namespace mppp -{ +MPPP_BEGIN_NAMESPACE inline nlohmann::json mime_bundle_repr(const complex &c) { @@ -3241,7 +3239,7 @@ inline nlohmann::json mime_bundle_repr(const complex &c) return bundle; } -} // namespace mppp +MPPP_END_NAMESPACE #endif diff --git a/include/mp++/complex128.hpp b/include/mp++/complex128.hpp index b42e1a0a..08fc788a 100644 --- a/include/mp++/complex128.hpp +++ b/include/mp++/complex128.hpp @@ -56,8 +56,7 @@ #endif -namespace mppp -{ +MPPP_BEGIN_NAMESPACE // Re-define in the mppp namespace the __complex128 type // (using another name). This allows us to avoid having @@ -1310,7 +1309,7 @@ inline MPPP_CONSTEXPR_14 real128 &real128::operator=(const complex128 &x) return *this = static_cast(x); } -} // namespace mppp +MPPP_END_NAMESPACE #if defined(MPPP_WITH_BOOST_S11N) @@ -1340,8 +1339,7 @@ struct formatter : mppp::detail::to_string_formatter { #include -namespace mppp -{ +MPPP_BEGIN_NAMESPACE inline nlohmann::json mime_bundle_repr(const complex128 &c) { @@ -1352,7 +1350,7 @@ inline nlohmann::json mime_bundle_repr(const complex128 &c) return bundle; } -} // namespace mppp +MPPP_END_NAMESPACE #endif diff --git a/include/mp++/concepts.hpp b/include/mp++/concepts.hpp index 85467704..7b68ebfb 100644 --- a/include/mp++/concepts.hpp +++ b/include/mp++/concepts.hpp @@ -22,8 +22,7 @@ #include -namespace mppp -{ +MPPP_BEGIN_NAMESPACE // Type trait to check if T is a C++ integral type, including possibly __(u)int128_t. // NOTE: mppp::detail::is_integral, for consistency with std::is_integral, will be true also for cv qualified @@ -122,6 +121,6 @@ MPPP_CONCEPT_DECL string_type = is_string_type::value; #endif -} // namespace mppp +MPPP_END_NAMESPACE #endif diff --git a/include/mp++/detail/fmt.hpp b/include/mp++/detail/fmt.hpp index ebedcd36..7c259c28 100644 --- a/include/mp++/detail/fmt.hpp +++ b/include/mp++/detail/fmt.hpp @@ -13,8 +13,7 @@ #include -namespace mppp -{ +MPPP_BEGIN_NAMESPACE namespace detail { @@ -56,6 +55,6 @@ struct to_string_formatter { } // namespace detail -} // namespace mppp +MPPP_END_NAMESPACE #endif diff --git a/include/mp++/detail/gmp.hpp b/include/mp++/detail/gmp.hpp index b215c479..befb5068 100644 --- a/include/mp++/detail/gmp.hpp +++ b/include/mp++/detail/gmp.hpp @@ -15,14 +15,15 @@ #include +#include + #if __GNU_MP_VERSION < 5 #error Minimum supported GMP version is 5. #endif -namespace mppp -{ +MPPP_BEGIN_NAMESPACE namespace detail { @@ -98,6 +99,7 @@ struct mpf_raii { mpf_struct_t m_mpf; }; } // namespace detail -} // namespace mppp + +MPPP_END_NAMESPACE #endif diff --git a/include/mp++/detail/integer_literals.hpp b/include/mp++/detail/integer_literals.hpp index 7ef3b37e..18ad159d 100644 --- a/include/mp++/detail/integer_literals.hpp +++ b/include/mp++/detail/integer_literals.hpp @@ -21,8 +21,7 @@ #include #include -namespace mppp -{ +MPPP_BEGIN_NAMESPACE namespace detail { @@ -416,6 +415,6 @@ MPPP_DECLARE_INTEGRAL_UDL(3) } // namespace literals -} // namespace mppp +MPPP_END_NAMESPACE #endif diff --git a/include/mp++/detail/mpc.hpp b/include/mp++/detail/mpc.hpp index f143e3fa..007a6751 100644 --- a/include/mp++/detail/mpc.hpp +++ b/include/mp++/detail/mpc.hpp @@ -13,12 +13,13 @@ #include -namespace mppp -{ +#include + +MPPP_BEGIN_NAMESPACE // The MPC structure underlying mpc_t. using mpc_struct_t = std::remove_extent<::mpc_t>::type; -} // namespace mppp +MPPP_END_NAMESPACE #endif diff --git a/include/mp++/detail/mpfr.hpp b/include/mp++/detail/mpfr.hpp index f1135889..a7576114 100644 --- a/include/mp++/detail/mpfr.hpp +++ b/include/mp++/detail/mpfr.hpp @@ -13,6 +13,8 @@ #include +#include + #if MPFR_VERSION_MAJOR < 3 #error Minimum supported MPFR version is 3. @@ -28,8 +30,7 @@ #endif -namespace mppp -{ +MPPP_BEGIN_NAMESPACE // Minimum precision for a real. constexpr ::mpfr_prec_t real_prec_min() @@ -82,6 +83,6 @@ struct mpfr_raii { } // namespace detail -} // namespace mppp +MPPP_END_NAMESPACE #endif diff --git a/include/mp++/detail/parse_complex.hpp b/include/mp++/detail/parse_complex.hpp index 694be947..573fbd48 100644 --- a/include/mp++/detail/parse_complex.hpp +++ b/include/mp++/detail/parse_complex.hpp @@ -11,8 +11,9 @@ #include -namespace mppp -{ +#include + +MPPP_BEGIN_NAMESPACE namespace detail { @@ -21,6 +22,6 @@ std::array parse_complex(const char *); } // namespace detail -} // namespace mppp +MPPP_END_NAMESPACE #endif diff --git a/include/mp++/detail/rational_literals.hpp b/include/mp++/detail/rational_literals.hpp index e2b63c9c..bfcd8111 100644 --- a/include/mp++/detail/rational_literals.hpp +++ b/include/mp++/detail/rational_literals.hpp @@ -11,8 +11,7 @@ #include -namespace mppp -{ +MPPP_BEGIN_NAMESPACE inline namespace literals { @@ -32,6 +31,6 @@ MPPP_DECLARE_RATIONAL_UDL(3) } // namespace literals -} // namespace mppp +MPPP_END_NAMESPACE #endif diff --git a/include/mp++/detail/real128_literal.hpp b/include/mp++/detail/real128_literal.hpp index 341ef44d..1c60b27d 100644 --- a/include/mp++/detail/real128_literal.hpp +++ b/include/mp++/detail/real128_literal.hpp @@ -11,8 +11,7 @@ #include -namespace mppp -{ +MPPP_BEGIN_NAMESPACE inline namespace literals { @@ -35,6 +34,6 @@ inline real128 operator""_rq() } // namespace literals -} // namespace mppp +MPPP_END_NAMESPACE #endif diff --git a/include/mp++/detail/real_literals.hpp b/include/mp++/detail/real_literals.hpp index c7c6aa9f..8dd8bcb6 100644 --- a/include/mp++/detail/real_literals.hpp +++ b/include/mp++/detail/real_literals.hpp @@ -11,8 +11,7 @@ #include -namespace mppp -{ +MPPP_BEGIN_NAMESPACE namespace detail { @@ -64,6 +63,6 @@ MPPP_DECLARE_REAL_UDL(1024) } // namespace literals -} // namespace mppp +MPPP_END_NAMESPACE #endif diff --git a/include/mp++/detail/type_traits.hpp b/include/mp++/detail/type_traits.hpp index aaeb9f0f..5d54e463 100644 --- a/include/mp++/detail/type_traits.hpp +++ b/include/mp++/detail/type_traits.hpp @@ -14,8 +14,7 @@ #include #include -namespace mppp -{ +MPPP_BEGIN_NAMESPACE namespace detail { @@ -296,6 +295,6 @@ struct nl_constants { } // namespace detail -} // namespace mppp +MPPP_END_NAMESPACE #endif diff --git a/include/mp++/detail/utils.hpp b/include/mp++/detail/utils.hpp index b150867f..aa199601 100644 --- a/include/mp++/detail/utils.hpp +++ b/include/mp++/detail/utils.hpp @@ -23,8 +23,7 @@ #include #include -namespace mppp -{ +MPPP_BEGIN_NAMESPACE namespace detail { @@ -314,6 +313,7 @@ inline void hash_combine(std::size_t &seed, const T &val) #endif } // namespace detail -} // namespace mppp + +MPPP_END_NAMESPACE #endif diff --git a/include/mp++/exceptions.hpp b/include/mp++/exceptions.hpp index 594e04c3..81a1789f 100644 --- a/include/mp++/exceptions.hpp +++ b/include/mp++/exceptions.hpp @@ -11,10 +11,10 @@ #include +#include #include -namespace mppp -{ +MPPP_BEGIN_NAMESPACE // Exception to signal division by zero. class MPPP_DLL_PUBLIC_INLINE_CLASS zero_division_error final : public std::domain_error @@ -23,6 +23,6 @@ class MPPP_DLL_PUBLIC_INLINE_CLASS zero_division_error final : public std::domai using std::domain_error::domain_error; }; -} // namespace mppp +MPPP_END_NAMESPACE #endif diff --git a/include/mp++/fwd.hpp b/include/mp++/fwd.hpp index 52be0f13..23b1690c 100644 --- a/include/mp++/fwd.hpp +++ b/include/mp++/fwd.hpp @@ -13,8 +13,7 @@ #include -namespace mppp -{ +MPPP_BEGIN_NAMESPACE template class integer; @@ -41,6 +40,6 @@ class complex128; #endif -} // namespace mppp +MPPP_END_NAMESPACE #endif diff --git a/include/mp++/integer.hpp b/include/mp++/integer.hpp index fb408cb5..7205abae 100644 --- a/include/mp++/integer.hpp +++ b/include/mp++/integer.hpp @@ -111,8 +111,7 @@ #endif -namespace mppp -{ +MPPP_BEGIN_NAMESPACE // Strongly typed enum to represent a bit count in the constructor // of integer from number of bits. @@ -8175,7 +8174,7 @@ inline T &operator^=(T &rop, const U &op) return rop; } -} // namespace mppp +MPPP_END_NAMESPACE #if defined(MPPP_WITH_BOOST_S11N) @@ -8254,8 +8253,7 @@ struct formatter> : mppp::detail::to_string_formatter { #include -namespace mppp -{ +MPPP_BEGIN_NAMESPACE template inline nlohmann::json mime_bundle_repr(const integer &n) @@ -8267,7 +8265,7 @@ inline nlohmann::json mime_bundle_repr(const integer &n) return bundle; } -} // namespace mppp +MPPP_END_NAMESPACE #endif diff --git a/include/mp++/rational.hpp b/include/mp++/rational.hpp index f174f6e8..2ba62e22 100644 --- a/include/mp++/rational.hpp +++ b/include/mp++/rational.hpp @@ -60,8 +60,7 @@ #include #endif -namespace mppp -{ +MPPP_BEGIN_NAMESPACE template using is_rational_interoperable @@ -2280,7 +2279,7 @@ inline integer &integer::operator=(const rational &q) return *this = static_cast>(q); } -} // namespace mppp +MPPP_END_NAMESPACE #if defined(MPPP_WITH_BOOST_S11N) @@ -2348,8 +2347,7 @@ struct formatter> : mppp::detail::to_string_formatter { #include -namespace mppp -{ +MPPP_BEGIN_NAMESPACE template inline nlohmann::json mime_bundle_repr(const rational &q) @@ -2366,7 +2364,7 @@ inline nlohmann::json mime_bundle_repr(const rational &q) return bundle; } -} // namespace mppp +MPPP_END_NAMESPACE #endif diff --git a/include/mp++/real.hpp b/include/mp++/real.hpp index ee6974e9..de86bf05 100644 --- a/include/mp++/real.hpp +++ b/include/mp++/real.hpp @@ -67,8 +67,7 @@ #include #endif -namespace mppp -{ +MPPP_BEGIN_NAMESPACE namespace detail { @@ -4587,7 +4586,7 @@ inline rational &rational::operator=(const real &x) // Hashing. MPPP_DLL_PUBLIC std::size_t hash(const real &); -} // namespace mppp +MPPP_END_NAMESPACE #if defined(MPPP_WITH_BOOST_S11N) @@ -4641,8 +4640,7 @@ struct formatter : mppp::detail::to_string_formatter { #include -namespace mppp -{ +MPPP_BEGIN_NAMESPACE inline nlohmann::json mime_bundle_repr(const real &x) { @@ -4653,7 +4651,7 @@ inline nlohmann::json mime_bundle_repr(const real &x) return bundle; } -} // namespace mppp +MPPP_END_NAMESPACE #endif diff --git a/include/mp++/real128.hpp b/include/mp++/real128.hpp index b3da5530..e694e820 100644 --- a/include/mp++/real128.hpp +++ b/include/mp++/real128.hpp @@ -60,8 +60,7 @@ #include #include -namespace mppp -{ +MPPP_BEGIN_NAMESPACE namespace detail { @@ -2136,7 +2135,7 @@ inline rational &rational::operator=(const real128 &x) return *this = static_cast>(x); } -} // namespace mppp +MPPP_END_NAMESPACE #if defined(MPPP_WITH_BOOST_S11N) @@ -2265,8 +2264,7 @@ struct formatter : mppp::detail::to_string_formatter { #include -namespace mppp -{ +MPPP_BEGIN_NAMESPACE inline nlohmann::json mime_bundle_repr(const real128 &x) { @@ -2277,7 +2275,7 @@ inline nlohmann::json mime_bundle_repr(const real128 &x) return bundle; } -} // namespace mppp +MPPP_END_NAMESPACE #endif diff --git a/include/mp++/type_name.hpp b/include/mp++/type_name.hpp index 83b4400f..417e5f3a 100644 --- a/include/mp++/type_name.hpp +++ b/include/mp++/type_name.hpp @@ -16,8 +16,7 @@ #include #include -namespace mppp -{ +MPPP_BEGIN_NAMESPACE namespace detail { @@ -111,6 +110,6 @@ inline std::string type_name() return ret; } -} // namespace mppp +MPPP_END_NAMESPACE #endif diff --git a/src/complex.cpp b/src/complex.cpp index bced14ef..402b079b 100644 --- a/src/complex.cpp +++ b/src/complex.cpp @@ -53,8 +53,7 @@ #endif -namespace mppp -{ +MPPP_BEGIN_NAMESPACE namespace detail { @@ -918,4 +917,4 @@ void complex::load(boost::archive::binary_iarchive &ar, unsigned) #endif -} // namespace mppp +MPPP_END_NAMESPACE diff --git a/src/complex128.cpp b/src/complex128.cpp index a6fffdf3..42f9e7c8 100644 --- a/src/complex128.cpp +++ b/src/complex128.cpp @@ -40,8 +40,7 @@ #endif -namespace mppp -{ +MPPP_BEGIN_NAMESPACE static_assert(std::is_same::value, "Mismatched __complex128 types."); @@ -361,4 +360,4 @@ real &real::operator=(const complex128 &x) #endif -} // namespace mppp +MPPP_END_NAMESPACE diff --git a/src/detail/arb.cpp b/src/detail/arb.cpp index 3c803675..ee1c8cf7 100644 --- a/src/detail/arb.cpp +++ b/src/detail/arb.cpp @@ -52,8 +52,7 @@ #endif -namespace mppp -{ +MPPP_BEGIN_NAMESPACE namespace detail { @@ -555,4 +554,4 @@ complex &complex::agm1() #endif -} // namespace mppp +MPPP_END_NAMESPACE diff --git a/src/detail/mpfr_arb_cleanup.cpp b/src/detail/mpfr_arb_cleanup.cpp index 2825bf0f..66037c05 100644 --- a/src/detail/mpfr_arb_cleanup.cpp +++ b/src/detail/mpfr_arb_cleanup.cpp @@ -44,8 +44,7 @@ #endif -namespace mppp -{ +MPPP_BEGIN_NAMESPACE namespace detail { @@ -266,4 +265,4 @@ complex::~complex() #endif -} // namespace mppp +MPPP_END_NAMESPACE diff --git a/src/detail/parse_complex.cpp b/src/detail/parse_complex.cpp index fcb46bc3..20f3a0da 100644 --- a/src/detail/parse_complex.cpp +++ b/src/detail/parse_complex.cpp @@ -15,8 +15,7 @@ #include // NOLINTNEXTLINE(modernize-concat-nested-namespaces) -namespace mppp -{ +MPPP_BEGIN_NAMESPACE namespace detail { @@ -124,4 +123,4 @@ std::array parse_complex(const char *str) } // namespace detail -} // namespace mppp +MPPP_END_NAMESPACE diff --git a/src/detail/utils.cpp b/src/detail/utils.cpp index 3403a656..b935b669 100644 --- a/src/detail/utils.cpp +++ b/src/detail/utils.cpp @@ -21,8 +21,7 @@ #include // NOLINTNEXTLINE(modernize-concat-nested-namespaces) -namespace mppp -{ +MPPP_BEGIN_NAMESPACE namespace detail { @@ -105,4 +104,4 @@ std::string to_string(__int128_t n) } // namespace detail -} // namespace mppp +MPPP_END_NAMESPACE diff --git a/src/integer.cpp b/src/integer.cpp index eb7e7c80..c4b94067 100644 --- a/src/integer.cpp +++ b/src/integer.cpp @@ -25,8 +25,7 @@ #include #include -namespace mppp -{ +MPPP_BEGIN_NAMESPACE namespace detail { @@ -407,4 +406,4 @@ void free_integer_caches() #endif } -} // namespace mppp +MPPP_END_NAMESPACE diff --git a/src/rational.cpp b/src/rational.cpp index 88f1e3c6..228d3365 100644 --- a/src/rational.cpp +++ b/src/rational.cpp @@ -25,8 +25,7 @@ #include // NOLINTNEXTLINE(modernize-concat-nested-namespaces) -namespace mppp -{ +MPPP_BEGIN_NAMESPACE namespace detail { @@ -241,4 +240,4 @@ std::ostream &rational_stream_operator_impl(std::ostream &os, const mpz_struct_t } // namespace detail -} // namespace mppp +MPPP_END_NAMESPACE diff --git a/src/real.cpp b/src/real.cpp index 79ff73f2..109c5869 100644 --- a/src/real.cpp +++ b/src/real.cpp @@ -62,8 +62,7 @@ #include #endif -namespace mppp -{ +MPPP_BEGIN_NAMESPACE namespace detail { @@ -2924,7 +2923,7 @@ std::size_t prec_to_nlimbs(mpfr_prec_t p) return detail::rbs_prec_to_nlimbs(p); } -} // namespace mppp +MPPP_END_NAMESPACE #if defined(_MSC_VER) diff --git a/src/real128.cpp b/src/real128.cpp index 3a6800a2..db55e3fb 100644 --- a/src/real128.cpp +++ b/src/real128.cpp @@ -41,8 +41,7 @@ #include #include -namespace mppp -{ +MPPP_BEGIN_NAMESPACE // Double check our assumption regarding // the number of binary digits in the @@ -527,4 +526,4 @@ void real128::load(boost::archive::binary_iarchive &ar, unsigned) #endif -} // namespace mppp +MPPP_END_NAMESPACE diff --git a/src/type_name.cpp b/src/type_name.cpp index 2b1a6fc6..6f901392 100644 --- a/src/type_name.cpp +++ b/src/type_name.cpp @@ -20,9 +20,7 @@ #include // NOLINTNEXTLINE(modernize-concat-nested-namespaces) -namespace mppp -{ - +MPPP_BEGIN_NAMESPACE namespace detail { @@ -50,4 +48,4 @@ std::string demangle_from_typeid(const char *s) } // namespace detail -} // namespace mppp +MPPP_END_NAMESPACE From 587102744cdcab57dd96dc92ffe03f930c057c04 Mon Sep 17 00:00:00 2001 From: Francesco Biscani Date: Sat, 25 Nov 2023 17:45:30 +0100 Subject: [PATCH 5/6] Unset the predefined conda C/CXX flags when building in debug mode. --- tools/circleci_conda_arm64.sh | 3 +++ tools/circleci_conda_coverage.sh | 3 +++ tools/circleci_conda_docs.sh | 3 +++ tools/gha_conda_asan.sh | 3 +++ tools/gha_conda_tsan.sh | 3 +++ tools/gha_conda_ubsan.sh | 3 +++ tools/gha_debuggmp.sh | 3 +++ tools/gha_osx.sh | 3 +++ 8 files changed, 24 insertions(+) diff --git a/tools/circleci_conda_arm64.sh b/tools/circleci_conda_arm64.sh index 7e98f83b..9571e1be 100644 --- a/tools/circleci_conda_arm64.sh +++ b/tools/circleci_conda_arm64.sh @@ -21,6 +21,9 @@ source activate $deps_dir mkdir build cd build +unset CFLAGS +unset CXXFLAGS + # GCC build. cmake ../ -G Ninja \ -DCMAKE_PREFIX_PATH=$deps_dir \ diff --git a/tools/circleci_conda_coverage.sh b/tools/circleci_conda_coverage.sh index aeddcfd2..ffd47bd1 100644 --- a/tools/circleci_conda_coverage.sh +++ b/tools/circleci_conda_coverage.sh @@ -21,6 +21,9 @@ source activate $deps_dir mkdir build cd build +unset CFLAGS +unset CXXFLAGS + # GCC build. cmake ../ -G Ninja \ -DCMAKE_PREFIX_PATH=$deps_dir \ diff --git a/tools/circleci_conda_docs.sh b/tools/circleci_conda_docs.sh index 7abc3651..417f1407 100644 --- a/tools/circleci_conda_docs.sh +++ b/tools/circleci_conda_docs.sh @@ -21,6 +21,9 @@ source activate $deps_dir mkdir build cd build +unset CFLAGS +unset CXXFLAGS + # Build and install cmake ../ -G Ninja \ -DCMAKE_PREFIX_PATH=$deps_dir \ diff --git a/tools/gha_conda_asan.sh b/tools/gha_conda_asan.sh index 646acb23..2c1f9054 100644 --- a/tools/gha_conda_asan.sh +++ b/tools/gha_conda_asan.sh @@ -21,6 +21,9 @@ source activate $deps_dir mkdir build cd build +unset CFLAGS +unset CXXFLAGS + cmake ../ -G Ninja \ -DCMAKE_PREFIX_PATH=$deps_dir \ -DCMAKE_CXX_STANDARD=20 \ diff --git a/tools/gha_conda_tsan.sh b/tools/gha_conda_tsan.sh index 4ce4da59..dec257d7 100644 --- a/tools/gha_conda_tsan.sh +++ b/tools/gha_conda_tsan.sh @@ -21,6 +21,9 @@ source activate $deps_dir mkdir build cd build +unset CFLAGS +unset CXXFLAGS + cmake ../ -G Ninja \ -DCMAKE_PREFIX_PATH=$deps_dir \ -DCMAKE_CXX_STANDARD=17 \ diff --git a/tools/gha_conda_ubsan.sh b/tools/gha_conda_ubsan.sh index fb85a518..bc9e14b3 100644 --- a/tools/gha_conda_ubsan.sh +++ b/tools/gha_conda_ubsan.sh @@ -21,6 +21,9 @@ source activate $deps_dir mkdir build cd build +unset CFLAGS +unset CXXFLAGS + cmake ../ -G Ninja \ -DCMAKE_PREFIX_PATH=$deps_dir \ -DCMAKE_CXX_STANDARD=17 \ diff --git a/tools/gha_debuggmp.sh b/tools/gha_debuggmp.sh index 2855a734..408cd34c 100644 --- a/tools/gha_debuggmp.sh +++ b/tools/gha_debuggmp.sh @@ -21,6 +21,9 @@ source activate $deps_dir mkdir build cd build +unset CFLAGS +unset CXXFLAGS + # Download and compile locally GMP in debug mode. GMP_VERSION="6.2.1" wget https://github.com/esa/manylinux_x86_64_with_deps/raw/master/gmp-${GMP_VERSION}.tar.bz2 -O gmp.tar.bz2 diff --git a/tools/gha_osx.sh b/tools/gha_osx.sh index ec6299a6..948b0649 100644 --- a/tools/gha_osx.sh +++ b/tools/gha_osx.sh @@ -19,6 +19,9 @@ source activate $deps_dir mkdir build cd build +unset CFLAGS +unset CXXFLAGS + cmake ../ -G Ninja \ -DCMAKE_PREFIX_PATH=$deps_dir \ -DCMAKE_CXX_STANDARD=20 \ From 176a9298b50649b7cb8d75b446db76a87ef94c70 Mon Sep 17 00:00:00 2001 From: Francesco Biscani Date: Sat, 25 Nov 2023 18:44:31 +0100 Subject: [PATCH 6/6] Update changelog. --- doc/changelog.rst | 2 ++ 1 file changed, 2 insertions(+) diff --git a/doc/changelog.rst b/doc/changelog.rst index 847e450f..63677a1d 100644 --- a/doc/changelog.rst +++ b/doc/changelog.rst @@ -7,6 +7,8 @@ Changelog New ~~~ +- mp++'s ABI is now versioned + (`#304 `__). - mp++ now uses semantic versioning. Fix