1 // Copyright 2018 Peter Dimov 2 // 3 // Distributed under the Boost Software License, Version 1.0. 4 // 5 // See accompanying file LICENSE_1_0.txt or copy at 6 // http://www.boost.org/LICENSE_1_0.txt 7 8 #include <boost/shared_ptr.hpp> 9 #include <boost/core/lightweight_test.hpp> 10 #include <boost/config/pragma_message.hpp> 11 12 #if defined(BOOST_DISABLE_THREADS) 13 BOOST_PRAGMA_MESSAGE( "BOOST_DISABLE_THREADS is defined" ) 14 #else 15 BOOST_PRAGMA_MESSAGE( "BOOST_DISABLE_THREADS is not defined" ) 16 #endif 17 18 #if defined(BOOST_NO_CXX11_HDR_ATOMIC) 19 BOOST_PRAGMA_MESSAGE( "BOOST_NO_CXX11_HDR_ATOMIC is defined" ) 20 #else 21 BOOST_PRAGMA_MESSAGE( "BOOST_NO_CXX11_HDR_ATOMIC is not defined" ) 22 #endif 23 abi_test_1(boost::shared_ptr<void> & p)24void abi_test_1( boost::shared_ptr<void> & p ) 25 { 26 BOOST_TEST_EQ( p.use_count(), 1 ); 27 28 p.reset(); 29 30 BOOST_TEST_EQ( p.use_count(), 0 ); 31 } 32 abi_test_2(boost::shared_ptr<void> const & p)33boost::shared_ptr<void> abi_test_2( boost::shared_ptr<void> const & p ) 34 { 35 BOOST_TEST_EQ( p.use_count(), 1 ); 36 37 return p; 38 } 39 abi_test_3()40boost::shared_ptr<void> abi_test_3() 41 { 42 return boost::shared_ptr<void>( static_cast<int*>( 0 ) ); 43 } 44