abi_test_lib.cpp 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  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. #include <boost/shared_ptr.hpp>
  8. #include <boost/core/lightweight_test.hpp>
  9. #include <boost/config/pragma_message.hpp>
  10. #if defined(BOOST_DISABLE_THREADS)
  11. BOOST_PRAGMA_MESSAGE( "BOOST_DISABLE_THREADS is defined" )
  12. #else
  13. BOOST_PRAGMA_MESSAGE( "BOOST_DISABLE_THREADS is not defined" )
  14. #endif
  15. #if defined(BOOST_NO_CXX11_HDR_ATOMIC)
  16. BOOST_PRAGMA_MESSAGE( "BOOST_NO_CXX11_HDR_ATOMIC is defined" )
  17. #else
  18. BOOST_PRAGMA_MESSAGE( "BOOST_NO_CXX11_HDR_ATOMIC is not defined" )
  19. #endif
  20. void abi_test_1( boost::shared_ptr<void> & p )
  21. {
  22. BOOST_TEST_EQ( p.use_count(), 1 );
  23. p.reset();
  24. BOOST_TEST_EQ( p.use_count(), 0 );
  25. }
  26. boost::shared_ptr<void> abi_test_2( boost::shared_ptr<void> const & p )
  27. {
  28. BOOST_TEST_EQ( p.use_count(), 1 );
  29. return p;
  30. }
  31. boost::shared_ptr<void> abi_test_3()
  32. {
  33. return boost::shared_ptr<void>( static_cast<int*>( 0 ) );
  34. }