diff --git a/libcxx/test/support/controlled_allocators.h b/libcxx/test/support/controlled_allocators.h --- a/libcxx/test/support/controlled_allocators.h +++ b/libcxx/test/support/controlled_allocators.h @@ -183,13 +183,18 @@ template bool checkConstruct(Alloc const&, Tp *p) const { - auto expectAlloc = &makeTypeID(); - auto expectTp = &makeTypeID(); - auto expectArgs = &makeArgumentID(); - return last_construct_pointer == p && - COMPARE_TYPEID(last_construct_alloc, expectAlloc) && - COMPARE_TYPEID(last_construct_type, expectTp) && - COMPARE_TYPEID(last_construct_args, expectArgs); + auto expectAlloc = &makeTypeID(); + auto expectTp = &makeTypeID(); + auto expectArgs = &makeArgumentID(); + if (last_construct_pointer != p) + return false; + if (last_construct_alloc != expectAlloc) + return false; + if (last_construct_type != expectTp) + return false; + if (last_construct_args != expectArgs) + return false; + return true; } template diff --git a/libcxx/test/support/type_id.h b/libcxx/test/support/type_id.h --- a/libcxx/test/support/type_id.h +++ b/libcxx/test/support/type_id.h @@ -8,9 +8,7 @@ #ifndef SUPPORT_TYPE_ID_H #define SUPPORT_TYPE_ID_H -#include #include -#include #include #include "test_macros.h" @@ -70,20 +68,4 @@ return makeTypeIDImp>(); } - -// COMPARE_TYPEID(...) is a utility macro for generating diagnostics when -// two typeid's are expected to be equal -#define COMPARE_TYPEID(LHS, RHS) CompareTypeIDVerbose(#LHS, LHS, #RHS, RHS) - -inline bool CompareTypeIDVerbose(const char* LHSString, TypeID const* LHS, - const char* RHSString, TypeID const* RHS) { - if (*LHS == *RHS) - return true; - std::printf("TypeID's not equal:\n"); - std::printf("%s: %s\n----------\n%s: %s\n", - LHSString, LHS->name().c_str(), - RHSString, RHS->name().c_str()); - return false; -} - #endif // SUPPORT_TYPE_ID_H diff --git a/libcxx/test/support/uses_alloc_types.h b/libcxx/test/support/uses_alloc_types.h --- a/libcxx/test/support/uses_alloc_types.h +++ b/libcxx/test/support/uses_alloc_types.h @@ -10,7 +10,6 @@ #define USES_ALLOC_TYPES_H #include -#include #include #include @@ -44,17 +43,6 @@ } } -#define COMPARE_ALLOC_TYPE(LHS, RHS) CompareVerbose(#LHS, LHS, #RHS, RHS) - -inline bool CompareVerbose(const char* LHSString, UsesAllocatorType LHS, - const char* RHSString, UsesAllocatorType RHS) { - if (LHS == RHS) - return true; - std::printf("UsesAllocatorType's don't match:\n%s %s\n----------\n%s %s\n", - LHSString, toString(LHS), RHSString, toString(RHS)); - return false; -} - template class UsesAllocatorV1; // Implements form (1) of uses-allocator construction from the specified @@ -191,26 +179,36 @@ template bool checkConstruct(UsesAllocatorType expectType) const { auto expectArgs = &makeArgumentID(); - return COMPARE_ALLOC_TYPE(expectType, constructor_called) && - COMPARE_TYPEID(args_id, expectArgs); + if (expectType != constructor_called) + return false; + if (args_id != expectArgs) + return false; + return true; } template bool checkConstruct(UsesAllocatorType expectType, CtorAlloc const& expectAlloc) const { auto ExpectID = &makeArgumentID() ; - return COMPARE_ALLOC_TYPE(expectType, constructor_called) && - COMPARE_TYPEID(args_id, ExpectID) && - has_alloc() && expectAlloc == *get_alloc(); - + if (expectType != constructor_called) + return false; + if (args_id != ExpectID) + return false; + if (!has_alloc() || expectAlloc != *get_alloc()) + return false; + return true; } bool checkConstructEquiv(UsesAllocatorTestBase& O) const { if (has_alloc() != O.has_alloc()) return false; - return COMPARE_ALLOC_TYPE(constructor_called, O.constructor_called) - && COMPARE_TYPEID(args_id, O.args_id) - && (!has_alloc() || *get_alloc() == *O.get_alloc()); + if (constructor_called != O.constructor_called) + return false; + if (args_id != O.args_id) + return false; + if (has_alloc() && *get_alloc() != *O.get_alloc()) + return false; + return true; } protected: