Add a configuration macro for Sun C++ workarounds

This commit is contained in:
Daniel James
2017-05-16 18:23:23 +01:00
parent 6fffc738f7
commit ee9a5a2c77
5 changed files with 32 additions and 19 deletions

View File

@ -59,6 +59,19 @@
// Unless documented elsewhere these configuration macros should be considered
// an implementation detail, I'll try not to break them, but you never know.
// Use Sun C++ workarounds
// I'm not sure which versions of the compiler require these workarounds, so
// I'm just using them of everything older than the current test compilers
// (as of May 2017).
#if !defined(BOOST_UNORDERED_SUN_WORKAROUNDS1)
#if BOOST_COMP_SUNPRO && BOOST_COMP_SUNPRO < BOOST_VERSION_NUMBER(5, 21, 0)
#define BOOST_UNORDERED_SUN_WORKAROUNDS1 1
#else
#define BOOST_UNORDERED_SUN_WORKAROUNDS1 0
#endif
#endif
// BOOST_UNORDERED_EMPLACE_LIMIT = The maximum number of parameters in
// emplace (not including things like hints). Don't set it to a lower value, as
// that might break something.
@ -100,7 +113,7 @@
// I had problems with tuples on older versions of the sunpro.
// Might be fixed in an earlier version than I specified here.
#elif BOOST_COMP_SUNPRO && BOOST_COMP_SUNPRO < BOOST_VERSION_NUMBER(5, 21, 0)
#elif BOOST_UNORDERED_SUN_WORKAROUNDS1
#define BOOST_UNORDERED_TUPLE_ARGS 0
// Assume if we have C++11 tuple it's properly variadic,
@ -270,7 +283,7 @@ template <class T> struct prime_list_template
{
static std::size_t const value[];
#if !(BOOST_COMP_SUNPRO && BOOST_COMP_SUNPRO < BOOST_VERSION_NUMBER(5, 21, 0))
#if !BOOST_UNORDERED_SUN_WORKAROUNDS1
static std::ptrdiff_t const length;
#else
static std::ptrdiff_t const length =
@ -282,7 +295,7 @@ template <class T>
std::size_t const prime_list_template<T>::value[] = {
BOOST_PP_SEQ_ENUM(BOOST_UNORDERED_PRIMES)};
#if !(BOOST_COMP_SUNPRO && BOOST_COMP_SUNPRO < BOOST_VERSION_NUMBER(5, 21, 0))
#if !BOOST_UNORDERED_SUN_WORKAROUNDS1
template <class T>
std::ptrdiff_t const prime_list_template<T>::length = BOOST_PP_SEQ_SIZE(
BOOST_UNORDERED_PRIMES);
@ -1336,7 +1349,7 @@ inline void construct_value(T* address, BOOST_FWD_REF(A0) a0)
//
// Used to emulate piecewise construction.
#if !(BOOST_COMP_SUNPRO && BOOST_COMP_SUNPRO < BOOST_VERSION_NUMBER(5, 21, 0))
#if !BOOST_UNORDERED_SUN_WORKAROUNDS1
#define BOOST_UNORDERED_CONSTRUCT_FROM_TUPLE(z, n, namespace_) \
template <typename Alloc, typename T, \
@ -1395,7 +1408,7 @@ BOOST_PP_REPEAT_FROM_TO(6, BOOST_PP_INC(BOOST_UNORDERED_TUPLE_ARGS),
#undef BOOST_UNORDERED_CONSTRUCT_FROM_TUPLE
#undef BOOST_UNORDERED_GET_TUPLE_ARG
#else // __SUNPRO_CC
#else // BOOST_UNORDERED_SUN_WORKAROUNDS1
template <int N> struct length
{

View File

@ -230,7 +230,7 @@ template <class K, class T, class H, class P, class A> class unordered_map
#else
#if !(BOOST_COMP_SUNPRO && BOOST_COMP_SUNPRO < BOOST_VERSION_NUMBER(5, 21, 0))
#if !BOOST_UNORDERED_SUN_WORKAROUNDS1
// 0 argument emplace requires special treatment in case
// the container is instantiated with a value type that
@ -292,7 +292,7 @@ template <class K, class T, class H, class P, class A> class unordered_map
#else
#if !(BOOST_COMP_SUNPRO && BOOST_COMP_SUNPRO < BOOST_VERSION_NUMBER(5, 21, 0))
#if !BOOST_UNORDERED_SUN_WORKAROUNDS1
iterator emplace_hint(const_iterator hint,
boost::unordered::detail::empty_emplace =
@ -1031,7 +1031,7 @@ template <class K, class T, class H, class P, class A> class unordered_multimap
#else
#if !(BOOST_COMP_SUNPRO && BOOST_COMP_SUNPRO < BOOST_VERSION_NUMBER(5, 21, 0))
#if !BOOST_UNORDERED_SUN_WORKAROUNDS1
// 0 argument emplace requires special treatment in case
// the container is instantiated with a value type that
@ -1091,7 +1091,7 @@ template <class K, class T, class H, class P, class A> class unordered_multimap
#else
#if !(BOOST_COMP_SUNPRO && BOOST_COMP_SUNPRO < BOOST_VERSION_NUMBER(5, 21, 0))
#if !BOOST_UNORDERED_SUN_WORKAROUNDS1
iterator emplace_hint(const_iterator hint,
boost::unordered::detail::empty_emplace =

View File

@ -228,7 +228,7 @@ template <class T, class H, class P, class A> class unordered_set
#else
#if !(BOOST_COMP_SUNPRO && BOOST_COMP_SUNPRO < BOOST_VERSION_NUMBER(5, 21, 0))
#if !BOOST_UNORDERED_SUN_WORKAROUNDS1
// 0 argument emplace requires special treatment in case
// the container is instantiated with a value type that
@ -290,7 +290,7 @@ template <class T, class H, class P, class A> class unordered_set
#else
#if !(BOOST_COMP_SUNPRO && BOOST_COMP_SUNPRO < BOOST_VERSION_NUMBER(5, 21, 0))
#if !BOOST_UNORDERED_SUN_WORKAROUNDS1
iterator emplace_hint(const_iterator hint,
boost::unordered::detail::empty_emplace =
@ -737,7 +737,7 @@ template <class T, class H, class P, class A> class unordered_multiset
#else
#if !(BOOST_COMP_SUNPRO && BOOST_COMP_SUNPRO < BOOST_VERSION_NUMBER(5, 21, 0))
#if !BOOST_UNORDERED_SUN_WORKAROUNDS1
// 0 argument emplace requires special treatment in case
// the container is instantiated with a value type that
@ -797,7 +797,7 @@ template <class T, class H, class P, class A> class unordered_multiset
#else
#if !(BOOST_COMP_SUNPRO && BOOST_COMP_SUNPRO < BOOST_VERSION_NUMBER(5, 21, 0))
#if !BOOST_UNORDERED_SUN_WORKAROUNDS1
iterator emplace_hint(const_iterator hint,
boost::unordered::detail::empty_emplace =

View File

@ -530,7 +530,7 @@ template <class X> void move_emplace_tests(X*, test::random_generator generator)
template <class X> void default_emplace_tests(X*, test::random_generator)
{
#if !BOOST_WORKAROUND(__SUNPRO_CC, BOOST_TESTED_AT(0x5100))
#if !BOOST_UNORDERED_SUN_WORKAROUNDS1
bool is_unique = test::has_unique_keys<X>::value;
X x;
@ -1108,7 +1108,7 @@ UNORDERED_AUTO_TEST(map_emplace_test)
test::allocator1<std::pair<int const, overloaded_constructor> > >
x;
#if !BOOST_WORKAROUND(__SUNPRO_CC, BOOST_TESTED_AT(0x5100))
#if !BOOST_UNORDERED_SUN_WORKAROUNDS1
x.emplace();
BOOST_TEST(x.find(0) != x.end() &&
x.find(0)->second == overloaded_constructor());
@ -1129,7 +1129,7 @@ UNORDERED_AUTO_TEST(map_emplace_test)
test::allocator1<std::pair<int const, overloaded_constructor> > >
x;
#if !BOOST_WORKAROUND(__SUNPRO_CC, BOOST_TESTED_AT(0x5100))
#if !BOOST_UNORDERED_SUN_WORKAROUNDS1
x.emplace();
BOOST_TEST(x.find(0) != x.end() &&
x.find(0)->second == overloaded_constructor());
@ -1146,7 +1146,7 @@ UNORDERED_AUTO_TEST(set_emplace_test)
boost::unordered_set<overloaded_constructor> x;
overloaded_constructor check;
#if !BOOST_WORKAROUND(__SUNPRO_CC, BOOST_TESTED_AT(0x5100))
#if !BOOST_UNORDERED_SUN_WORKAROUNDS1
x.emplace();
BOOST_TEST(x.find(check) != x.end() && *x.find(check) == check);
#endif

View File

@ -362,7 +362,7 @@ UNORDERED_AUTO_TEST(unnecessary_copy_emplace_set_test)
// 0 arguments
//
#if !BOOST_WORKAROUND(__SUNPRO_CC, BOOST_TESTED_AT(0x5100))
#if !BOOST_UNORDERED_SUN_WORKAROUNDS1
// The container will have to create a copy in order to compare with
// the existing element.
reset();
@ -451,7 +451,7 @@ UNORDERED_AUTO_TEST(unnecessary_copy_emplace_map_test)
// 0 arguments
//
#if !BOOST_WORKAROUND(__SUNPRO_CC, BOOST_TESTED_AT(0x5100))
#if !BOOST_UNORDERED_SUN_WORKAROUNDS1
// COPY_COUNT(1) would be okay here.
reset();
x.emplace();