merging interprocess from develop

This commit is contained in:
Ion Gaztañaga
2018-11-24 12:22:17 +01:00
10 changed files with 41 additions and 19 deletions

View File

@@ -73,9 +73,10 @@ your system's documentation to know which library implements them.
[*Boost.Interprocess] has been tested in the following compilers/platforms:
* Visual >= 7.1
* GCC >= 4.1
* Intel 11
* Visual C++ >= 7.1.
* GCC >= 4.1.
[warning GCC < 4.3 and MSVC < 9.0 are deprecated and will be removed in the next version.]
[endsect]
@@ -6763,10 +6764,15 @@ thank them:
[section:release_notes Release Notes]
[section:release_notes_boost_1_69_00 Boost 1.69 Release]
* Deprecated GCC < 4.3 and MSVC < 9.0 (Visual 2008) compilers.
* Fixed bugs:
* [@https://github.com/boostorg/interprocess/issues/59 GitHub Issue #59 (['"warning: ISO C++ prohibits anonymous structs [-Wpedantic]"])].
* [@https://github.com/boostorg/interprocess/issues/60 GitHub Issue #60 (['"warning: cast between incompatible function types from boost::interprocess::winapi::farproc_t..."])].
* [@https://github.com/boostorg/interprocess/issues/61 GitHub Issue #61 (['"warning: struct winapi::*_BIPC has virtual functions and accessible non-virtual destructor"])].
* [@https://github.com/boostorg/interprocess/issues/64 GitHub Issue #64 (['"UBSan: runtime error: load of value 4294967295, (...) for type 'boost::interprocess::mode_t'"])].
* [@https://github.com/boostorg/interprocess/pull/68 GitHub Pull #68 (['"Prepare for C++20 and remove "throw()" usage"])].
[endsect]

View File

@@ -44,6 +44,11 @@ class complex_data
: id_(id), char_string_(name, void_alloc), int_vector_vector_(void_alloc)
{}
//Other members...
//<-
int get_id() { return id_; };
char_string get_char_string() { return char_string_; };
int_vector_vector get_int_vector_vector() { return int_vector_vector_; };
//->
};
//Definition of the map holding a string as key and complex_data as mapped type

View File

@@ -88,6 +88,9 @@ int main()
//Get free memory and compare
managed_shared_memory::size_type free_memory_after_expansion = managed_shm.get_free_memory();
assert(free_memory_after_expansion < free_memory_after_allocation);
//<-
(void)free_memory_after_expansion;
//->
//Write new values
for(std::size_t i = first_received_size; i < expanded_size; ++i) ptr[i] = i;
@@ -109,6 +112,9 @@ int main()
//Get free memory and compare
managed_shared_memory::size_type free_memory_after_shrinking = managed_shm.get_free_memory();
assert(free_memory_after_shrinking > free_memory_after_expansion);
//<-
(void)free_memory_after_shrinking;
//->
//Deallocate the buffer
managed_shm.deallocate(ptr);

View File

@@ -113,12 +113,13 @@ class file_wrapper
bool priv_open_or_create(ipcdetail::create_enum_t type, const char *filename, mode_t mode, const permissions &perm);
file_handle_t m_handle;
mode_t m_mode;
std::string m_filename;
mode_t m_mode;
std::string m_filename;
};
inline file_wrapper::file_wrapper()
: m_handle(file_handle_t(ipcdetail::invalid_file()))
: m_handle(file_handle_t(ipcdetail::invalid_file()))
, m_mode(read_only), m_filename()
{}
inline file_wrapper::~file_wrapper()

View File

@@ -60,9 +60,9 @@ class BOOST_SYMBOL_VISIBLE interprocess_exception : public std::exception
catch(...){}
}
virtual ~interprocess_exception() throw(){}
virtual ~interprocess_exception() BOOST_NOEXCEPT_OR_NOTHROW {}
virtual const char * what() const throw()
virtual const char * what() const BOOST_NOEXCEPT_OR_NOTHROW
{ return m_str.c_str(); }
native_error_t get_native_error()const { return m_err.get_native_error(); }
@@ -86,7 +86,7 @@ class BOOST_SYMBOL_VISIBLE lock_exception : public interprocess_exception
: interprocess_exception(lock_error)
{}
virtual const char* what() const throw()
virtual const char* what() const BOOST_NOEXCEPT_OR_NOTHROW
{ return "boost::interprocess::lock_exception"; }
};
@@ -97,7 +97,7 @@ class BOOST_SYMBOL_VISIBLE bad_alloc : public interprocess_exception
{
public:
bad_alloc() : interprocess_exception("::boost::interprocess::bad_alloc"){}
virtual const char* what() const throw()
virtual const char* what() const BOOST_NOEXCEPT_OR_NOTHROW
{ return "boost::interprocess::bad_alloc"; }
};

View File

@@ -36,7 +36,7 @@ class bad_weak_ptr
{
public:
virtual char const * what() const throw()
virtual char const * what() const BOOST_NOEXCEPT_OR_NOTHROW
{ return "boost::interprocess::bad_weak_ptr"; }
};

View File

@@ -21,7 +21,6 @@
using namespace boost::interprocess;
static const std::size_t FileSize = 1000;
inline std::string get_filename()
{
std::string ret (ipcdetail::get_temporary_path());

View File

@@ -11,6 +11,7 @@
#include <boost/interprocess/detail/intermodule_singleton.hpp>
#include <boost/interprocess/detail/portable_intermodule_singleton.hpp>
#include <iostream>
#include <cstdlib> //for std::abort
using namespace boost::interprocess;
@@ -184,7 +185,8 @@ class LogPhoenixTester
sstr << "Logger<Tag>::constructed_times != Logger<Tag>::destroyed_times\n";
sstr << "(" << Logger<Tag>::constructed_times << " vs. " << Logger<Tag>::destroyed_times << ")\n";
}
throw std::runtime_error(sstr.str().c_str());
std::cout << "~LogPhoenixTester(), error: " << sstr.str() << std::endl;
std::abort();
}
}
};
@@ -214,7 +216,8 @@ class LogDeadReferenceUser
LogSingleton::get().log_it();
std::string s("LogDeadReferenceUser failed for LogSingleton ");
s += typeid(LogSingleton).name();
throw std::runtime_error(s.c_str());
std::cout << "~LogDeadReferenceUser(), error: " << s << std::endl;
std::abort();
}
catch(interprocess_exception &){
//Correct behaviour

View File

@@ -8,9 +8,11 @@
//
//////////////////////////////////////////////////////////////////////////////
#include <boost/interprocess/detail/config_begin.hpp>
#include <boost/interprocess/detail/workaround.hpp>
#if defined(BOOST_INTERPROCESS_MAPPED_FILES)
#include <boost/interprocess/detail/config_begin.hpp>
#include <boost/interprocess/allocators/allocator.hpp>
#include <boost/interprocess/containers/vector.hpp>
#include <boost/interprocess/managed_mapped_file.hpp>
@@ -225,8 +227,6 @@ int main ()
return 0;
}
#include <boost/interprocess/detail/config_end.hpp>
#else //#if defined(BOOST_INTERPROCESS_MAPPED_FILES)
int main()
@@ -235,3 +235,5 @@ int main()
}
#endif//#if defined(BOOST_INTERPROCESS_MAPPED_FILES)
#include <boost/interprocess/detail/config_end.hpp>

View File

@@ -274,7 +274,7 @@ struct X
{
X(){ ++cnt; }
// virtual destructor deliberately omitted
~X(){ --cnt; }
virtual ~X(){ --cnt; }
virtual int id() const
{ return 1; }
@@ -287,7 +287,7 @@ struct X
struct Y: public X
{
Y(){ ++cnt; }
~Y(){ --cnt; }
virtual ~Y(){ --cnt; }
virtual int id() const
{ return 2; }