forked from boostorg/move
- Remove config_begin.hpp/config_end.hpp includes in tests to avoid disabling warnings.
- Fixes #30 ("(void) C-cast is a non-portable way of suppressing compiler warnings").
This commit is contained in:
@@ -8,7 +8,6 @@
|
||||
// See http://www.boost.org/libs/move for documentation.
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
#include <boost/move/detail/config_begin.hpp>
|
||||
#include <boost/move/adl_move_swap.hpp>
|
||||
#include <boost/move/core.hpp>
|
||||
#include <boost/core/lightweight_test.hpp>
|
||||
@@ -166,4 +165,3 @@ int main()
|
||||
}
|
||||
return ::boost::report_errors();
|
||||
}
|
||||
#include <boost/move/detail/config_end.hpp>
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
// See http://www.boost.org/libs/move for documentation.
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
#include <boost/move/detail/config_begin.hpp>
|
||||
|
||||
// move
|
||||
#include <boost/move/algorithm.hpp>
|
||||
#include <boost/move/iterator.hpp>
|
||||
@@ -76,5 +76,3 @@ int main()
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
#include <boost/move/detail/config_end.hpp>
|
||||
|
||||
+10
-11
@@ -8,8 +8,9 @@
|
||||
// See http://www.boost.org/libs/move for documentation.
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
#include <boost/move/detail/config_begin.hpp>
|
||||
|
||||
#include <boost/move/utility_core.hpp>
|
||||
|
||||
#include <boost/utility/enable_if.hpp>
|
||||
#include "../example/movable.hpp"
|
||||
#include "../example/copymovable.hpp"
|
||||
@@ -23,36 +24,36 @@ class non_movable
|
||||
};
|
||||
|
||||
template<class MaybeRvalue>
|
||||
void catch_test(BOOST_RV_REF(MaybeRvalue) x
|
||||
void catch_test(BOOST_RV_REF(MaybeRvalue)
|
||||
#ifdef BOOST_NO_CXX11_RVALUE_REFERENCES
|
||||
,typename ::boost::enable_if< ::boost::has_move_emulation_enabled<MaybeRvalue> >::type* = 0
|
||||
#endif //BOOST_NO_CXX11_RVALUE_REFERENCES
|
||||
)
|
||||
{ (void)x;}
|
||||
{}
|
||||
|
||||
template<class MaybeRvalue>
|
||||
void catch_test(BOOST_COPY_ASSIGN_REF(MaybeRvalue) x
|
||||
void catch_test(BOOST_COPY_ASSIGN_REF(MaybeRvalue)
|
||||
#ifdef BOOST_NO_CXX11_RVALUE_REFERENCES
|
||||
,typename ::boost::enable_if< ::boost::has_move_emulation_enabled<MaybeRvalue> >::type* = 0
|
||||
#endif //BOOST_NO_CXX11_RVALUE_REFERENCES
|
||||
)
|
||||
|
||||
{ (void)x;}
|
||||
{}
|
||||
|
||||
template<class MaybeRvalue>
|
||||
void catch_test(MaybeRvalue &x
|
||||
void catch_test(MaybeRvalue &
|
||||
#ifdef BOOST_NO_CXX11_RVALUE_REFERENCES
|
||||
,typename ::boost::enable_if< ::boost::has_move_emulation_enabled<MaybeRvalue> >::type* = 0
|
||||
#endif //BOOST_NO_CXX11_RVALUE_REFERENCES
|
||||
)
|
||||
{ (void)x;}
|
||||
{}
|
||||
|
||||
#ifdef BOOST_NO_CXX11_RVALUE_REFERENCES
|
||||
template<class MaybeRvalue>
|
||||
void catch_test(const MaybeRvalue& x
|
||||
void catch_test(const MaybeRvalue&
|
||||
,typename ::boost::disable_if< ::boost::has_move_emulation_enabled<MaybeRvalue> >::type* = 0
|
||||
)
|
||||
{ (void)x;}
|
||||
{}
|
||||
#endif //BOOST_NO_CXX11_RVALUE_REFERENCES
|
||||
|
||||
movable create_movable()
|
||||
@@ -113,5 +114,3 @@ int main()
|
||||
forward_test();
|
||||
return 0;
|
||||
}
|
||||
|
||||
#include <boost/move/detail/config_end.hpp>
|
||||
|
||||
@@ -2,9 +2,9 @@
|
||||
// Software License, Version 1.0. (See accompanying
|
||||
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#include <boost/move/detail/config_begin.hpp>
|
||||
#include <iostream>
|
||||
#include <boost/core/lightweight_test.hpp>
|
||||
#include <boost/core/ignore_unused.hpp>
|
||||
|
||||
#ifdef NO_MOVE
|
||||
# undef BOOST_COPY_ASSIGN_REF
|
||||
@@ -148,7 +148,7 @@ X ternary( bool y )
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
(void)argv;
|
||||
::boost::ignore_unused(argv);
|
||||
// Double parens prevent "most vexing parse"
|
||||
CHECK_COPIES( X a(( lvalue() )), 1U, 1U, "Direct initialization from lvalue");
|
||||
CHECK_COPIES( X a(( rvalue() )), 0U, 1U, "Direct initialization from rvalue");
|
||||
@@ -173,5 +173,3 @@ int main(int argc, char* argv[])
|
||||
CHECK_COPIES( X a = ternary( argc != 1000 ), 0U, 2U, "Return result of ternary operation again" );
|
||||
return boost::report_errors();
|
||||
}
|
||||
|
||||
#include <boost/move/detail/config_end.hpp>
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
//Optimization:
|
||||
//Since RVO is better than move-construction,
|
||||
//avoid copy constructor overloading.
|
||||
#include <boost/move/detail/config_begin.hpp>
|
||||
|
||||
#include <boost/move/utility_core.hpp>
|
||||
#include <iostream>
|
||||
|
||||
@@ -103,5 +103,3 @@ int main()
|
||||
//1 rv<T> & constructor: move constructor
|
||||
//1 const rv<T> & constructor: copy constructor
|
||||
//1 T & constructor: copy constructor
|
||||
|
||||
#include <boost/move/detail/config_end.hpp>
|
||||
|
||||
+16
-18
@@ -9,8 +9,8 @@
|
||||
// See http://www.boost.org/libs/move for documentation.
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
#include <boost/move/detail/config_begin.hpp>
|
||||
#include <boost/move/utility_core.hpp>
|
||||
#include <boost/core/ignore_unused.hpp>
|
||||
#include "../example/movable.hpp"
|
||||
#include "../example/copymovable.hpp"
|
||||
#include <boost/static_assert.hpp>
|
||||
@@ -110,40 +110,40 @@ int main()
|
||||
movable m2(boost::move(m));
|
||||
movable m3(function(movable(boost::move(m2))));
|
||||
movable m4(function(boost::move(m3)));
|
||||
(void)m;(void)m2;(void)m3;(void)m4;
|
||||
::boost::ignore_unused(m);::boost::ignore_unused(m2);::boost::ignore_unused(m3);::boost::ignore_unused(m4);
|
||||
}
|
||||
{
|
||||
movable m;
|
||||
movable m2(boost::move(m));
|
||||
movable m3(functionr(movable(boost::move(m2))));
|
||||
movable m4(functionr(boost::move(m3)));
|
||||
(void)m;(void)m2;(void)m3;(void)m4;
|
||||
::boost::ignore_unused(m);::boost::ignore_unused(m2);::boost::ignore_unused(m3);::boost::ignore_unused(m4);
|
||||
}
|
||||
{
|
||||
movable m;
|
||||
movable m2(boost::move(m));
|
||||
movable m3(function2(movable(boost::move(m2))));
|
||||
movable m4(function2(boost::move(m3)));
|
||||
(void)m;(void)m2;(void)m3;(void)m4;
|
||||
::boost::ignore_unused(m);::boost::ignore_unused(m2);::boost::ignore_unused(m3);::boost::ignore_unused(m4);
|
||||
}
|
||||
{
|
||||
movable m;
|
||||
movable m2(boost::move(m));
|
||||
movable m3(function2r(movable(boost::move(m2))));
|
||||
movable m4(function2r(boost::move(m3)));
|
||||
(void)m;(void)m2;(void)m3;(void)m4;
|
||||
::boost::ignore_unused(m);::boost::ignore_unused(m2);::boost::ignore_unused(m3);::boost::ignore_unused(m4);
|
||||
}
|
||||
{
|
||||
movable m;
|
||||
movable m2(boost::move(m));
|
||||
movable m3(move_return_function());
|
||||
(void)m;(void)m2;(void)m3;
|
||||
::boost::ignore_unused(m);::boost::ignore_unused(m2);::boost::ignore_unused(m3);
|
||||
}
|
||||
{
|
||||
movable m;
|
||||
movable m2(boost::move(m));
|
||||
movable m3(move_return_function2());
|
||||
(void)m;(void)m2;(void)m3;
|
||||
::boost::ignore_unused(m);::boost::ignore_unused(m2);::boost::ignore_unused(m3);
|
||||
}
|
||||
{
|
||||
//movable
|
||||
@@ -151,9 +151,9 @@ int main()
|
||||
m = factory_wrapper<movable>(factory<movable>());
|
||||
movable&mr(factory_wrapper<movable&>(factory<movable&>()));
|
||||
movable&mr2 = factory_wrapper<movable&>(factory<movable&>());
|
||||
(void)mr;
|
||||
(void)mr2;
|
||||
(void)m;
|
||||
::boost::ignore_unused(mr);
|
||||
::boost::ignore_unused(mr2);
|
||||
::boost::ignore_unused(m);
|
||||
}
|
||||
{
|
||||
//copyable
|
||||
@@ -161,9 +161,9 @@ int main()
|
||||
c = factory_wrapper<copyable>(factory<copyable>());
|
||||
copyable&cr(factory_wrapper<copyable&>(factory<copyable&>()));
|
||||
copyable&cr2 = factory_wrapper<copyable&>(factory<copyable&>());
|
||||
(void)cr;
|
||||
(void)cr2;
|
||||
(void)c;
|
||||
::boost::ignore_unused(cr);
|
||||
::boost::ignore_unused(cr2);
|
||||
::boost::ignore_unused(c);
|
||||
}
|
||||
|
||||
{
|
||||
@@ -172,12 +172,10 @@ int main()
|
||||
c = factory_wrapper<copy_movable>(factory<copy_movable>());
|
||||
copy_movable&cr(factory_wrapper<copy_movable&>(factory<copy_movable&>()));
|
||||
copy_movable&cr2 = factory_wrapper<copy_movable&>(factory<copy_movable&>());
|
||||
(void)cr;
|
||||
(void)cr2;
|
||||
(void)c;
|
||||
::boost::ignore_unused(cr);
|
||||
::boost::ignore_unused(cr2);
|
||||
::boost::ignore_unused(c);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
#include <boost/move/detail/config_end.hpp>
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
// See http://www.boost.org/libs/move for documentation.
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
#include <boost/move/detail/config_begin.hpp>
|
||||
|
||||
#include <boost/move/algorithm.hpp>
|
||||
#include <boost/container/vector.hpp>
|
||||
#include "../example/movable.hpp"
|
||||
@@ -54,5 +54,3 @@ int main()
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
#include <boost/move/detail/config_end.hpp>
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
// See http://www.boost.org/libs/move for documentation.
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
#include <boost/move/detail/config_begin.hpp>
|
||||
|
||||
#include <boost/move/utility.hpp>
|
||||
#include <boost/core/lightweight_test.hpp>
|
||||
#include "../example/movable.hpp"
|
||||
@@ -226,5 +226,3 @@ int main()
|
||||
|
||||
return boost::report_errors();
|
||||
}
|
||||
|
||||
#include <boost/move/detail/config_end.hpp>
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
// See http://www.boost.org/libs/move for documentation.
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
#include <boost/move/detail/config_begin.hpp>
|
||||
|
||||
#include <boost/move/iterator.hpp>
|
||||
#include <boost/container/vector.hpp>
|
||||
#include <boost/core/lightweight_test.hpp>
|
||||
@@ -40,5 +40,3 @@ int main()
|
||||
|
||||
return ::boost::report_errors();
|
||||
}
|
||||
|
||||
#include <boost/move/detail/config_end.hpp>
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
#include <boost/move/utility_core.hpp>
|
||||
#include <boost/core/ignore_unused.hpp>
|
||||
#include <boost/move/unique_ptr.hpp>
|
||||
#include <boost/static_assert.hpp>
|
||||
#include <boost/move/adl_move_swap.hpp>
|
||||
@@ -88,7 +89,7 @@ void test()
|
||||
bml::unique_ptr<A> p(new A);
|
||||
BOOST_TEST(A::count == 1);
|
||||
A* i = p.get();
|
||||
(void)i;
|
||||
::boost::ignore_unused(i);
|
||||
p.reset();
|
||||
BOOST_TEST(A::count == 0);
|
||||
BOOST_TEST(p.get() == 0);
|
||||
@@ -98,7 +99,7 @@ void test()
|
||||
bml::unique_ptr<A> p(new A);
|
||||
BOOST_TEST(A::count == 1);
|
||||
A* i = p.get();
|
||||
(void)i;
|
||||
::boost::ignore_unused(i);
|
||||
p.reset(new A);
|
||||
BOOST_TEST(A::count == 1);
|
||||
}
|
||||
@@ -107,7 +108,7 @@ void test()
|
||||
bml::unique_ptr<A> p(new A);
|
||||
BOOST_TEST(A::count == 1);
|
||||
A* i = p.get();
|
||||
(void)i;
|
||||
::boost::ignore_unused(i);
|
||||
p.reset(0);
|
||||
BOOST_TEST(A::count == 0);
|
||||
BOOST_TEST(p.get() == 0);
|
||||
@@ -121,7 +122,7 @@ void test()
|
||||
bml::unique_ptr<A[]> p(new A[2]);
|
||||
BOOST_TEST(A::count == 2);
|
||||
A* i = p.get();
|
||||
(void)i;
|
||||
::boost::ignore_unused(i);
|
||||
p.reset();
|
||||
BOOST_TEST(A::count == 0);
|
||||
BOOST_TEST(p.get() == 0);
|
||||
@@ -131,7 +132,7 @@ void test()
|
||||
bml::unique_ptr<A[]> p(new A[2]);
|
||||
BOOST_TEST(A::count == 2);
|
||||
A* i = p.get();
|
||||
(void)i;
|
||||
::boost::ignore_unused(i);
|
||||
p.reset(new A[3]);
|
||||
BOOST_TEST(A::count == 3);
|
||||
}
|
||||
@@ -140,7 +141,7 @@ void test()
|
||||
bml::unique_ptr<A[]> p(new A[2]);
|
||||
BOOST_TEST(A::count == 2);
|
||||
A* i = p.get();
|
||||
(void)i;
|
||||
::boost::ignore_unused(i);
|
||||
p.reset(0);
|
||||
BOOST_TEST(A::count == 0);
|
||||
BOOST_TEST(p.get() == 0);
|
||||
@@ -154,7 +155,7 @@ void test()
|
||||
bml::unique_ptr<A[2]> p(new A[2]);
|
||||
BOOST_TEST(A::count == 2);
|
||||
A* i = p.get();
|
||||
(void)i;
|
||||
::boost::ignore_unused(i);
|
||||
p.reset();
|
||||
BOOST_TEST(A::count == 0);
|
||||
BOOST_TEST(p.get() == 0);
|
||||
@@ -164,7 +165,7 @@ void test()
|
||||
bml::unique_ptr<A[2]> p(new A[2]);
|
||||
BOOST_TEST(A::count == 2);
|
||||
A* i = p.get();
|
||||
(void)i;
|
||||
::boost::ignore_unused(i);
|
||||
p.reset(new A[3]);
|
||||
BOOST_TEST(A::count == 3);
|
||||
}
|
||||
@@ -173,7 +174,7 @@ void test()
|
||||
bml::unique_ptr<A[2]> p(new A[2]);
|
||||
BOOST_TEST(A::count == 2);
|
||||
A* i = p.get();
|
||||
(void)i;
|
||||
::boost::ignore_unused(i);
|
||||
p.reset(0);
|
||||
BOOST_TEST(A::count == 0);
|
||||
BOOST_TEST(p.get() == 0);
|
||||
@@ -199,7 +200,7 @@ void test()
|
||||
BOOST_TEST(A::count == 1);
|
||||
BOOST_TEST(B::count == 0);
|
||||
A* i = p.get();
|
||||
(void)i;
|
||||
::boost::ignore_unused(i);
|
||||
p.reset(new B);
|
||||
BOOST_TEST(A::count == 1);
|
||||
BOOST_TEST(B::count == 1);
|
||||
@@ -211,7 +212,7 @@ void test()
|
||||
BOOST_TEST(A::count == 1);
|
||||
BOOST_TEST(B::count == 1);
|
||||
A* i = p.get();
|
||||
(void)i;
|
||||
::boost::ignore_unused(i);
|
||||
p.reset(new B);
|
||||
BOOST_TEST(A::count == 1);
|
||||
BOOST_TEST(B::count == 1);
|
||||
@@ -224,7 +225,7 @@ void test()
|
||||
bml::unique_ptr<const volatile A[2]> p(new const A[2]);
|
||||
BOOST_TEST(A::count == 2);
|
||||
const volatile A* i = p.get();
|
||||
(void)i;
|
||||
::boost::ignore_unused(i);
|
||||
p.reset(new volatile A[3]);
|
||||
BOOST_TEST(A::count == 3);
|
||||
}
|
||||
@@ -233,7 +234,7 @@ void test()
|
||||
bml::unique_ptr<const A[2]> p(new A[2]);
|
||||
BOOST_TEST(A::count == 2);
|
||||
const A* i = p.get();
|
||||
(void)i;
|
||||
::boost::ignore_unused(i);
|
||||
p.reset(new const A[3]);
|
||||
BOOST_TEST(A::count == 3);
|
||||
}
|
||||
@@ -244,7 +245,7 @@ void test()
|
||||
bml::unique_ptr<const volatile A[2]> p(new const A[2]);
|
||||
BOOST_TEST(A::count == 2);
|
||||
const volatile A* i = p.get();
|
||||
(void)i;
|
||||
::boost::ignore_unused(i);
|
||||
p.reset(new volatile A[3]);
|
||||
BOOST_TEST(A::count == 3);
|
||||
}
|
||||
@@ -253,7 +254,7 @@ void test()
|
||||
bml::unique_ptr<const A[2]> p(new A[2]);
|
||||
BOOST_TEST(A::count == 2);
|
||||
const A* i = p.get();
|
||||
(void)i;
|
||||
::boost::ignore_unused(i);
|
||||
p.reset(new const A[3]);
|
||||
BOOST_TEST(A::count == 3);
|
||||
}
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
#include <boost/move/utility_core.hpp>
|
||||
#include <boost/core/ignore_unused.hpp>
|
||||
#include <boost/move/unique_ptr.hpp>
|
||||
#include <boost/static_assert.hpp>
|
||||
#include <boost/core/lightweight_test.hpp>
|
||||
@@ -107,7 +108,7 @@ void test()
|
||||
bml::unique_ptr<A> p(new A);
|
||||
BOOST_TEST(A::count == 1);
|
||||
A* i = p.get();
|
||||
(void)i;
|
||||
::boost::ignore_unused(i);
|
||||
p.reset(nullptr);
|
||||
BOOST_TEST(A::count == 0);
|
||||
BOOST_TEST(p.get() == 0);
|
||||
@@ -117,7 +118,7 @@ void test()
|
||||
bml::unique_ptr<A> p(new A);
|
||||
BOOST_TEST(A::count == 1);
|
||||
A* i = p.get();
|
||||
(void)i;
|
||||
::boost::ignore_unused(i);
|
||||
p = nullptr;
|
||||
BOOST_TEST(A::count == 0);
|
||||
BOOST_TEST(p.get() == 0);
|
||||
@@ -143,7 +144,7 @@ void test()
|
||||
bml::unique_ptr<A[]> p(new A[2]);
|
||||
BOOST_TEST(A::count == 2);
|
||||
A* i = p.get();
|
||||
(void)i;
|
||||
::boost::ignore_unused(i);
|
||||
p.reset(nullptr);
|
||||
BOOST_TEST(A::count == 0);
|
||||
BOOST_TEST(p.get() == 0);
|
||||
@@ -153,7 +154,7 @@ void test()
|
||||
bml::unique_ptr<A[]> p(new A[2]);
|
||||
BOOST_TEST(A::count == 2);
|
||||
A* i = p.get();
|
||||
(void)i;
|
||||
::boost::ignore_unused(i);
|
||||
p = nullptr;
|
||||
BOOST_TEST(A::count == 0);
|
||||
BOOST_TEST(p.get() == 0);
|
||||
@@ -178,7 +179,7 @@ void test()
|
||||
bml::unique_ptr<A[2]> p(new A[2]);
|
||||
BOOST_TEST(A::count == 2);
|
||||
A* i = p.get();
|
||||
(void)i;
|
||||
::boost::ignore_unused(i);
|
||||
p.reset(nullptr);
|
||||
BOOST_TEST(A::count == 0);
|
||||
BOOST_TEST(p.get() == 0);
|
||||
@@ -188,7 +189,7 @@ void test()
|
||||
bml::unique_ptr<A[2]> p(new A[2]);
|
||||
BOOST_TEST(A::count == 2);
|
||||
A* i = p.get();
|
||||
(void)i;
|
||||
::boost::ignore_unused(i);
|
||||
p = nullptr;
|
||||
BOOST_TEST(A::count == 0);
|
||||
BOOST_TEST(p.get() == 0);
|
||||
|
||||
Reference in New Issue
Block a user