From 4a011349db2ebf300f465205abd295eecb67b325 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ion=20Gazta=C3=B1aga?= Date: Sat, 3 Aug 2024 22:47:34 +0200 Subject: [PATCH] Test files: Replace BOOST_TRY/CATCH family macros with BOOST_INTERPROCESS_TRY/CATCH --- test/allocexcept_test.cpp | 22 +++++++------- test/anonymous_shared_memory_test.cpp | 6 ++-- test/data_test.cpp | 8 ++--- test/deque_test.cpp | 18 +++++------ test/enable_shared_from_this_test.cpp | 16 +++++----- test/expand_bwd_test_template.hpp | 16 +++++----- test/file_mapping_test.cpp | 8 ++--- test/intermodule_singleton_test.cpp | 24 +++++++-------- test/list_test.hpp | 8 ++--- test/managed_windows_shared_memory_test.cpp | 6 ++-- test/managed_xsi_shared_memory_test.cpp | 8 ++--- test/map_test.hpp | 16 +++++----- test/message_queue_test.cpp | 22 +++++++------- test/mp_managed_shared_memory_test.cpp | 8 ++--- test/mutex_owner_dead_test.cpp | 16 +++++----- test/mutex_test_template.hpp | 6 ++-- test/named_allocation_test_template.hpp | 16 +++++----- test/named_condition_test_helpers.hpp | 6 ++-- test/named_creation_template.hpp | 18 +++++------ test/named_mutex_test_helpers.hpp | 12 ++++---- test/named_semaphore_test_helpers.hpp | 6 ++-- test/named_sharable_mutex_test.cpp | 6 ++-- test/named_upgradable_mutex_test.cpp | 6 ++-- test/robust_mutex_test.hpp | 20 ++++++------ test/segment_manager_test.cpp | 16 +++++----- test/set_test.hpp | 16 +++++----- test/shared_memory_mapping_test.cpp | 16 +++++----- test/shared_memory_test.cpp | 6 ++-- test/shared_ptr_test.cpp | 12 ++++---- test/unordered_test.cpp | 8 ++--- test/user_buffer_test.cpp | 12 +++----- test/vector_test.hpp | 6 ++-- test/windows_eventlog_shared_memory_test.cpp | 6 ++-- test/windows_shared_memory_mapping_test.cpp | 6 ++-- test/windows_shared_memory_test.cpp | 6 ++-- test/xsi_shared_memory_mapping_test.cpp | 32 ++++++++++---------- 36 files changed, 218 insertions(+), 222 deletions(-) diff --git a/test/allocexcept_test.cpp b/test/allocexcept_test.cpp index 29afe50..6f6e92f 100644 --- a/test/allocexcept_test.cpp +++ b/test/allocexcept_test.cpp @@ -37,7 +37,7 @@ int main () const int memsize = 16384; const char *const shMemName = test::get_process_id_name(); - BOOST_TRY{ + BOOST_INTERPROCESS_TRY{ shared_memory_object::remove(shMemName); //Named allocate capable shared mem allocator @@ -52,7 +52,7 @@ int main () typedef vector MyVect; //We'll provoke an exception, let's see if exception handling works - BOOST_TRY{ + BOOST_INTERPROCESS_TRY{ //Fill vector until there is no more memory MyVect myvec(myallocator); while(true){ @@ -60,15 +60,15 @@ int main () myvec.push_back(a); } } - BOOST_CATCH(boost::interprocess::bad_alloc &){ + BOOST_INTERPROCESS_CATCH(boost::interprocess::bad_alloc &){ if (InstanceCounter::counter != 0) { std::cout << "Error: InstanceCounter::counter: " << InstanceCounter::counter; return 1; } - } BOOST_CATCH_END + } BOOST_INTERPROCESS_CATCH_END //We'll provoke an exception, let's see if exception handling works - BOOST_TRY{ + BOOST_INTERPROCESS_TRY{ //Fill vector at the beginning until there is no more memory MyVect myvec(myallocator); std::size_t i; @@ -77,24 +77,24 @@ int main () myvec.insert(myvec.begin(), i, ic); } } - BOOST_CATCH(boost::interprocess::bad_alloc &){ + BOOST_INTERPROCESS_CATCH(boost::interprocess::bad_alloc &){ if(InstanceCounter::counter != 0){ std::cout << "Error: InstanceCounter::counter: " << InstanceCounter::counter; return 1; } } - BOOST_CATCH(std::length_error &){ + BOOST_INTERPROCESS_CATCH(std::length_error &){ if(InstanceCounter::counter != 0){ std::cout << "Error: InstanceCounter::counter: " << InstanceCounter::counter; return 1; } - } BOOST_CATCH_END + } BOOST_INTERPROCESS_CATCH_END } - BOOST_CATCH(...){ + BOOST_INTERPROCESS_CATCH(...){ shared_memory_object::remove(shMemName); - BOOST_RETHROW + BOOST_INTERPROCESS_RETHROW } - BOOST_CATCH_END + BOOST_INTERPROCESS_CATCH_END shared_memory_object::remove(shMemName); return 0; diff --git a/test/anonymous_shared_memory_test.cpp b/test/anonymous_shared_memory_test.cpp index 136092e..f0df875 100644 --- a/test/anonymous_shared_memory_test.cpp +++ b/test/anonymous_shared_memory_test.cpp @@ -18,7 +18,7 @@ using namespace boost::interprocess; int main () { - BOOST_TRY{ + BOOST_INTERPROCESS_TRY{ const std::size_t MemSize = 99999*2; { //Now check anonymous mapping @@ -43,9 +43,9 @@ int main () } } } - BOOST_CATCH(std::exception &exc){ + BOOST_INTERPROCESS_CATCH(std::exception &exc){ std::cout << "Unhandled exception: " << exc.what() << std::endl; return 1; - } BOOST_CATCH_END + } BOOST_INTERPROCESS_CATCH_END return 0; } diff --git a/test/data_test.cpp b/test/data_test.cpp index 7228111..ec519b2 100644 --- a/test/data_test.cpp +++ b/test/data_test.cpp @@ -26,7 +26,7 @@ int main () test::get_process_id_name(process_name); const char *const shMemName = process_name.c_str(); - BOOST_TRY{ + BOOST_INTERPROCESS_TRY{ shared_memory_object::remove(shMemName); //Create shared memory @@ -85,10 +85,10 @@ int main () return 1; } } - BOOST_CATCH(...){ + BOOST_INTERPROCESS_CATCH(...){ shared_memory_object::remove(shMemName); - BOOST_RETHROW - } BOOST_CATCH_END + BOOST_INTERPROCESS_RETHROW + } BOOST_INTERPROCESS_CATCH_END shared_memory_object::remove(shMemName); return 0; } diff --git a/test/deque_test.cpp b/test/deque_test.cpp index aaeedea..1417669 100644 --- a/test/deque_test.cpp +++ b/test/deque_test.cpp @@ -124,7 +124,7 @@ bool do_test() const char *const shMemName = test::get_process_id_name(); const int max = 100; - /*BOOST_TRY*/{ + BOOST_INTERPROCESS_TRY{ shared_memory_object::remove(shMemName); //Create shared memory @@ -139,7 +139,7 @@ bool do_test() MyStdDeque *stddeque = new MyStdDeque; - /*BOOST_TRY*/{ + BOOST_INTERPROCESS_TRY{ //Compare several shared memory deque operations with std::deque for(int i = 0; i < max*50; ++i){ IntType move_me(i); @@ -269,18 +269,18 @@ bool do_test() if(!segment.all_memory_deallocated()) return false; - }/* - BOOST_CATCH(std::exception &ex){ + } + BOOST_INTERPROCESS_CATCH(std::exception &ex){ std::cout << ex.what() << std::endl; return false; - } BOOST_CATCH_END*/ + } BOOST_INTERPROCESS_CATCH_END std::cout << std::endl << "Test OK!" << std::endl; - }/* - BOOST_CATCH(...){ + } + BOOST_INTERPROCESS_CATCH(...){ shared_memory_object::remove(shMemName); - BOOST_RETHROW - } BOOST_CATCH_END*/ + BOOST_INTERPROCESS_RETHROW + } BOOST_INTERPROCESS_CATCH_END shared_memory_object::remove(shMemName); return true; } diff --git a/test/enable_shared_from_this_test.cpp b/test/enable_shared_from_this_test.cpp index 1e2601e..b7c9056 100644 --- a/test/enable_shared_from_this_test.cpp +++ b/test/enable_shared_from_this_test.cpp @@ -49,21 +49,21 @@ void test_enable_shared_this(ManagedMemory &managed_mem) X v2(*p); - BOOST_TRY + BOOST_INTERPROCESS_TRY { //This should throw bad_weak_ptr v_shared_ptr r = v2.shared_from_this(); BOOST_ERROR("v2.shared_from_this() failed to throw"); } - BOOST_CATCH(boost::interprocess::bad_weak_ptr const &) + BOOST_INTERPROCESS_CATCH(boost::interprocess::bad_weak_ptr const &) { //This is the expected path } - BOOST_CATCH(...){ + BOOST_INTERPROCESS_CATCH(...){ BOOST_ERROR("v2.shared_from_this() threw an unexpected exception"); - } BOOST_CATCH_END + } BOOST_INTERPROCESS_CATCH_END - BOOST_TRY + BOOST_INTERPROCESS_TRY { //This should not throw bad_weak_ptr *p = X(); @@ -71,14 +71,14 @@ void test_enable_shared_this(ManagedMemory &managed_mem) BOOST_TEST(p == r); BOOST_TEST(!(p < r) && !(r < p)); } - BOOST_CATCH(boost::interprocess::bad_weak_ptr const &) + BOOST_INTERPROCESS_CATCH(boost::interprocess::bad_weak_ptr const &) { BOOST_ERROR("p->shared_from_this() threw bad_weak_ptr after *p = X()"); } - BOOST_CATCH(...) + BOOST_INTERPROCESS_CATCH(...) { BOOST_ERROR("p->shared_from_this() threw an unexpected exception after *p = X()"); - } BOOST_CATCH_END + } BOOST_INTERPROCESS_CATCH_END } diff --git a/test/expand_bwd_test_template.hpp b/test/expand_bwd_test_template.hpp index 4616676..9270ea4 100644 --- a/test/expand_bwd_test_template.hpp +++ b/test/expand_bwd_test_template.hpp @@ -136,7 +136,7 @@ bool test_insert_with_expand_bwd() for(std::size_t iteration = 0; iteration < Iterations; ++iteration) { value_type *memory = new value_type[MemorySize]; - BOOST_TRY { + BOOST_INTERPROCESS_TRY { std::vector initial_data; initial_data.resize(InitialSize[iteration]); for(std::size_t i = 0; i < InitialSize[iteration]; ++i){ @@ -166,10 +166,10 @@ bool test_insert_with_expand_bwd() return false; } } - BOOST_CATCH(...){ + BOOST_INTERPROCESS_CATCH(...){ delete [](const_cast(memory)); - BOOST_RETHROW - } BOOST_CATCH_END + BOOST_INTERPROCESS_RETHROW + } BOOST_INTERPROCESS_CATCH_END delete [](const_cast(memory)); } @@ -193,7 +193,7 @@ bool test_assign_with_expand_bwd() for(std::size_t iteration = 0; iteration initial_data; initial_data.resize(InitialSize[iteration]); @@ -227,10 +227,10 @@ bool test_assign_with_expand_bwd() return false; } } - BOOST_CATCH(...){ + BOOST_INTERPROCESS_CATCH(...){ delete [](const_cast::type*>(memory)); - BOOST_RETHROW - } BOOST_CATCH_END + BOOST_INTERPROCESS_RETHROW + } BOOST_INTERPROCESS_CATCH_END delete [](const_cast::type*>(memory)); } diff --git a/test/file_mapping_test.cpp b/test/file_mapping_test.cpp index d324915..f52a3bc 100644 --- a/test/file_mapping_test.cpp +++ b/test/file_mapping_test.cpp @@ -28,7 +28,7 @@ file_mapping get_file_mapping() int main () { - BOOST_TRY{ + BOOST_INTERPROCESS_TRY{ const std::size_t FileSize = 99999*2; { //Create file with given size @@ -164,11 +164,11 @@ int main () file_mapping ret(get_file_mapping()); } } - BOOST_CATCH(std::exception &exc){ + BOOST_INTERPROCESS_CATCH(std::exception &exc){ file_mapping::remove(get_filename().c_str()); std::cout << "Unhandled exception: " << exc.what() << std::endl; - BOOST_RETHROW - } BOOST_CATCH_END + BOOST_INTERPROCESS_RETHROW + } BOOST_INTERPROCESS_CATCH_END file_mapping::remove(get_filename().c_str()); return 0; } diff --git a/test/intermodule_singleton_test.cpp b/test/intermodule_singleton_test.cpp index 2c21bbe..aaeab4a 100644 --- a/test/intermodule_singleton_test.cpp +++ b/test/intermodule_singleton_test.cpp @@ -54,19 +54,19 @@ int intermodule_singleton_test() bool exception_thrown = false; bool exception_2_thrown = false; - BOOST_TRY{ + BOOST_INTERPROCESS_TRY{ IntermoduleType::get(); } - BOOST_CATCH(int &){ + BOOST_INTERPROCESS_CATCH(int &){ exception_thrown = true; //Second try - BOOST_TRY{ + BOOST_INTERPROCESS_TRY{ IntermoduleType::get(); } - BOOST_CATCH(interprocess_exception &){ + BOOST_INTERPROCESS_CATCH(interprocess_exception &){ exception_2_thrown = true; - } BOOST_CATCH_END - } BOOST_CATCH_END + } BOOST_INTERPROCESS_CATCH_END + } BOOST_INTERPROCESS_CATCH_END if(!exception_thrown || !exception_2_thrown){ return 1; @@ -79,12 +79,12 @@ int intermodule_singleton_test() //Second try exception_2_thrown = false; - BOOST_TRY{ + BOOST_INTERPROCESS_TRY{ IntermoduleType::get(); } - BOOST_CATCH(interprocess_exception &){ + BOOST_INTERPROCESS_CATCH(interprocess_exception &){ exception_2_thrown = true; - } BOOST_CATCH_END + } BOOST_INTERPROCESS_CATCH_END if(!exception_2_thrown){ return 1; } @@ -212,16 +212,16 @@ class LogDeadReferenceUser std::cout << "~LogDeadReferenceUser(), LogSingleton: " << typeid(LogSingleton).name() << "\n" << std::endl; //Make sure the exception is thrown as we are //trying to use a dead non-phoenix singleton - BOOST_TRY{ + BOOST_INTERPROCESS_TRY{ LogSingleton::get().log_it(); std::string s("LogDeadReferenceUser failed for LogSingleton "); s += typeid(LogSingleton).name(); std::cout << "~LogDeadReferenceUser(), error: " << s << std::endl; std::abort(); } - BOOST_CATCH(interprocess_exception &){ + BOOST_INTERPROCESS_CATCH(interprocess_exception &){ //Correct behaviour - } BOOST_CATCH_END + } BOOST_INTERPROCESS_CATCH_END } }; diff --git a/test/list_test.hpp b/test/list_test.hpp index b6db701..5e0c180 100644 --- a/test/list_test.hpp +++ b/test/list_test.hpp @@ -103,7 +103,7 @@ int list_test (bool copied_allocators_equal = true) const int max = 100; typedef push_data_function push_data_t; - BOOST_TRY{ + BOOST_INTERPROCESS_TRY{ //Named new capable shared mem allocator //Create shared memory shared_memory_object::remove(shMemName); @@ -264,10 +264,10 @@ int list_test (bool copied_allocators_equal = true) if(!segment.all_memory_deallocated()) return 1; } - BOOST_CATCH(...){ + BOOST_INTERPROCESS_CATCH(...){ shared_memory_object::remove(shMemName); - BOOST_RETHROW - } BOOST_CATCH_END + BOOST_INTERPROCESS_RETHROW + } BOOST_INTERPROCESS_CATCH_END shared_memory_object::remove(shMemName); return 0; } diff --git a/test/managed_windows_shared_memory_test.cpp b/test/managed_windows_shared_memory_test.cpp index 758d2bb..b513ef0 100644 --- a/test/managed_windows_shared_memory_test.cpp +++ b/test/managed_windows_shared_memory_test.cpp @@ -63,13 +63,13 @@ int main () { bool throws_ok = false; //Check memory is gone - BOOST_TRY{ + BOOST_INTERPROCESS_TRY{ managed_windows_shared_memory w_tmp(open_only, MemName); } - BOOST_CATCH(interprocess_exception &e) { + BOOST_INTERPROCESS_CATCH(interprocess_exception &e) { throws_ok = e.get_error_code() == not_found_error; } - BOOST_CATCH_END + BOOST_INTERPROCESS_CATCH_END if (!throws_ok) return 1; } diff --git a/test/managed_xsi_shared_memory_test.cpp b/test/managed_xsi_shared_memory_test.cpp index dd7bcdb..781347f 100644 --- a/test/managed_xsi_shared_memory_test.cpp +++ b/test/managed_xsi_shared_memory_test.cpp @@ -25,14 +25,14 @@ using namespace boost::interprocess; void remove_shared_memory(const xsi_key &key) { - BOOST_TRY{ + BOOST_INTERPROCESS_TRY{ xsi_shared_memory xsi(open_only, key); xsi_shared_memory::remove(xsi.get_shmid()); } - BOOST_CATCH(interprocess_exception &e){ + BOOST_INTERPROCESS_CATCH(interprocess_exception &e){ if(e.get_error_code() != not_found_error) - BOOST_RETHROW - } BOOST_CATCH_END + BOOST_INTERPROCESS_RETHROW + } BOOST_INTERPROCESS_CATCH_END } class xsi_shared_memory_remover diff --git a/test/map_test.hpp b/test/map_test.hpp index 06eb69b..087573a 100644 --- a/test/map_test.hpp +++ b/test/map_test.hpp @@ -52,7 +52,7 @@ int map_test () const char *const shMemName = test::get_process_id_name(); const int max = 100; - BOOST_TRY{ + BOOST_INTERPROCESS_TRY{ //Create shared memory shared_memory_object::remove(shMemName); ManagedSharedMemory segment(create_only, shMemName, Memsize); @@ -484,10 +484,10 @@ int map_test () if(!segment.all_memory_deallocated()) return 1; } - BOOST_CATCH(...){ + BOOST_INTERPROCESS_CATCH(...){ shared_memory_object::remove(shMemName); - BOOST_RETHROW - } BOOST_CATCH_END + BOOST_INTERPROCESS_RETHROW + } BOOST_INTERPROCESS_CATCH_END shared_memory_object::remove(shMemName); return 0; } @@ -507,7 +507,7 @@ int map_test_copyable () const char *const shMemName = test::get_process_id_name(); const int max = 100; - BOOST_TRY{ + BOOST_INTERPROCESS_TRY{ //Create shared memory shared_memory_object::remove(shMemName); ManagedSharedMemory segment(create_only, shMemName, Memsize); @@ -578,10 +578,10 @@ int map_test_copyable () if(!segment.all_memory_deallocated()) return 1; } - BOOST_CATCH(...){ + BOOST_INTERPROCESS_CATCH(...){ shared_memory_object::remove(shMemName); - BOOST_RETHROW - } BOOST_CATCH_END + BOOST_INTERPROCESS_RETHROW + } BOOST_INTERPROCESS_CATCH_END shared_memory_object::remove(shMemName); return 0; } diff --git a/test/message_queue_test.cpp b/test/message_queue_test.cpp index 1612916..004939f 100644 --- a/test/message_queue_test.cpp +++ b/test/message_queue_test.cpp @@ -153,14 +153,14 @@ bool test_serialize_db() return false; //Fill map1 until is full - BOOST_TRY{ + BOOST_INTERPROCESS_TRY{ std::size_t i = 0; while(1){ (*map1)[i] = i; ++i; } } - BOOST_CATCH(boost::interprocess::bad_alloc &){} BOOST_CATCH_END + BOOST_INTERPROCESS_CATCH(boost::interprocess::bad_alloc &){} BOOST_INTERPROCESS_CATCH_END //Data control data sending through the message queue std::size_t sent = 0; @@ -305,13 +305,13 @@ static void multireceive() { char buff; size_t size; - int received_msgs = 0; + //int received_msgs = 0; unsigned int priority; do { global_queue->receive(&buff, 1, size, priority); - ++received_msgs; + //++received_msgs; } while (size > 0); - --received_msgs; + //--received_msgs; //std::cout << "reader thread complete, read msgs: " << received_msgs << std::endl; } @@ -320,7 +320,7 @@ bool test_multi_sender_receiver() { bool ret = true; //std::cout << "Testing multi-sender / multi-receiver " << std::endl; - BOOST_TRY { + BOOST_INTERPROCESS_TRY { boost::interprocess::message_queue::remove(test::get_process_id_name()); boost::interprocess::message_queue mq (boost::interprocess::open_or_create, test::get_process_id_name(), MULTI_QUEUE_SIZE, 1); @@ -343,10 +343,10 @@ bool test_multi_sender_receiver() //std::cout << "Joined thread " << i << std::endl; } } - BOOST_CATCH(std::exception &e) { + BOOST_INTERPROCESS_CATCH(std::exception &e) { std::cout << "error " << e.what() << std::endl; ret = false; - } BOOST_CATCH_END + } BOOST_INTERPROCESS_CATCH_END boost::interprocess::message_queue::remove(test::get_process_id_name()); return ret; } @@ -402,7 +402,7 @@ class msg_queue_named_test_wrapper_w int main () { int ret = 0; - BOOST_TRY{ + BOOST_INTERPROCESS_TRY{ message_queue::remove(test::get_process_id_name()); test::test_named_creation(); #if defined(BOOST_INTERPROCESS_WCHAR_NAMED_RESOURCES) @@ -425,10 +425,10 @@ int main () return 1; } } - BOOST_CATCH(std::exception &ex) { + BOOST_INTERPROCESS_CATCH(std::exception &ex) { std::cout << ex.what() << std::endl; ret = 1; - } BOOST_CATCH_END + } BOOST_INTERPROCESS_CATCH_END message_queue::remove(test::get_process_id_name()); return ret; diff --git a/test/mp_managed_shared_memory_test.cpp b/test/mp_managed_shared_memory_test.cpp index 28d2d07..e966400 100644 --- a/test/mp_managed_shared_memory_test.cpp +++ b/test/mp_managed_shared_memory_test.cpp @@ -35,7 +35,7 @@ typedef list > int main(int argc, char *argv[]) { std::string p_or_c = argc == 1 ? "parent" : "child"; - BOOST_TRY { + BOOST_INTERPROCESS_TRY { if(argc == 1){ //Parent process shm_remove remover; (void)remover; shared_memory_object::remove(test::get_process_id_name()); @@ -95,17 +95,17 @@ int main(int argc, char *argv[]) my_sem->post(); } } - BOOST_CATCH(interprocess_exception &e){ + BOOST_INTERPROCESS_CATCH(interprocess_exception &e){ std::cerr << p_or_c << " -> interprocess_exception::what(): " << e.what() << " native error: " << e.get_native_error() << " error code: " << e.get_error_code() << '\n'; return 2; } - BOOST_CATCH(std::exception &e){ + BOOST_INTERPROCESS_CATCH(std::exception &e){ std::cerr << p_or_c << " -> std::exception::what(): " << e.what() << '\n'; return 3; } - BOOST_CATCH_END + BOOST_INTERPROCESS_CATCH_END std::cerr << p_or_c << " -> Normal termination\n"; diff --git a/test/mutex_owner_dead_test.cpp b/test/mutex_owner_dead_test.cpp index e831c6f..0f21786 100644 --- a/test/mutex_owner_dead_test.cpp +++ b/test/mutex_owner_dead_test.cpp @@ -74,17 +74,17 @@ int test_owner_dead_mutex_impl(EOwnerDeadLockType lock_type) ipcdetail::OS_thread_t tm1; ipcdetail::thread_launch(tm1, thread_adapter(&lock_and_exit, 0, mtx)); ipcdetail::thread_join(tm1); - BOOST_TRY { + BOOST_INTERPROCESS_TRY { test_owner_dead_mutex_do_lock(mtx, lock_type); } - BOOST_CATCH(lock_exception& e) { + BOOST_INTERPROCESS_CATCH(lock_exception& e) { #ifndef BOOST_NO_EXCEPTIONS if (e.get_error_code() == not_recoverable){ //Now try once again to lock it, to make sure it's not recoverable - BOOST_TRY { + BOOST_INTERPROCESS_TRY { test_owner_dead_mutex_do_lock(mtx, lock_type); } - BOOST_CATCH(lock_exception& e) { + BOOST_INTERPROCESS_CATCH(lock_exception& e) { if (e.get_error_code() == not_recoverable) return 0; else{ @@ -92,10 +92,10 @@ int test_owner_dead_mutex_impl(EOwnerDeadLockType lock_type) return 3; } } - BOOST_CATCH(...) { + BOOST_INTERPROCESS_CATCH(...) { std::cerr << "lock_exception not thrown! (2)"; return 4; - } BOOST_CATCH_END + } BOOST_INTERPROCESS_CATCH_END std::cerr << "Exception not thrown (2)!"; return 5; } @@ -105,10 +105,10 @@ int test_owner_dead_mutex_impl(EOwnerDeadLockType lock_type) } #endif //BOOST_NO_EXCEPTIONS } - BOOST_CATCH(...) { + BOOST_INTERPROCESS_CATCH(...) { std::cerr << "lock_exception not thrown!"; return 2; - } BOOST_CATCH_END + } BOOST_INTERPROCESS_CATCH_END std::cerr << "Exception not thrown!"; return 3; } diff --git a/test/mutex_test_template.hpp b/test/mutex_test_template.hpp index b1c7375..8748e64 100644 --- a/test/mutex_test_template.hpp +++ b/test/mutex_test_template.hpp @@ -193,15 +193,15 @@ void lock_and_sleep(void *arg, M &sm) template void lock_and_catch_errors(void *arg, M &sm) { - BOOST_TRY + BOOST_INTERPROCESS_TRY { lock_and_sleep(arg, sm); } - BOOST_CATCH(interprocess_exception const & e) + BOOST_INTERPROCESS_CATCH(interprocess_exception const & e) { data* pdata = static_cast*>(arg); pdata->m_error = e.get_error_code(); - } BOOST_CATCH_END + } BOOST_INTERPROCESS_CATCH_END } template diff --git a/test/named_allocation_test_template.hpp b/test/named_allocation_test_template.hpp index 5a0819f..f327abb 100644 --- a/test/named_allocation_test_template.hpp +++ b/test/named_allocation_test_template.hpp @@ -437,7 +437,7 @@ bool test_named_allocation() const int memsize = 163840; const char *const shMemName = test::get_process_id_name(); - BOOST_TRY + BOOST_INTERPROCESS_TRY { //A shared memory with rbtree best fit algorithm typedef basic_managed_shared_memory @@ -455,14 +455,14 @@ bool test_named_allocation() return false; } } - BOOST_CATCH(...){ + BOOST_INTERPROCESS_CATCH(...){ shared_memory_object::remove(shMemName); - BOOST_RETHROW - } BOOST_CATCH_END + BOOST_INTERPROCESS_RETHROW + } BOOST_INTERPROCESS_CATCH_END shared_memory_object::remove(shMemName); //Now test it with wchar_t - BOOST_TRY + BOOST_INTERPROCESS_TRY { //A shared memory with simple sequential fit algorithm typedef basic_managed_shared_memory @@ -480,10 +480,10 @@ bool test_named_allocation() return false; } } - BOOST_CATCH(...){ + BOOST_INTERPROCESS_CATCH(...){ shared_memory_object::remove(shMemName); - BOOST_RETHROW - } BOOST_CATCH_END + BOOST_INTERPROCESS_RETHROW + } BOOST_INTERPROCESS_CATCH_END shared_memory_object::remove(shMemName); return true; diff --git a/test/named_condition_test_helpers.hpp b/test/named_condition_test_helpers.hpp index 33ebf92..0c1b86f 100644 --- a/test/named_condition_test_helpers.hpp +++ b/test/named_condition_test_helpers.hpp @@ -240,7 +240,7 @@ template int test_named_condition() { int ret = 0; - BOOST_TRY{ + BOOST_INTERPROCESS_TRY{ //Remove previous mutexes and conditions NamedMutex::remove(test::add_to_process_id_name("test_mutex0")); NamedCondition::remove(test::add_to_process_id_name("test_cond0")); @@ -261,10 +261,10 @@ int test_named_condition() test::do_test_condition ,test::named_mutex_test_wrapper >(); } - BOOST_CATCH(std::exception &ex){ + BOOST_INTERPROCESS_CATCH(std::exception &ex){ std::cout << ex.what() << std::endl; ret = 1; - } BOOST_CATCH_END + } BOOST_INTERPROCESS_CATCH_END NamedMutex::remove(test::add_to_process_id_name("test_mutex0")); NamedCondition::remove(test::add_to_process_id_name("test_cond0")); NamedCondition::remove(test::add_to_process_id_name("test_cond1")); diff --git a/test/named_creation_template.hpp b/test/named_creation_template.hpp index 19e7d49..adb0143 100644 --- a/test/named_creation_template.hpp +++ b/test/named_creation_template.hpp @@ -24,16 +24,16 @@ namespace boost { namespace interprocess { namespace test { template inline void create_then_open_then_open_or_create() { - BOOST_TRY{ + BOOST_INTERPROCESS_TRY{ //Create it and open it twice NamedResource nresource1(create_only); NamedResource nresource2(open_only); NamedResource nresource3(open_or_create); } - BOOST_CATCH(...){ + BOOST_INTERPROCESS_CATCH(...){ //This shouldn't throw so show the error BOOST_INTERPROCESS_CHECK( false ); - } BOOST_CATCH_END + } BOOST_INTERPROCESS_CATCH_END } template @@ -41,25 +41,25 @@ inline void open_or_create_then_create() { //Create it with open_or_create and try to create it twice NamedResource nresource1(open_or_create); - BOOST_TRY{ + BOOST_INTERPROCESS_TRY{ NamedResource nresource2(create_only); } - BOOST_CATCH(interprocess_exception &err){ + BOOST_INTERPROCESS_CATCH(interprocess_exception &err){ BOOST_INTERPROCESS_CHECK(err.get_error_code() == already_exists_error); - } BOOST_CATCH_END + } BOOST_INTERPROCESS_CATCH_END } template inline void dont_create_and_open() { //Try to open it without creating - BOOST_TRY{ + BOOST_INTERPROCESS_TRY{ NamedResource nresource1(open_only); } - BOOST_CATCH(interprocess_exception &err){ + BOOST_INTERPROCESS_CATCH(interprocess_exception &err){ BOOST_INTERPROCESS_CHECK(err.get_error_code() == not_found_error); return; - } BOOST_CATCH_END + } BOOST_INTERPROCESS_CATCH_END //The mutex should not exist BOOST_INTERPROCESS_CHECK(false); } diff --git a/test/named_mutex_test_helpers.hpp b/test/named_mutex_test_helpers.hpp index 1bd1730..d6ff4db 100644 --- a/test/named_mutex_test_helpers.hpp +++ b/test/named_mutex_test_helpers.hpp @@ -25,7 +25,7 @@ template int test_named_mutex() { int ret = 0; - BOOST_TRY{ + BOOST_INTERPROCESS_TRY{ NamedMutex::remove(test::get_process_id_name()); test::test_named_creation< test::named_sync_creation_test_wrapper >(); #if defined(BOOST_INTERPROCESS_WCHAR_NAMED_RESOURCES) @@ -34,10 +34,10 @@ int test_named_mutex() test::test_all_lock< test::named_sync_wrapper >(); test::test_all_mutex >(); } - BOOST_CATCH(std::exception& ex) { + BOOST_INTERPROCESS_CATCH(std::exception& ex) { std::cout << ex.what() << std::endl; ret = 1; - } BOOST_CATCH_END + } BOOST_INTERPROCESS_CATCH_END NamedMutex::remove(test::get_process_id_name()); return ret; } @@ -46,7 +46,7 @@ template int test_named_recursive_mutex() { int ret = 0; - BOOST_TRY{ + BOOST_INTERPROCESS_TRY{ NamedRecursiveMutex::remove(test::get_process_id_name()); test::test_named_creation< test::named_sync_creation_test_wrapper >(); #if defined(BOOST_INTERPROCESS_WCHAR_NAMED_RESOURCES) @@ -56,10 +56,10 @@ int test_named_recursive_mutex() test::test_all_mutex >(); test::test_all_recursive_lock >(); } - BOOST_CATCH(std::exception& ex) { + BOOST_INTERPROCESS_CATCH(std::exception& ex) { std::cout << ex.what() << std::endl; ret = 1; - } BOOST_CATCH_END + } BOOST_INTERPROCESS_CATCH_END NamedRecursiveMutex::remove(test::get_process_id_name()); return ret; } diff --git a/test/named_semaphore_test_helpers.hpp b/test/named_semaphore_test_helpers.hpp index fd9ee10..493feac 100644 --- a/test/named_semaphore_test_helpers.hpp +++ b/test/named_semaphore_test_helpers.hpp @@ -124,7 +124,7 @@ template int test_named_semaphore() { int ret = 0; - BOOST_TRY{ + BOOST_INTERPROCESS_TRY{ test::test_named_creation< test::named_sync_creation_test_wrapper > >(); #if defined(BOOST_INTERPROCESS_WCHAR_NAMED_RESOURCES) test::test_named_creation< test::named_sync_creation_test_wrapper_w > >(); @@ -135,10 +135,10 @@ int test_named_semaphore() test::test_all_recursive_lock > >(); test_named_semaphore_specific(); } - BOOST_CATCH(std::exception &ex){ + BOOST_INTERPROCESS_CATCH(std::exception &ex){ std::cout << ex.what() << std::endl; ret = 1; - } BOOST_CATCH_END + } BOOST_INTERPROCESS_CATCH_END NamedSemaphore::remove(test::get_process_id_name()); return ret; } diff --git a/test/named_sharable_mutex_test.cpp b/test/named_sharable_mutex_test.cpp index 7abcf16..4efe9d8 100644 --- a/test/named_sharable_mutex_test.cpp +++ b/test/named_sharable_mutex_test.cpp @@ -20,7 +20,7 @@ using namespace boost::interprocess; int main () { int ret = 0; - BOOST_TRY{ + BOOST_INTERPROCESS_TRY{ named_sharable_mutex::remove(test::get_process_id_name()); test::test_named_creation< test::named_sync_creation_test_wrapper >(); #if defined(BOOST_INTERPROCESS_WCHAR_NAMED_RESOURCES) @@ -30,10 +30,10 @@ int main () test::test_all_mutex >(); test::test_all_sharable_mutex >(); } - BOOST_CATCH(std::exception &ex){ + BOOST_INTERPROCESS_CATCH(std::exception &ex){ std::cout << ex.what() << std::endl; ret = 1; - } BOOST_CATCH_END + } BOOST_INTERPROCESS_CATCH_END named_sharable_mutex::remove(test::get_process_id_name()); return ret; } diff --git a/test/named_upgradable_mutex_test.cpp b/test/named_upgradable_mutex_test.cpp index b0db3c2..1cbbf30 100644 --- a/test/named_upgradable_mutex_test.cpp +++ b/test/named_upgradable_mutex_test.cpp @@ -20,7 +20,7 @@ using namespace boost::interprocess; int main () { int ret = 0; - BOOST_TRY{ + BOOST_INTERPROCESS_TRY{ named_upgradable_mutex::remove(test::get_process_id_name()); test::test_named_creation< test::named_sync_creation_test_wrapper >(); #if defined(BOOST_INTERPROCESS_WCHAR_NAMED_RESOURCES) @@ -30,10 +30,10 @@ int main () test::test_all_mutex >(); test::test_all_sharable_mutex >(); } - BOOST_CATCH(std::exception &ex){ + BOOST_INTERPROCESS_CATCH(std::exception &ex){ std::cout << ex.what() << std::endl; ret = 1; - } BOOST_CATCH_END + } BOOST_INTERPROCESS_CATCH_END named_upgradable_mutex::remove(test::get_process_id_name()); return ret; } diff --git a/test/robust_mutex_test.hpp b/test/robust_mutex_test.hpp index 1e27658..7edfc80 100644 --- a/test/robust_mutex_test.hpp +++ b/test/robust_mutex_test.hpp @@ -28,7 +28,7 @@ namespace test{ template int robust_mutex_test(int argc, char *argv[]) { - BOOST_TRY{ + BOOST_INTERPROCESS_TRY{ if(argc == 1){ //Parent process //First usual mutex tests { @@ -101,12 +101,12 @@ int robust_mutex_test(int argc, char *argv[]) instance[1].unlock(); //Since it's NOT consistent, locking is NOT possible again bool exception_thrown = false; - BOOST_TRY{ + BOOST_INTERPROCESS_TRY{ instance[1].lock(); } - BOOST_CATCH(interprocess_exception &){ + BOOST_INTERPROCESS_CATCH(interprocess_exception &){ exception_thrown = true; - } BOOST_CATCH_END + } BOOST_INTERPROCESS_CATCH_END if(!exception_thrown){ return 1; } @@ -125,12 +125,12 @@ int robust_mutex_test(int argc, char *argv[]) instance[2].unlock(); //Since it's NOT consistent, locking is NOT possible again bool exception_thrown = false; - BOOST_TRY{ + BOOST_INTERPROCESS_TRY{ instance[2].lock(); } - BOOST_CATCH(interprocess_exception &){ + BOOST_INTERPROCESS_CATCH(interprocess_exception &){ exception_thrown = true; - } BOOST_CATCH_END + } BOOST_INTERPROCESS_CATCH_END if(!exception_thrown){ return 1; } @@ -192,10 +192,10 @@ int robust_mutex_test(int argc, char *argv[]) *go_ahead2 = true; } } - }BOOST_CATCH(...){ + }BOOST_INTERPROCESS_CATCH(...){ std::cout << "Exception thrown error!" << std::endl; - BOOST_RETHROW - } BOOST_CATCH_END + BOOST_INTERPROCESS_RETHROW + } BOOST_INTERPROCESS_CATCH_END return 0; } diff --git a/test/segment_manager_test.cpp b/test/segment_manager_test.cpp index 5724a90..d625b32 100644 --- a/test/segment_manager_test.cpp +++ b/test/segment_manager_test.cpp @@ -93,7 +93,7 @@ bool test_segment_manager() return false; if(seg_mgr->get_free_memory() != free_mem_before) return false; - BOOST_TRY{ seg_mgr->allocate(ShmSizeSize*2); }BOOST_CATCH(interprocess_exception&){} BOOST_CATCH_END + BOOST_INTERPROCESS_TRY{ seg_mgr->allocate(ShmSizeSize*2); }BOOST_INTERPROCESS_CATCH(interprocess_exception&){} BOOST_INTERPROCESS_CATCH_END if(seg_mgr->get_free_memory() != free_mem_before) return false; if(seg_mgr->allocate(ShmSizeSize*2, std::nothrow)) @@ -121,7 +121,7 @@ bool test_segment_manager() return false; if(seg_mgr->get_free_memory() != free_mem_before) return false; - BOOST_TRY{ seg_mgr->allocate_aligned(ShmSizeSize*2, Alignment); }BOOST_CATCH(interprocess_exception&){} BOOST_CATCH_END + BOOST_INTERPROCESS_TRY{ seg_mgr->allocate_aligned(ShmSizeSize*2, Alignment); }BOOST_INTERPROCESS_CATCH(interprocess_exception&){} BOOST_INTERPROCESS_CATCH_END if(seg_mgr->get_free_memory() != free_mem_before) return false; if(seg_mgr->allocate_aligned(ShmSizeSize*2, Alignment, std::nothrow)) @@ -210,9 +210,9 @@ bool test_segment_manager() if(seg_mgr->get_instance_name(int_array)) return false; seg_mgr->destroy_ptr(int_array); - BOOST_TRY{ seg_mgr->template construct(anonymous_instance)[ShmSizeSize](); }BOOST_CATCH(interprocess_exception&){} BOOST_CATCH_END + BOOST_INTERPROCESS_TRY{ seg_mgr->template construct(anonymous_instance)[ShmSizeSize](); }BOOST_INTERPROCESS_CATCH(interprocess_exception&){} BOOST_INTERPROCESS_CATCH_END if(seg_mgr->template construct(anonymous_instance, std::nothrow)[ShmSizeSize]()) - BOOST_TRY{ seg_mgr->template construct_it(anonymous_instance)[ShmSizeSize](&int_array_values[0]); }BOOST_CATCH(interprocess_exception&){} BOOST_CATCH_END + BOOST_INTERPROCESS_TRY{ seg_mgr->template construct_it(anonymous_instance)[ShmSizeSize](&int_array_values[0]); }BOOST_INTERPROCESS_CATCH(interprocess_exception&){} BOOST_INTERPROCESS_CATCH_END if(seg_mgr->template construct_it(anonymous_instance, std::nothrow)[ShmSizeSize](&int_array_values[0])) return false; if(seg_mgr->get_free_memory() != free_mem_before) @@ -295,9 +295,9 @@ bool test_segment_manager() seg_mgr->destroy_ptr(uint_object); seg_mgr->template destroy(object2_name); } - BOOST_TRY{ seg_mgr->template construct(object1_name)[ShmSizeSize](); }BOOST_CATCH(interprocess_exception&){} BOOST_CATCH_END + BOOST_INTERPROCESS_TRY{ seg_mgr->template construct(object1_name)[ShmSizeSize](); }BOOST_INTERPROCESS_CATCH(interprocess_exception&){} BOOST_INTERPROCESS_CATCH_END if(seg_mgr->template construct(object2_name, std::nothrow)[ShmSizeSize]()) - BOOST_TRY{ seg_mgr->template construct_it(object1_name)[ShmSizeSize](&int_array_values[0]); }BOOST_CATCH(interprocess_exception&){} BOOST_CATCH_END + BOOST_INTERPROCESS_TRY{ seg_mgr->template construct_it(object1_name)[ShmSizeSize](&int_array_values[0]); }BOOST_INTERPROCESS_CATCH(interprocess_exception&){} BOOST_INTERPROCESS_CATCH_END if(seg_mgr->template construct_it(object2_name, std::nothrow)[ShmSizeSize](&int_array_values[0])) return false; seg_mgr->shrink_to_fit_indexes(); @@ -385,9 +385,9 @@ bool test_segment_manager() seg_mgr->destroy_ptr(uint_object); seg_mgr->template destroy(unique_instance); } - BOOST_TRY{ seg_mgr->template construct(unique_instance)[ShmSizeSize](); }BOOST_CATCH(interprocess_exception&){} BOOST_CATCH_END + BOOST_INTERPROCESS_TRY{ seg_mgr->template construct(unique_instance)[ShmSizeSize](); }BOOST_INTERPROCESS_CATCH(interprocess_exception&){} BOOST_INTERPROCESS_CATCH_END if(seg_mgr->template construct(unique_instance, std::nothrow)[ShmSizeSize]()) - BOOST_TRY{ seg_mgr->template construct_it(unique_instance)[ShmSizeSize](&int_array_values[0]); }BOOST_CATCH(interprocess_exception&){} BOOST_CATCH_END + BOOST_INTERPROCESS_TRY{ seg_mgr->template construct_it(unique_instance)[ShmSizeSize](&int_array_values[0]); }BOOST_INTERPROCESS_CATCH(interprocess_exception&){} BOOST_INTERPROCESS_CATCH_END if(seg_mgr->template construct_it(unique_instance, std::nothrow)[ShmSizeSize](&int_array_values[0])) return false; seg_mgr->shrink_to_fit_indexes(); diff --git a/test/set_test.hpp b/test/set_test.hpp index ec35aa2..e17014e 100644 --- a/test/set_test.hpp +++ b/test/set_test.hpp @@ -35,7 +35,7 @@ int set_test () const char *const shMemName = test::get_process_id_name(); const int max = 100; - BOOST_TRY{ + BOOST_INTERPROCESS_TRY{ //Create shared memory shared_memory_object::remove(shMemName); ManagedSharedMemory segment(create_only, shMemName, Memsize); @@ -492,10 +492,10 @@ int set_test () return 1; } } - BOOST_CATCH(...){ + BOOST_INTERPROCESS_CATCH(...){ shared_memory_object::remove(shMemName); - BOOST_RETHROW - } BOOST_CATCH_END + BOOST_INTERPROCESS_RETHROW + } BOOST_INTERPROCESS_CATCH_END shared_memory_object::remove(shMemName); return 0; } @@ -512,7 +512,7 @@ int set_test_copyable () const char *const shMemName = test::get_process_id_name(); const int max = 100; - BOOST_TRY{ + BOOST_INTERPROCESS_TRY{ //Create shared memory shared_memory_object::remove(shMemName); ManagedSharedMemory segment(create_only, shMemName, Memsize); @@ -579,10 +579,10 @@ int set_test_copyable () if(!segment.all_memory_deallocated()) return 1; } - BOOST_CATCH(...){ + BOOST_INTERPROCESS_CATCH(...){ shared_memory_object::remove(shMemName); - BOOST_RETHROW - } BOOST_CATCH_END + BOOST_INTERPROCESS_RETHROW + } BOOST_INTERPROCESS_CATCH_END shared_memory_object::remove(shMemName); return 0; } diff --git a/test/shared_memory_mapping_test.cpp b/test/shared_memory_mapping_test.cpp index 407c919..d967eac 100644 --- a/test/shared_memory_mapping_test.cpp +++ b/test/shared_memory_mapping_test.cpp @@ -29,7 +29,7 @@ int main () std::string process_id = test::get_process_id_name(); std::string process_id2(process_id); process_id2 += "_2"; - BOOST_TRY{ + BOOST_INTERPROCESS_TRY{ const std::size_t FileSize = 99999*4; { //Remove shared memory @@ -200,19 +200,19 @@ int main () mapped_region region (mapping, read_only); shared_memory_object mapping2(create_only, process_id2.c_str(), read_write); mapping2.truncate(FileSize); - BOOST_TRY{ + BOOST_INTERPROCESS_TRY{ mapped_region region2 (mapping2, read_only, 0, FileSize, region.get_address()); } - BOOST_CATCH(interprocess_exception &e){ + BOOST_INTERPROCESS_CATCH(interprocess_exception &e){ shared_memory_object::remove(process_id2.c_str()); if(e.get_error_code() != busy_error){ throw e; } } - BOOST_CATCH(std::exception &){ + BOOST_INTERPROCESS_CATCH(std::exception &){ shared_memory_object::remove(process_id2.c_str()); - BOOST_RETHROW - } BOOST_CATCH_END + BOOST_INTERPROCESS_RETHROW + } BOOST_INTERPROCESS_CATCH_END shared_memory_object::remove(process_id2.c_str()); } { @@ -246,12 +246,12 @@ int main () shared_memory_object ret(get_shared_memory_mapping()); } } - BOOST_CATCH(std::exception &exc){ + BOOST_INTERPROCESS_CATCH(std::exception &exc){ shared_memory_object::remove(process_id.c_str()); shared_memory_object::remove(process_id2.c_str()); std::cout << "Unhandled exception: " << exc.what() << std::endl; return 1; - } BOOST_CATCH_END + } BOOST_INTERPROCESS_CATCH_END shared_memory_object::remove(process_id.c_str()); return 0; } diff --git a/test/shared_memory_test.cpp b/test/shared_memory_test.cpp index 6c4d713..8d90c7b 100644 --- a/test/shared_memory_test.cpp +++ b/test/shared_memory_test.cpp @@ -81,7 +81,7 @@ class shared_memory_creation_test_wrapper_w int main () { - BOOST_TRY{ + BOOST_INTERPROCESS_TRY{ shared_memory_object::remove(ShmName); test::test_named_creation(); #ifdef BOOST_INTERPROCESS_WCHAR_NAMED_RESOURCES @@ -102,11 +102,11 @@ int main () move_assign = boost::move(move_ctor); } } - BOOST_CATCH(std::exception &ex){ + BOOST_INTERPROCESS_CATCH(std::exception &ex){ shared_memory_object::remove(ShmName); std::cout << ex.what() << std::endl; return 1; - } BOOST_CATCH_END + } BOOST_INTERPROCESS_CATCH_END shared_memory_object::remove(ShmName); return 0; } diff --git a/test/shared_ptr_test.cpp b/test/shared_ptr_test.cpp index 9ffc700..4370d96 100644 --- a/test/shared_ptr_test.cpp +++ b/test/shared_ptr_test.cpp @@ -230,14 +230,14 @@ int string_shared_ptr_vector_insertion_test() } bool success = false; //Now this should throw - BOOST_TRY{ + BOOST_INTERPROCESS_TRY{ string_shared_ptr_t dummy(*beg); //We should never reach here return 1; } - BOOST_CATCH(const boost::interprocess::bad_weak_ptr &){ + BOOST_INTERPROCESS_CATCH(const boost::interprocess::bad_weak_ptr &){ success = true; - } BOOST_CATCH_END + } BOOST_INTERPROCESS_CATCH_END if(!success){ return 1; } @@ -466,12 +466,12 @@ int basic_shared_ptr_test() BOOST_TEST(wp1.expired()); BOOST_TEST(wp1.use_count() == 0); - BOOST_TRY{ + BOOST_INTERPROCESS_TRY{ x_shared_ptr sp1(wp1); BOOST_ERROR("shared_ptr sp1(wp1) failed to throw"); } - BOOST_CATCH(boost::interprocess::bad_weak_ptr const &) - {} BOOST_CATCH_END + BOOST_INTERPROCESS_CATCH(boost::interprocess::bad_weak_ptr const &) + {} BOOST_INTERPROCESS_CATCH_END test_is_zero(wp1.lock()); diff --git a/test/unordered_test.cpp b/test/unordered_test.cpp index c0b302e..6522cdb 100644 --- a/test/unordered_test.cpp +++ b/test/unordered_test.cpp @@ -42,7 +42,7 @@ int main() { //Remove any other old shared memory from the system bip::shared_memory_object::remove(bip::test::get_process_id_name()); - BOOST_TRY { + BOOST_INTERPROCESS_TRY { bip::managed_shared_memory shm(bip::create_only, bip::test::get_process_id_name(), 65536); //Elements to be inserted in unordered containers @@ -91,11 +91,11 @@ int main() return 1; } - BOOST_CATCH(...){ + BOOST_INTERPROCESS_CATCH(...){ //Remove shared memory from the system bip::shared_memory_object::remove(bip::test::get_process_id_name()); - BOOST_RETHROW - } BOOST_CATCH_END + BOOST_INTERPROCESS_RETHROW + } BOOST_INTERPROCESS_CATCH_END //Remove shared memory from the system bip::shared_memory_object::remove(bip::test::get_process_id_name()); return 0; diff --git a/test/user_buffer_test.cpp b/test/user_buffer_test.cpp index 6637c52..073a433 100644 --- a/test/user_buffer_test.cpp +++ b/test/user_buffer_test.cpp @@ -131,22 +131,18 @@ int main () if(!CheckEqual(userlist, stdlist, heaplist)) return 1; std::vector aux_vect; - #if !BOOST_WORKAROUND(BOOST_DINKUMWARE_STDLIB, == 1) aux_vect.assign(50, -1); userlist->assign(aux_vect.begin(), aux_vect.end()); heaplist->assign(aux_vect.begin(), aux_vect.end()); stdlist->assign(aux_vect.begin(), aux_vect.end()); if(!CheckEqual(userlist, stdlist, heaplist)) return 1; - #endif userlist->sort(); heaplist->sort(); stdlist->sort(); if(!CheckEqual(userlist, stdlist, heaplist)) return 1; - #if !BOOST_WORKAROUND(BOOST_DINKUMWARE_STDLIB, == 1) aux_vect.assign(50, 0); - #endif userlist->insert(userlist->begin(), aux_vect.begin(), aux_vect.end()); heaplist->insert(heaplist->begin(), aux_vect.begin(), aux_vect.end()); stdlist->insert(stdlist->begin(), aux_vect.begin(), aux_vect.end()); @@ -204,12 +200,12 @@ int main () delete stdlist; //Fill heap buffer until is full - BOOST_TRY{ + BOOST_INTERPROCESS_TRY{ while(1){ heaplist->insert(heaplist->end(), 0); } } - BOOST_CATCH(boost::interprocess::bad_alloc &){} BOOST_CATCH_END + BOOST_INTERPROCESS_CATCH(boost::interprocess::bad_alloc &){} BOOST_INTERPROCESS_CATCH_END MyHeapList::size_type heap_list_size = heaplist->size(); @@ -237,12 +233,12 @@ int main () } //Fill user buffer until is full - BOOST_TRY{ + BOOST_INTERPROCESS_TRY{ while(1){ userlist->insert(userlist->end(), 0); } } - BOOST_CATCH(boost::interprocess::bad_alloc &){} BOOST_CATCH_END + BOOST_INTERPROCESS_CATCH(boost::interprocess::bad_alloc &){} BOOST_INTERPROCESS_CATCH_END MyUserList::size_type user_list_size = userlist->size(); diff --git a/test/vector_test.hpp b/test/vector_test.hpp index 78f4676..7218221 100644 --- a/test/vector_test.hpp +++ b/test/vector_test.hpp @@ -89,7 +89,7 @@ int vector_test() //Compare several shared memory vector operations with std::vector //Create shared memory shared_memory_object::remove(shMemName); - BOOST_TRY{ + BOOST_INTERPROCESS_TRY{ ManagedSharedMemory segment(create_only, shMemName, Memsize); segment.reserve_named_objects(10); @@ -233,11 +233,11 @@ int vector_test() if(!segment.all_memory_deallocated()) return 1; } - BOOST_CATCH(std::exception &ex){ + BOOST_INTERPROCESS_CATCH(std::exception &ex){ shared_memory_object::remove(shMemName); std::cout << ex.what() << std::endl; return 1; - } BOOST_CATCH_END + } BOOST_INTERPROCESS_CATCH_END } shared_memory_object::remove(shMemName); std::cout << std::endl << "Test OK!" << std::endl; diff --git a/test/windows_eventlog_shared_memory_test.cpp b/test/windows_eventlog_shared_memory_test.cpp index 16a0d45..b385836 100644 --- a/test/windows_eventlog_shared_memory_test.cpp +++ b/test/windows_eventlog_shared_memory_test.cpp @@ -125,7 +125,7 @@ class shared_memory_creation_test_wrapper_w int main () { int ret = 0; - BOOST_TRY{ + BOOST_INTERPROCESS_TRY{ shared_memory_object::remove(ShmName); test::test_named_creation(); #ifdef BOOST_INTERPROCESS_WCHAR_NAMED_RESOURCES @@ -146,10 +146,10 @@ int main () move_assign = boost::move(move_ctor); } } - BOOST_CATCH(std::exception &ex){ + BOOST_INTERPROCESS_CATCH(std::exception &ex){ std::cout << ex.what() << std::endl; ret = 1; - } BOOST_CATCH_END + } BOOST_INTERPROCESS_CATCH_END shared_memory_object::remove(ShmName); return ret; } diff --git a/test/windows_shared_memory_mapping_test.cpp b/test/windows_shared_memory_mapping_test.cpp index cace9ab..135f964 100644 --- a/test/windows_shared_memory_mapping_test.cpp +++ b/test/windows_shared_memory_mapping_test.cpp @@ -23,7 +23,7 @@ using namespace boost::interprocess; int main () { - BOOST_TRY{ + BOOST_INTERPROCESS_TRY{ const char *names[2] = { test::get_process_id_name(), 0 }; for(unsigned int i_name = 0; i_name < sizeof(names)/sizeof(names[0]); ++i_name) { @@ -116,11 +116,11 @@ int main () } } } - BOOST_CATCH(std::exception &exc){ + BOOST_INTERPROCESS_CATCH(std::exception &exc){ //shared_memory_object::remove(test::get_process_id_name()); std::cout << "Unhandled exception: " << exc.what() << std::endl; return 1; - } BOOST_CATCH_END + } BOOST_INTERPROCESS_CATCH_END return 0; } diff --git a/test/windows_shared_memory_test.cpp b/test/windows_shared_memory_test.cpp index 6ac4b32..615b587 100644 --- a/test/windows_shared_memory_test.cpp +++ b/test/windows_shared_memory_test.cpp @@ -84,16 +84,16 @@ class shared_memory_creation_test_wrapper_w int main () { - BOOST_TRY{ + BOOST_INTERPROCESS_TRY{ test::test_named_creation(); #ifdef BOOST_INTERPROCESS_WCHAR_NAMED_RESOURCES test::test_named_creation(); #endif } - BOOST_CATCH(std::exception &ex){ + BOOST_INTERPROCESS_CATCH(std::exception &ex){ std::cout << ex.what() << std::endl; return 1; - } BOOST_CATCH_END + } BOOST_INTERPROCESS_CATCH_END return 0; } diff --git a/test/xsi_shared_memory_mapping_test.cpp b/test/xsi_shared_memory_mapping_test.cpp index d5e98e2..b20e51e 100644 --- a/test/xsi_shared_memory_mapping_test.cpp +++ b/test/xsi_shared_memory_mapping_test.cpp @@ -27,14 +27,14 @@ using namespace boost::interprocess; void remove_shared_memory(const xsi_key &key) { - BOOST_TRY{ + BOOST_INTERPROCESS_TRY{ xsi_shared_memory xsi(open_only, key); xsi_shared_memory::remove(xsi.get_shmid()); } - BOOST_CATCH(interprocess_exception &e){ + BOOST_INTERPROCESS_CATCH(interprocess_exception &e){ if(e.get_error_code() != not_found_error) - BOOST_RETHROW - } BOOST_CATCH_END + BOOST_INTERPROCESS_RETHROW + } BOOST_INTERPROCESS_CATCH_END } class xsi_shared_memory_remover @@ -63,27 +63,27 @@ int main () remove_shared_memory(key); unsigned int i; - BOOST_TRY{ + BOOST_INTERPROCESS_TRY{ for(i = 0; i < sizeof(names)/sizeof(names[0]); ++i) { const std::size_t FileSize = 16*1024; //Create a file mapping xsi_shared_memory mapping (create_only, names[i] ? key : xsi_key(), FileSize); xsi_shared_memory_remover rem(mapping); - BOOST_TRY{ + BOOST_INTERPROCESS_TRY{ { //Partial mapping should fail fox XSI shared memory bool thrown = false; - BOOST_TRY{ + BOOST_INTERPROCESS_TRY{ mapped_region region2(mapping, read_write, FileSize/2, FileSize - FileSize/2, 0); } - BOOST_CATCH(...){ + BOOST_INTERPROCESS_CATCH(...){ thrown = true; - } BOOST_CATCH_END + } BOOST_INTERPROCESS_CATCH_END if(thrown == false){ return 1; } - BOOST_TRY{ + BOOST_INTERPROCESS_TRY{ //Create a mapped region mapped_region region (mapping, read_write, 0, FileSize, 0); @@ -93,9 +93,9 @@ int main () *filler++ = static_cast(i); } } - BOOST_CATCH(std::exception& exc){ + BOOST_INTERPROCESS_CATCH(std::exception& exc){ std::cout << "Unhandled exception 0: " << exc.what() << " name: " << (names[i] ? names[i] : "null") << std::endl; - } BOOST_CATCH_END + } BOOST_INTERPROCESS_CATCH_END } //Now check the pattern mapping a single read only mapped_region @@ -112,16 +112,16 @@ int main () } } } - BOOST_CATCH(std::exception &exc){ + BOOST_INTERPROCESS_CATCH(std::exception &exc){ std::cout << "Unhandled exception 1: " << exc.what() << " name: " << (names[i] ? names[i] : "null") << std::endl; return 1; - } BOOST_CATCH_END + } BOOST_INTERPROCESS_CATCH_END } } - BOOST_CATCH(std::exception &exc){ + BOOST_INTERPROCESS_CATCH(std::exception &exc){ std::cout << "Unhandled exception 2: " << exc.what() << " name: " << (names[i] ? names[i] : "null") << std::endl; return 1; - } BOOST_CATCH_END + } BOOST_INTERPROCESS_CATCH_END return 0; }