Compare commits

...

6 Commits

Author SHA1 Message Date
2dfe66886d Add a comma before ellipsis in constexpr_swap.
gcc 15 complains that the comma is required before vararg ellipsis.

Fixes https://github.com/boostorg/integer/issues/35.
2024-12-02 19:22:20 +03:00
b774aa0d9e Remove constexpr_min duplication. 2024-12-02 18:58:34 +03:00
fbaf2dee58 Added a missing dependency on Boost.TypeTraits to CMakeLists.txt. 2024-08-19 01:01:57 +03:00
318a38efde Add support for modular build structure. (#34)
* Make the library modular usable.

* Switch to library requirements instead of source. As source puts extra source in install targets.

* Add requires-b2 check to top-level build file.

* Bump B2 require to 5.2

* Update copyright dates.

* Move inter-lib dependencies to a project variable and into the build targets.

* Update build deps.
2024-08-19 01:00:30 +03:00
f1d7f7f80f Removed legacy MinGW from AppVeyor CI.
Looks like gcc 5 that is installed in MinGW on AppVeyor CI is not compiled
with C99 standard library enabled, which results in C++11 std::to_string
functions not being available. These functions are required by
Boost.Multiprecision.

Since legacy MinGW is quite outdated and increasingly poorly supported
across Boost libraries, remove it from CI rather than adding yet another
special case for disabling Boost.Multiprecision tests.
2024-08-15 21:25:21 +03:00
b1b7f7c63d Raised compiler requirements for Boost.Multiprecision tests.
This is needed to avoid compilation errors caused by Boost.Math, as
it requires a C++14 compiler now.
2024-08-15 20:00:21 +03:00
6 changed files with 54 additions and 44 deletions

View File

@ -19,4 +19,5 @@ target_link_libraries(boost_integer
Boost::core
Boost::static_assert
Boost::throw_exception
Boost::type_traits
)

View File

@ -42,10 +42,6 @@ environment:
CXXSTD: 11,14,1z
ADDPATH: C:\cygwin64\bin;
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
- TOOLSET: gcc
CXXSTD: 11,14,1z
ADDPATH: C:\mingw\bin;
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
- TOOLSET: gcc
CXXSTD: 11,14,1z
ADDPATH: C:\mingw-w64\x86_64-6.3.0-posix-seh-rt_v5-rev1\mingw64\bin;

28
build.jam Normal file
View File

@ -0,0 +1,28 @@
# Copyright René Ferdinand Rivera Morell 2023-2024
# Distributed under the Boost Software License, Version 1.0.
# (See accompanying file LICENSE_1_0.txt or copy at
# http://www.boost.org/LICENSE_1_0.txt)
require-b2 5.2 ;
constant boost_dependencies :
/boost/assert//boost_assert
/boost/config//boost_config
/boost/core//boost_core
/boost/static_assert//boost_static_assert
/boost/throw_exception//boost_throw_exception
/boost/type_traits//boost_type_traits ;
project /boost/integer
: common-requirements
<include>include
;
explicit
[ alias boost_integer : : : : <library>$(boost_dependencies) ]
[ alias all : boost_integer test ]
;
call-if : boost-library integer
;

View File

@ -51,19 +51,20 @@ namespace boost {
//
// some helper functions which really should be constexpr already, but sadly aren't:
//
#ifndef BOOST_NO_CXX14_CONSTEXPR
template <class T>
inline constexpr T constexpr_min(T const& a, T const& b) BOOST_GCD_NOEXCEPT(T)
inline BOOST_CONSTEXPR T constexpr_min(T const& a, T const& b) BOOST_GCD_NOEXCEPT(T)
{
return a < b ? a : b;
}
#ifndef BOOST_NO_CXX14_CONSTEXPR
template <class T>
inline constexpr auto constexpr_swap(T&a, T& b) BOOST_GCD_NOEXCEPT(T) -> decltype(a.swap(b))
inline constexpr auto constexpr_swap(T& a, T& b) BOOST_GCD_NOEXCEPT(T) -> decltype(a.swap(b))
{
return a.swap(b);
}
template <class T, class U>
inline constexpr void constexpr_swap(T&a, U& b...) BOOST_GCD_NOEXCEPT(T)
inline constexpr void constexpr_swap(T& a, U& b, ...) BOOST_GCD_NOEXCEPT(T)
{
T t(static_cast<T&&>(a));
a = static_cast<T&&>(b);
@ -71,12 +72,7 @@ namespace boost {
}
#else
template <class T>
inline T constexpr_min(T const& a, T const& b) BOOST_GCD_NOEXCEPT(T)
{
return a < b ? a : b;
}
template <class T>
inline void constexpr_swap(T&a, T& b) BOOST_GCD_NOEXCEPT(T)
inline void constexpr_swap(T& a, T& b) BOOST_GCD_NOEXCEPT(T)
{
using std::swap;
swap(a, b);

View File

@ -2,10 +2,13 @@
#~ Distributed under the Boost Software License, Version 1.0.
#~ (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt)
require-b2 5.0.1 ;
import-search /boost/config/checks ;
import config : requires ;
import testing ;
import ../../config/checks/config : requires ;
project : requirements <warnings>all <toolset>gcc:<cxxflags>-Wextra ;
project : requirements <warnings>all <toolset>gcc:<cxxflags>-Wextra
<library>/boost/integer//boost_integer ;
obj has_gmpxx : has_gmpxx.cpp ;
explicit has_gmpxx ;
@ -13,18 +16,18 @@ explicit has_gmpxx ;
test-suite integer
:
[ run integer_traits_test.cpp ]
[ run integer_test.cpp : : : <toolset>gcc:<cxxflags>-Wno-long-long <toolset>darwin:<cxxflags>-Wno-long-long <toolset>sun:<cxxflags>"-Qoption ccfe -tmpldepth=128" ]
[ run integer_mask_test.cpp ]
[ run integer_log2_test.cpp ]
[ run static_log2_test.cpp ]
[ run static_min_max_test.cpp ]
[ run extended_euclidean_test.cpp ]
[ run mod_inverse_test.cpp ]
[ run integer_test.cpp : : : <library>/boost/mpl//boost_mpl <toolset>gcc:<cxxflags>-Wno-long-long <toolset>darwin:<cxxflags>-Wno-long-long <toolset>sun:<cxxflags>"-Qoption ccfe -tmpldepth=128" ]
[ run integer_mask_test.cpp : : : <library>/boost/detail//boost_detail ]
[ run integer_log2_test.cpp : : : <library>/boost/multiprecision//boost_multiprecision ]
[ run static_log2_test.cpp : : : <library>/boost/detail//boost_detail ]
[ run static_min_max_test.cpp : : : <library>/boost/detail//boost_detail ]
[ run extended_euclidean_test.cpp : : : <library>/boost/multiprecision//boost_multiprecision ]
[ run mod_inverse_test.cpp : : : <library>/boost/optional//boost_optional <library>/boost/multiprecision//boost_multiprecision ]
[ compile integer_traits_include_test.cpp ]
[ compile integer_include_test.cpp ]
[ compile integer_mask_include_test.cpp ]
[ compile static_log2_include_test.cpp ]
[ compile static_min_max_include_test.cpp ]
[ compile static_min_max_include_test.cpp : <library>/boost/detail//boost_detail ]
[ compile integer_fwd_include_test.cpp ]
[ compile gcd_constexpr14_test.cpp ]
[ compile gcd_noexcept_test.cpp ]
@ -35,5 +38,5 @@ test-suite integer
[ compile-fail fail_uint_fast.cpp ]
[ compile-fail fail_uint_least.cpp ]
[ compile-fail fail_uint_65.cpp ]
[ run common_factor_test.cpp : : : [ check-target-builds has_gmpxx "Checking for gmpxx.h" : <define>BOOST_INTEGER_HAS_GMPXX_H=1 <linkflags>-lgmp <linkflags>-lgmpxx ] ]
[ run common_factor_test.cpp : : : <library>/boost/mpl//boost_mpl <library>/boost/random//boost_random <library>/boost/rational//boost_rational <library>/boost/multiprecision//boost_multiprecision [ check-target-builds has_gmpxx "Checking for gmpxx.h" : <define>BOOST_INTEGER_HAS_GMPXX_H=1 <linkflags>-lgmp <linkflags>-lgmpxx ] ]
;

View File

@ -1,4 +1,4 @@
// Copyright (c) 2018 Andrey Semashev
// Copyright (c) 2018, 2024 Andrey Semashev
//
// Use, modification, and distribution is subject to the Boost Software
// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
@ -8,25 +8,11 @@
#define BOOST_INTEGER_TEST_MULTIPRECISION_CONFIG_HPP_INCLUDED_
#include <boost/config.hpp>
#include <boost/config/workaround.hpp>
#if (defined(BOOST_MSVC) && (BOOST_MSVC < 1500)) || \
(defined(__clang_major__) && (__clang_major__ == 3) && (__clang_minor__ < 2)) || \
(defined(BOOST_GCC) && defined(BOOST_GCC_CXX11) && BOOST_GCC < 40800)
#define DISABLE_MP_TESTS
#endif
// This list of checks matches those in Boost.Multiprecision, boost/multiprecision/detail/number_base.hpp,
// as it no longer supports C++03 since 2021.
#if !defined(DISABLE_MP_TESTS) && \
(\
defined(BOOST_NO_CXX11_RVALUE_REFERENCES) || defined(BOOST_NO_CXX11_TEMPLATE_ALIASES) || defined(BOOST_NO_CXX11_HDR_ARRAY) || defined(BOOST_NO_CXX11_HDR_TYPE_TRAITS)\
|| defined(BOOST_NO_CXX11_ALLOCATOR) || defined(BOOST_NO_CXX11_UNIFIED_INITIALIZATION_SYNTAX) || defined(BOOST_NO_CXX11_CONSTEXPR)\
|| (defined(BOOST_NO_CXX11_EXPLICIT_CONVERSION_OPERATORS) || BOOST_WORKAROUND(__SUNPRO_CC, < 0x5140)) || defined(BOOST_NO_CXX11_REF_QUALIFIERS) || defined(BOOST_NO_CXX11_HDR_FUNCTIONAL)\
|| defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) || defined(BOOST_NO_CXX11_USER_DEFINED_LITERALS) || defined(BOOST_NO_CXX11_THREAD_LOCAL)\
|| defined(BOOST_NO_CXX11_DECLTYPE) || defined(BOOST_NO_CXX11_STATIC_ASSERT) || defined(BOOST_NO_CXX11_DEFAULTED_FUNCTIONS)\
|| defined(BOOST_NO_CXX11_NOEXCEPT) || defined(BOOST_NO_CXX11_REF_QUALIFIERS)\
)
// Boost.Multiprecision requires a number of C++11 features, see boost/multiprecision/detail/check_cpp11_config.hpp.
// Also, Boost.Multiprecision internally uses Boost.Math, which requires C++14 and a recent enough MSVC, see boost/math/tools/config.hpp.
#if (BOOST_CXX_VERSION < 201402) || \
(defined(_MSC_VER) && (_MSC_VER <= 1900))
#define DISABLE_MP_TESTS
#endif