Merge branch 'develop'

This commit is contained in:
jzmaddock
2014-03-13 17:37:03 +00:00
4 changed files with 38 additions and 79 deletions

View File

@ -177,7 +177,7 @@ class type_with_alignment
};
#if defined(__GNUC__)
namespace align {
namespace tt_align_ns {
struct __attribute__((__aligned__(2))) a2 {};
struct __attribute__((__aligned__(4))) a4 {};
struct __attribute__((__aligned__(8))) a8 {};
@ -188,22 +188,22 @@ struct __attribute__((__aligned__(128))) a128 {};
}
template<> class type_with_alignment<1> { public: typedef char type; };
template<> class type_with_alignment<2> { public: typedef align::a2 type; };
template<> class type_with_alignment<4> { public: typedef align::a4 type; };
template<> class type_with_alignment<8> { public: typedef align::a8 type; };
template<> class type_with_alignment<16> { public: typedef align::a16 type; };
template<> class type_with_alignment<32> { public: typedef align::a32 type; };
template<> class type_with_alignment<64> { public: typedef align::a64 type; };
template<> class type_with_alignment<128> { public: typedef align::a128 type; };
template<> class type_with_alignment<2> { public: typedef tt_align_ns::a2 type; };
template<> class type_with_alignment<4> { public: typedef tt_align_ns::a4 type; };
template<> class type_with_alignment<8> { public: typedef tt_align_ns::a8 type; };
template<> class type_with_alignment<16> { public: typedef tt_align_ns::a16 type; };
template<> class type_with_alignment<32> { public: typedef tt_align_ns::a32 type; };
template<> class type_with_alignment<64> { public: typedef tt_align_ns::a64 type; };
template<> class type_with_alignment<128> { public: typedef tt_align_ns::a128 type; };
namespace detail {
BOOST_TT_AUX_BOOL_TRAIT_IMPL_SPEC1(is_pod,::boost::align::a2,true)
BOOST_TT_AUX_BOOL_TRAIT_IMPL_SPEC1(is_pod,::boost::align::a4,true)
BOOST_TT_AUX_BOOL_TRAIT_IMPL_SPEC1(is_pod,::boost::align::a8,true)
BOOST_TT_AUX_BOOL_TRAIT_IMPL_SPEC1(is_pod,::boost::align::a16,true)
BOOST_TT_AUX_BOOL_TRAIT_IMPL_SPEC1(is_pod,::boost::align::a32,true)
BOOST_TT_AUX_BOOL_TRAIT_IMPL_SPEC1(is_pod,::boost::align::a64,true)
BOOST_TT_AUX_BOOL_TRAIT_IMPL_SPEC1(is_pod,::boost::align::a128,true)
BOOST_TT_AUX_BOOL_TRAIT_IMPL_SPEC1(is_pod,::boost::tt_align_ns::a2,true)
BOOST_TT_AUX_BOOL_TRAIT_IMPL_SPEC1(is_pod,::boost::tt_align_ns::a4,true)
BOOST_TT_AUX_BOOL_TRAIT_IMPL_SPEC1(is_pod,::boost::tt_align_ns::a8,true)
BOOST_TT_AUX_BOOL_TRAIT_IMPL_SPEC1(is_pod,::boost::tt_align_ns::a16,true)
BOOST_TT_AUX_BOOL_TRAIT_IMPL_SPEC1(is_pod,::boost::tt_align_ns::a32,true)
BOOST_TT_AUX_BOOL_TRAIT_IMPL_SPEC1(is_pod,::boost::tt_align_ns::a64,true)
BOOST_TT_AUX_BOOL_TRAIT_IMPL_SPEC1(is_pod,::boost::tt_align_ns::a128,true)
}
#endif
#if defined(BOOST_MSVC) || (defined(BOOST_INTEL) && defined(_MSC_VER))
@ -223,7 +223,7 @@ BOOST_TT_AUX_BOOL_TRAIT_IMPL_SPEC1(is_pod,::boost::align::a128,true)
// Boost.Optional). However, this only happens when we have no choice
// in the matter because no other "ordinary" type is available.
//
namespace align {
namespace tt_align_ns {
struct __declspec(align(8)) a8 {
char m[8];
typedef a8 type;
@ -251,7 +251,7 @@ template<> class type_with_alignment<8>
{
typedef mpl::if_c<
::boost::alignment_of<boost::detail::max_align>::value < 8,
align::a8,
tt_align_ns::a8,
boost::detail::type_with_alignment_imp<8> >::type t1;
public:
typedef t1::type type;
@ -260,7 +260,7 @@ template<> class type_with_alignment<16>
{
typedef mpl::if_c<
::boost::alignment_of<boost::detail::max_align>::value < 16,
align::a16,
tt_align_ns::a16,
boost::detail::type_with_alignment_imp<16> >::type t1;
public:
typedef t1::type type;
@ -269,7 +269,7 @@ template<> class type_with_alignment<32>
{
typedef mpl::if_c<
::boost::alignment_of<boost::detail::max_align>::value < 32,
align::a32,
tt_align_ns::a32,
boost::detail::type_with_alignment_imp<32> >::type t1;
public:
typedef t1::type type;
@ -277,7 +277,7 @@ public:
template<> class type_with_alignment<64> {
typedef mpl::if_c<
::boost::alignment_of<boost::detail::max_align>::value < 64,
align::a64,
tt_align_ns::a64,
boost::detail::type_with_alignment_imp<64> >::type t1;
public:
typedef t1::type type;
@ -285,18 +285,18 @@ public:
template<> class type_with_alignment<128> {
typedef mpl::if_c<
::boost::alignment_of<boost::detail::max_align>::value < 128,
align::a128,
tt_align_ns::a128,
boost::detail::type_with_alignment_imp<128> >::type t1;
public:
typedef t1::type type;
};
namespace detail {
BOOST_TT_AUX_BOOL_TRAIT_IMPL_SPEC1(is_pod,::boost::align::a8,true)
BOOST_TT_AUX_BOOL_TRAIT_IMPL_SPEC1(is_pod,::boost::align::a16,true)
BOOST_TT_AUX_BOOL_TRAIT_IMPL_SPEC1(is_pod,::boost::align::a32,true)
BOOST_TT_AUX_BOOL_TRAIT_IMPL_SPEC1(is_pod,::boost::align::a64,true)
BOOST_TT_AUX_BOOL_TRAIT_IMPL_SPEC1(is_pod,::boost::align::a128,true)
BOOST_TT_AUX_BOOL_TRAIT_IMPL_SPEC1(is_pod,::boost::tt_align_ns::a8,true)
BOOST_TT_AUX_BOOL_TRAIT_IMPL_SPEC1(is_pod,::boost::tt_align_ns::a16,true)
BOOST_TT_AUX_BOOL_TRAIT_IMPL_SPEC1(is_pod,::boost::tt_align_ns::a32,true)
BOOST_TT_AUX_BOOL_TRAIT_IMPL_SPEC1(is_pod,::boost::tt_align_ns::a64,true)
BOOST_TT_AUX_BOOL_TRAIT_IMPL_SPEC1(is_pod,::boost::tt_align_ns::a128,true)
}
#endif
@ -308,7 +308,7 @@ BOOST_TT_AUX_BOOL_TRAIT_IMPL_SPEC1(is_pod,::boost::align::a128,true)
// 2) Because of Borlands #pragma option we can create types with alignments that are
// greater that the largest aligned builtin type.
namespace align{
namespace tt_align_ns{
#pragma option push -a16
struct a2{ short s; };
struct a4{ int s; };
@ -319,13 +319,13 @@ struct a16{ long double s; };
namespace detail {
typedef ::boost::align::a16 max_align;
typedef ::boost::tt_align_ns::a16 max_align;
//#if ! BOOST_WORKAROUND(__CODEGEARC__, BOOST_TESTED_AT(0x610))
BOOST_TT_AUX_BOOL_TRAIT_IMPL_SPEC1(is_pod,::boost::align::a2,true)
BOOST_TT_AUX_BOOL_TRAIT_IMPL_SPEC1(is_pod,::boost::align::a4,true)
BOOST_TT_AUX_BOOL_TRAIT_IMPL_SPEC1(is_pod,::boost::align::a8,true)
BOOST_TT_AUX_BOOL_TRAIT_IMPL_SPEC1(is_pod,::boost::align::a16,true)
BOOST_TT_AUX_BOOL_TRAIT_IMPL_SPEC1(is_pod,::boost::tt_align_ns::a2,true)
BOOST_TT_AUX_BOOL_TRAIT_IMPL_SPEC1(is_pod,::boost::tt_align_ns::a4,true)
BOOST_TT_AUX_BOOL_TRAIT_IMPL_SPEC1(is_pod,::boost::tt_align_ns::a8,true)
BOOST_TT_AUX_BOOL_TRAIT_IMPL_SPEC1(is_pod,::boost::tt_align_ns::a16,true)
//#endif
}
@ -334,13 +334,13 @@ template <std::size_t N> struct type_with_alignment
// We should never get to here, but if we do use the maximally
// aligned type:
// BOOST_STATIC_ASSERT(0);
typedef align::a16 type;
typedef tt_align_ns::a16 type;
};
template <> struct type_with_alignment<1>{ typedef char type; };
template <> struct type_with_alignment<2>{ typedef align::a2 type; };
template <> struct type_with_alignment<4>{ typedef align::a4 type; };
template <> struct type_with_alignment<8>{ typedef align::a8 type; };
template <> struct type_with_alignment<16>{ typedef align::a16 type; };
template <> struct type_with_alignment<2>{ typedef tt_align_ns::a2 type; };
template <> struct type_with_alignment<4>{ typedef tt_align_ns::a4 type; };
template <> struct type_with_alignment<8>{ typedef tt_align_ns::a8 type; };
template <> struct type_with_alignment<16>{ typedef tt_align_ns::a16 type; };
#endif

View File

@ -7,11 +7,7 @@
#ifndef BOOST_CHECK_INTEGRAL_CONSTANT_HPP
#define BOOST_CHECK_INTEGRAL_CONSTANT_HPP
#ifdef USE_UNIT_TEST
#include <boost/test/test_tools.hpp>
#else
#include "test.hpp"
#endif
namespace boost{
namespace detail{

View File

@ -7,11 +7,7 @@
#ifndef BOOST_CHECK_TYPE_HPP
#define BOOST_CHECK_TYPE_HPP
#ifdef USE_UNIT_TEST
#include <boost/test/test_tools.hpp>
#else
#include "test.hpp"
#endif
#include <boost/type_traits/is_same.hpp>
/*

View File

@ -13,10 +13,7 @@
#pragma warning(disable:4201)
#endif
#ifdef USE_UNIT_TEST
# include <boost/test/unit_test.hpp>
#endif
#include <boost/utility.hpp>
#include <boost/noncopyable.hpp>
#include <iostream>
#include <typeinfo>
@ -62,35 +59,6 @@
#endif
#ifdef USE_UNIT_TEST
//
// global unit, this is not safe, but until the unit test framework uses
// shared_ptr throughout this is about as good as it gets :-(
//
boost::unit_test::test_suite* get_master_unit(const char* name = 0);
//
// initialisation class:
//
class unit_initialiser
{
public:
unit_initialiser(void (*f)(), const char* /*name*/)
{
get_master_unit("Type Traits")->add( BOOST_TEST_CASE(f) );
}
};
#define TT_TEST_BEGIN(trait_name)\
namespace{\
void trait_name();\
unit_initialiser init(trait_name, BOOST_STRINGIZE(trait_name));\
void trait_name(){
#define TT_TEST_END }}
#else
//
// replacements for Unit test macros:
//
@ -128,7 +96,6 @@ int error_count = 0;
int main(){
#define TT_TEST_END return error_count; }
#endif
#define TRANSFORM_CHECK(name, from_suffix, to_suffix)\
BOOST_CHECK_TYPE(bool to_suffix, name<bool from_suffix>::type);\