Support Clang's -Wconversion -Wfloat-conversion -Wsign-conversion with -Werror

This commit is contained in:
Ion Gaztañaga
2021-10-20 00:18:59 +02:00
parent 3b5da7b0c1
commit efc75031f5
24 changed files with 114 additions and 102 deletions

View File

@@ -158,7 +158,7 @@ inline boost::uint32_t atomic_add32
// int r = *pw;
// *mem += val;
// return r;
int r;
boost::uint32_t r;
asm volatile
(

View File

@@ -121,7 +121,7 @@ class basic_managed_memory_impl
device_type f(open_or_create, filename, read_write);
if(!f.get_size(old_size))
return false;
f.truncate(old_size + extra_bytes);
f.truncate(old_size + static_cast<offset_t>(extra_bytes));
}
ManagedMemory managed_memory(open_only, filename);
//Grow always works
@@ -151,7 +151,7 @@ class basic_managed_memory_impl
//Decrease file size
{
device_type f(open_or_create, filename, read_write);
f.truncate(new_size);
f.truncate(static_cast<offset_t>(new_size));
}
return true;
}

View File

@@ -344,7 +344,7 @@ class managed_open_or_create_impl
{
BOOST_TRY{
//If this throws, we are lost
truncate_device<FileBased>(dev, size, file_like_t());
truncate_device<FileBased>(dev, static_cast<offset_t>(size), file_like_t());
//If the following throws, we will truncate the file to 1
mapped_region region(dev, read_write, 0, 0, addr);

View File

@@ -421,7 +421,7 @@ inline void thread_sleep_tick()
struct timespec rqt;
//Sleep for the half of the tick time
rqt.tv_sec = 0;
rqt.tv_nsec = get_system_tick_ns()/2;
rqt.tv_nsec = (long)get_system_tick_ns()/2;
::nanosleep(&rqt, 0);
}

View File

@@ -217,7 +217,7 @@ class robust_spin_mutex
template<class Mutex>
inline robust_spin_mutex<Mutex>::robust_spin_mutex()
: mtx(), owner(get_invalid_process_id()), state(correct_state)
: mtx(), owner((boost::uint32_t)get_invalid_process_id()), state(correct_state)
{}
template<class Mutex>
@@ -237,7 +237,7 @@ inline bool robust_spin_mutex<Mutex>::try_lock()
}
if (mtx.try_lock()){
atomic_write32(&this->owner, get_current_process_id());
atomic_write32(&this->owner, static_cast<boost::uint32_t>(get_current_process_id()));
return true;
}
else{
@@ -259,7 +259,7 @@ inline bool robust_spin_mutex<Mutex>::timed_lock
template<class Mutex>
inline void robust_spin_mutex<Mutex>::owner_to_filename(boost::uint32_t own, std::string &s)
{
robust_emulation_helpers::create_and_get_robust_lock_file_path(s, own);
robust_emulation_helpers::create_and_get_robust_lock_file_path(s, (OS_process_id_t)own);
}
template<class Mutex>
@@ -278,7 +278,7 @@ inline bool robust_spin_mutex<Mutex>::robust_check()
template<class Mutex>
inline bool robust_spin_mutex<Mutex>::check_if_owner_dead_and_take_ownership_atomically()
{
boost::uint32_t cur_owner = get_current_process_id();
boost::uint32_t cur_owner = static_cast<boost::uint32_t>(get_current_process_id());
boost::uint32_t old_owner = atomic_read32(&this->owner), old_owner2;
//The cas loop guarantees that only one thread from this or another process
//will succeed taking ownership
@@ -300,7 +300,7 @@ template<class Mutex>
inline bool robust_spin_mutex<Mutex>::is_owner_dead(boost::uint32_t own)
{
//If owner is an invalid id, then it's clear it's dead
if(own == (boost::uint32_t)get_invalid_process_id()){
if(own == static_cast<boost::uint32_t>(get_invalid_process_id())){
return true;
}
@@ -364,7 +364,7 @@ inline void robust_spin_mutex<Mutex>::unlock()
atomic_write32(&this->state, broken_state);
}
//Write an invalid owner to minimize pid reuse possibility
atomic_write32(&this->owner, get_invalid_process_id());
atomic_write32(&this->owner, static_cast<boost::uint32_t>(get_invalid_process_id()));
mtx.unlock();
}

View File

@@ -364,12 +364,12 @@ inline offset_t mapped_region::priv_page_offset_addr_fixup(offset_t offset, cons
//We calculate the difference between demanded and valid offset
//(always less than a page in std::size_t, thus, representable by std::size_t)
const std::size_t page_offset =
static_cast<std::size_t>(offset - (offset / page_size) * page_size);
static_cast<std::size_t>(offset - (offset / offset_t(page_size)) * offset_t(page_size));
//Update the mapping address
if(address){
address = static_cast<const char*>(address) - page_offset;
}
return page_offset;
return offset_t(page_offset);
}
#if defined (BOOST_INTERPROCESS_WINDOWS)
@@ -695,7 +695,7 @@ inline mapped_region::mapped_region
//Map it to the address space
void* base = mmap ( const_cast<void*>(address)
, static_cast<std::size_t>(page_offset + size)
, static_cast<std::size_t>(page_offset) + size
, prot
, flags
, mapping.get_mapping_handle().handle
@@ -709,7 +709,7 @@ inline mapped_region::mapped_region
//Calculate new base for the user
m_base = static_cast<char*>(base) + page_offset;
m_page_offset = page_offset;
m_page_offset = static_cast<std::size_t>(page_offset);
m_size = size;
//Check for fixed mapping error

View File

@@ -70,7 +70,7 @@ class permissions
#if defined(BOOST_INTERPROCESS_WINDOWS)
typedef void* os_permissions_type;
#else
typedef int os_permissions_type;
typedef ::mode_t os_permissions_type;
#endif
os_permissions_type m_perm;

View File

@@ -368,7 +368,7 @@ inline bool shared_memory_object::priv_open_or_create
error_info err(mode_error);
throw interprocess_exception(err);
}
int unix_perm = perm.get_permissions();
::mode_t unix_perm = perm.get_permissions();
switch(type){
case ipcdetail::DoOpen:

View File

@@ -148,7 +148,7 @@ namespace ipcdetail{
//!Constructor. Takes barrier attributes to initialize the barrier
barrier_initializer(pthread_barrier_t &mut,
pthread_barrierattr_t &mut_attr,
int count)
unsigned int count)
: mp_barrier(&mut)
{
if(pthread_barrier_init(mp_barrier, &mut_attr, count) != 0)

View File

@@ -42,16 +42,16 @@ inline timespec timepoint_to_timespec ( const TimePoint &tm
time_duration_type duration = (tm <= epoch) ? time_duration_type(epoch - epoch)
: time_duration_type(tm - epoch);
timespec ts;
ts.tv_sec = duration.total_seconds();
ts.tv_nsec = duration.total_nanoseconds() % 1000000000;
ts.tv_sec = static_cast<time_t>(duration.total_seconds());
ts.tv_nsec = static_cast<long>(duration.total_nanoseconds() % 1000000000);
return ts;
}
inline timespec timepoint_to_timespec (const ustime &tm)
{
timespec ts;
ts.tv_sec = tm.get_microsecs()/1000000u;
ts.tv_nsec = (tm.get_microsecs()%1000000u)*1000u;
ts.tv_sec = static_cast<time_t>(tm.get_microsecs()/1000000u);
ts.tv_nsec = static_cast<long>((tm.get_microsecs()%1000000u)*1000u);
return ts;
}
@@ -65,15 +65,15 @@ inline timespec timepoint_to_timespec ( const TimePoint &tm
timespec ts;
BOOST_IF_CONSTEXPR(duration_t::period::num == 1 && duration_t::period::den == 1000000000)
{
ts.tv_sec = d.count()/duration_t::period::den;
ts.tv_nsec = d.count()%duration_t::period::den;
ts.tv_sec = static_cast<time_t>(d.count()/duration_t::period::den);
ts.tv_nsec = static_cast<long>(d.count()%duration_t::period::den);
}
else
{
const double factor = double(duration_t::period::num)/double(duration_t::period::den);
const double res = d.count()*factor;
ts.tv_sec = static_cast<boost::uint64_t>(res);
ts.tv_nsec = static_cast<boost::uint64_t>(res - double(ts.tv_sec));
ts.tv_sec = static_cast<time_t>(res);
ts.tv_nsec = static_cast<long>(res - double(ts.tv_sec));
}
return ts;
}

View File

@@ -59,13 +59,13 @@ class winapi_mutex
};
inline winapi_mutex::winapi_mutex()
: id_(this)
: id_()
{
sync_handles &handles =
windows_intermodule_singleton<sync_handles>::get();
//Create mutex with the initial count
bool open_or_created;
(void)handles.obtain_mutex(this->id_, &open_or_created);
(void)handles.obtain_mutex(this->id_, this, &open_or_created);
//The mutex must be created, never opened
BOOST_ASSERT(open_or_created);
BOOST_ASSERT(open_or_created && winapi::get_last_error() != winapi::error_already_exists);
@@ -76,7 +76,7 @@ inline winapi_mutex::~winapi_mutex()
{
sync_handles &handles =
windows_intermodule_singleton<sync_handles>::get();
handles.destroy_handle(this->id_);
handles.destroy_handle(this->id_, this);
}
inline void winapi_mutex::lock(void)
@@ -84,7 +84,7 @@ inline void winapi_mutex::lock(void)
sync_handles &handles =
windows_intermodule_singleton<sync_handles>::get();
//This can throw
winapi_mutex_functions mut(handles.obtain_mutex(this->id_));
winapi_mutex_functions mut(handles.obtain_mutex(this->id_, this));
mut.lock();
}
@@ -93,7 +93,7 @@ inline bool winapi_mutex::try_lock(void)
sync_handles &handles =
windows_intermodule_singleton<sync_handles>::get();
//This can throw
winapi_mutex_functions mut(handles.obtain_mutex(this->id_));
winapi_mutex_functions mut(handles.obtain_mutex(this->id_, this));
return mut.try_lock();
}
@@ -103,7 +103,7 @@ inline bool winapi_mutex::timed_lock(const TimePoint &abs_time)
sync_handles &handles =
windows_intermodule_singleton<sync_handles>::get();
//This can throw
winapi_mutex_functions mut(handles.obtain_mutex(this->id_));
winapi_mutex_functions mut(handles.obtain_mutex(this->id_, this));
return mut.timed_lock(abs_time);
}
@@ -112,7 +112,7 @@ inline void winapi_mutex::unlock(void)
sync_handles &handles =
windows_intermodule_singleton<sync_handles>::get();
//This can throw
winapi_mutex_functions mut(handles.obtain_mutex(this->id_));
winapi_mutex_functions mut(handles.obtain_mutex(this->id_, this));
return mut.unlock();
}

View File

@@ -53,13 +53,13 @@ class winapi_semaphore
};
inline winapi_semaphore::winapi_semaphore(unsigned int initialCount)
: id_(this), initial_count_(initialCount)
: id_(), initial_count_(initialCount)
{
sync_handles &handles =
windows_intermodule_singleton<sync_handles>::get();
//Force smeaphore creation with the initial count
bool open_or_created;
handles.obtain_semaphore(this->id_, initialCount, &open_or_created);
handles.obtain_semaphore(this->id_, this, initialCount, &open_or_created);
//The semaphore must be created, never opened
BOOST_ASSERT(open_or_created);
BOOST_ASSERT(open_or_created && winapi::get_last_error() != winapi::error_already_exists);
@@ -70,7 +70,7 @@ inline winapi_semaphore::~winapi_semaphore()
{
sync_handles &handles =
windows_intermodule_singleton<sync_handles>::get();
handles.destroy_handle(this->id_);
handles.destroy_handle(this->id_, this);
}
inline void winapi_semaphore::wait()
@@ -78,7 +78,7 @@ inline void winapi_semaphore::wait()
sync_handles &handles =
windows_intermodule_singleton<sync_handles>::get();
//This can throw
winapi_semaphore_functions sem(handles.obtain_semaphore(this->id_, initial_count_));
winapi_semaphore_functions sem(handles.obtain_semaphore(this->id_, this, initial_count_));
sem.wait();
}
@@ -87,7 +87,7 @@ inline bool winapi_semaphore::try_wait()
sync_handles &handles =
windows_intermodule_singleton<sync_handles>::get();
//This can throw
winapi_semaphore_functions sem(handles.obtain_semaphore(this->id_, initial_count_));
winapi_semaphore_functions sem(handles.obtain_semaphore(this->id_, this, initial_count_));
return sem.try_wait();
}
@@ -97,7 +97,7 @@ inline bool winapi_semaphore::timed_wait(const TimePoint &abs_time)
sync_handles &handles =
windows_intermodule_singleton<sync_handles>::get();
//This can throw
winapi_semaphore_functions sem(handles.obtain_semaphore(this->id_, initial_count_));
winapi_semaphore_functions sem(handles.obtain_semaphore(this->id_, this, initial_count_));
return sem.timed_wait(abs_time);
}
@@ -105,8 +105,8 @@ inline void winapi_semaphore::post(unsigned release_count)
{
sync_handles &handles =
windows_intermodule_singleton<sync_handles>::get();
winapi_semaphore_functions sem(handles.obtain_semaphore(this->id_, initial_count_));
sem.post(release_count);
winapi_semaphore_functions sem(handles.obtain_semaphore(this->id_, this, initial_count_));
sem.post(static_cast<long>(release_count));
}

View File

@@ -30,11 +30,10 @@
//Shield against external warnings
#include <boost/interprocess/detail/config_external_begin.hpp>
#include <boost/unordered/unordered_map.hpp>
#include <boost/unordered/unordered_map.hpp>
#include <boost/interprocess/detail/config_external_end.hpp>
#include <boost/container/flat_map.hpp>
#include <boost/container/map.hpp>
#include <cstddef>
namespace boost {
@@ -89,12 +88,10 @@ class sync_id
{
public:
typedef __int64 internal_type;
sync_id(const void *map_addr)
: map_addr_(map_addr)
sync_id()
{ winapi::query_performance_counter(&rand_); }
explicit sync_id(internal_type val, const void *map_addr)
: map_addr_(map_addr)
explicit sync_id(internal_type val)
{ rand_ = val; }
const internal_type &internal_pod() const
@@ -103,18 +100,14 @@ class sync_id
internal_type &internal_pod()
{ return rand_; }
const void *map_address() const
{ return map_addr_; }
friend std::size_t hash_value(const sync_id &m)
{ return boost::hash_value(m.rand_); }
friend bool operator==(const sync_id &l, const sync_id &r)
{ return l.rand_ == r.rand_ && l.map_addr_ == r.map_addr_; }
{ return l.rand_ == r.rand_; }
private:
internal_type rand_;
const void * const map_addr_;
};
class sync_handles
@@ -123,19 +116,15 @@ class sync_handles
enum type { MUTEX, SEMAPHORE };
private:
struct address_less
{
bool operator()(sync_id const * const l, sync_id const * const r) const
{ return l->map_address() < r->map_address(); }
};
//key: id -> mapped: HANDLE. Hash map to allow efficient sync operations
typedef boost::unordered_map<sync_id, void*> umap_type;
typedef boost::container::map<const sync_id*, umap_type::iterator, address_less> map_type;
//key: ordered address of the sync type -> iterator from umap_type. Ordered map to allow closing handles when unmapping
typedef boost::container::flat_map<const void*, umap_type::iterator> map_type;
static const std::size_t LengthOfGlobal = sizeof("Global\\boost.ipc")-1;
static const std::size_t StrSize = LengthOfGlobal + (sizeof(sync_id)*2+1);
typedef char NameBuf[StrSize];
void fill_name(NameBuf &name, const sync_id &id)
{
const char *n = "Global\\boost.ipc";
@@ -151,7 +140,7 @@ class sync_handles
void throw_if_error(void *hnd_val)
{
if(!hnd_val){
error_info err(winapi::get_last_error());
error_info err(static_cast<int>(winapi::get_last_error()));
throw interprocess_exception(err);
}
}
@@ -183,41 +172,57 @@ class sync_handles
}
public:
void *obtain_mutex(const sync_id &id, bool *popen_created = 0)
sync_handles()
: num_handles_()
{}
~sync_handles()
{
BOOST_ASSERT(num_handles_ == 0); //Sanity check that handle we don't leak handles
}
void *obtain_mutex(const sync_id &id, const void *mapping_address, bool *popen_created = 0)
{
umap_type::value_type v(id, (void*)0);
scoped_lock<spin_mutex> lock(mtx_);
umap_type::iterator it = umap_.insert(v).first;
void *&hnd_val = it->second;
if(!hnd_val){
map_[&it->first] = it;
BOOST_ASSERT(map_.find(mapping_address) == map_.end());
map_[mapping_address] = it;
hnd_val = open_or_create_mutex(id);
if(popen_created) *popen_created = true;
++num_handles_;
}
else if(popen_created){
BOOST_ASSERT(map_.find(mapping_address) != map_.end());
*popen_created = false;
}
return hnd_val;
}
void *obtain_semaphore(const sync_id &id, unsigned int initial_count, bool *popen_created = 0)
void *obtain_semaphore(const sync_id &id, const void *mapping_address, unsigned int initial_count, bool *popen_created = 0)
{
umap_type::value_type v(id, (void*)0);
scoped_lock<spin_mutex> lock(mtx_);
umap_type::iterator it = umap_.insert(v).first;
void *&hnd_val = it->second;
if(!hnd_val){
map_[&it->first] = it;
BOOST_ASSERT(map_.find(mapping_address) == map_.end());
map_[mapping_address] = it;
hnd_val = open_or_create_semaphore(id, initial_count);
if(popen_created) *popen_created = true;
++num_handles_;
}
else if(popen_created){
BOOST_ASSERT(map_.find(mapping_address) != map_.end());
*popen_created = false;
}
return hnd_val;
}
void destroy_handle(const sync_id &id)
void destroy_handle(const sync_id &id, const void *mapping_address)
{
scoped_lock<spin_mutex> lock(mtx_);
umap_type::iterator it = umap_.find(id);
@@ -225,31 +230,38 @@ class sync_handles
if(it != itend){
winapi::close_handle(it->second);
const map_type::key_type &k = &it->first;
map_.erase(k);
--num_handles_;
std::size_t i = map_.erase(mapping_address);
BOOST_ASSERT(i == 1); //The entry should be there
umap_.erase(it);
}
}
void destroy_syncs_in_range(const void *addr, std::size_t size)
{
const sync_id low_id(addr);
const sync_id hig_id(static_cast<const char*>(addr)+size);
const void *low_id(addr);
const void *hig_id(static_cast<const char*>(addr)+size);
scoped_lock<spin_mutex> lock(mtx_);
map_type::iterator itlow(map_.lower_bound(&low_id)),
ithig(map_.lower_bound(&hig_id));
while(itlow != ithig){
void * const hnd = umap_[*itlow->first];
winapi::close_handle(hnd);
umap_.erase(*itlow->first);
itlow = map_.erase(itlow);
map_type::iterator itlow(map_.lower_bound(low_id)),
ithig(map_.lower_bound(hig_id)),
it(itlow);
for (; it != ithig; ++it){
umap_type::iterator uit = it->second;
void * const hnd = uit->second;
umap_.erase(uit);
int ret = winapi::close_handle(hnd);
--num_handles_;
BOOST_ASSERT(ret != 0); (void)ret; //Sanity check that handle was ok
}
map_.erase(itlow, ithig);
}
private:
spin_mutex mtx_;
umap_type umap_;
map_type map_;
std::size_t num_handles_;
};

View File

@@ -164,7 +164,7 @@ inline mapping_handle_t xsi_shared_memory::get_mapping_handle() const BOOST_NOEX
inline bool xsi_shared_memory::priv_open_or_create
(ipcdetail::create_enum_t type, const xsi_key &key, const permissions& permissions, std::size_t size)
{
int perm = permissions.get_permissions();
int perm = (int)permissions.get_permissions();
perm &= 0x01FF;
int shmflg = perm;

View File

@@ -115,7 +115,7 @@ void do_test_condition_notify_all()
{
const int NUMTHREADS = 3;
boost::interprocess::ipcdetail::OS_thread_t thgroup[NUMTHREADS];
boost::interprocess::ipcdetail::OS_thread_t thgroup[std::size_t(NUMTHREADS)];
condition_test_data<Condition, Mutex> data;
for(int i = 0; i< NUMTHREADS; ++i){
@@ -365,7 +365,7 @@ void do_test_condition_queue_notify_one(void)
waiting_readers = 0;
waiting_writer = 0;
boost::interprocess::ipcdetail::OS_thread_t thgroup[NumThreads];
boost::interprocess::ipcdetail::OS_thread_t thgroup[std::size_t(NumThreads)];
for(int i = 0; i< NumThreads; ++i){
condition_func<Condition, Mutex> func(cond_full, cond_empty, mutex);
boost::interprocess::ipcdetail::thread_launch(thgroup[i], func);
@@ -410,7 +410,7 @@ void do_test_condition_queue_notify_all(void)
waiting_readers = 0;
waiting_writer = 0;
boost::interprocess::ipcdetail::OS_thread_t thgroup[NumThreads];
boost::interprocess::ipcdetail::OS_thread_t thgroup[std::size_t(NumThreads)];
for(int i = 0; i< NumThreads; ++i){
condition_func<Condition, Mutex> func(cond_full, cond_empty, mutex);
boost::interprocess::ipcdetail::thread_launch(thgroup[i], func);

View File

@@ -130,7 +130,7 @@ bool test_insert_with_expand_bwd()
{ 100, 100, 100, 200,
300, 25, 100, 200 };
//Number of tests
const std::size_t Iterations = sizeof(InsertSize)/sizeof(int);
const std::size_t Iterations = sizeof(InsertSize)/sizeof(std::size_t);
for(std::size_t iteration = 0; iteration < Iterations; ++iteration)
{
@@ -187,7 +187,7 @@ bool test_assign_with_expand_bwd()
const std::size_t Offset[] = { 50, 50, 50};
const std::size_t InitialSize[] = { 25, 25, 25};
const std::size_t InsertSize[] = { 15, 35, 55};
const std::size_t Iterations = sizeof(InsertSize)/sizeof(int);
const std::size_t Iterations = sizeof(InsertSize)/sizeof(std::size_t);
for(std::size_t iteration = 0; iteration <Iterations; ++iteration)
{

View File

@@ -70,7 +70,7 @@ int test_managed_mapped_file()
file_mapping::remove(FileName);
const int max = 100;
void *array[max];
void *array[std::size_t(max)];
//Named allocate capable shared memory allocator
managed_mapped_file mfile(create_only, FileName, FileSize);

View File

@@ -62,7 +62,7 @@ int test_managed_shared_memory()
shared_memory_object::remove(ShmemName);
const int max = 100;
void *array[max];
void *array[std::size_t(max)];
//Named allocate capable shared memory allocator
managed_shared_memory shmem(create_only, ShmemName, ShmemSize);

View File

@@ -34,7 +34,7 @@ int main ()
{
const int max = 100;
void *array[max];
void *array[std::size_t(max)];
//Named allocate capable shared memory allocator
managed_windows_shared_memory w_shm(create_only, MemName, MemSize);

View File

@@ -50,7 +50,7 @@ class xsi_shared_memory_remover
int main ()
{
const int ShmemSize = 65536;
const std::size_t ShmemSize = 65536;
std::string filename = get_filename();
const char *const ShmemName = filename.c_str();
@@ -70,15 +70,15 @@ int main ()
//Remove the shmem it is already created
remove_shared_memory(key);
const int max = 100;
const std::size_t max = 100;
void *array[max];
//Named allocate capable shared memory allocator
managed_xsi_shared_memory shmem(create_only, key, ShmemSize);
shmid = shmem.get_shmid();
int i;
std::size_t i;
//Let's allocate some memory
for(i = 0; i < max; ++i){
array[i] = shmem.allocate(i+1);
array[i] = shmem.allocate(i+1u);
}
//Deallocate allocated memory

View File

@@ -172,13 +172,13 @@ int map_test ()
}
{
//This is really nasty, but we have no other simple choice
IntPairType aux_vect[max];
IntPairType aux_vect[std::size_t(max)];
for(int i = 0; i < max; ++i){
IntType i1(i);
IntType i2(i);
new(&aux_vect[i])IntPairType(boost::move(i1), boost::move(i2));
}
IntPairType aux_vect3[max];
IntPairType aux_vect3[std::size_t(max)];
for(int i = 0; i < max; ++i){
IntType i1(i);
IntType i2(i);
@@ -320,13 +320,13 @@ int map_test ()
{
//This is really nasty, but we have no other simple choice
IntPairType aux_vect[max];
IntPairType aux_vect[std::size_t(max)];
for(int i = 0; i < max; ++i){
IntType i1(i);
IntType i2(i);
new(&aux_vect[i])IntPairType(boost::move(i1), boost::move(i2));
}
IntPairType aux_vect3[max];
IntPairType aux_vect3[std::size_t(max)];
for(int i = 0; i < max; ++i){
IntType i1(i);
IntType i2(i);

View File

@@ -454,7 +454,7 @@ bool test_continuous_aligned_allocation(Allocator &a)
return false;
}
//Deallocate all
for(unsigned int k = buffers.size(); k--;){
for(std::size_t k = buffers.size(); k--;){
a.deallocate(buffers[k]);
}
buffers.clear();

View File

@@ -106,7 +106,7 @@ bool test_named_iterators(ManagedMemory &m)
{
typedef typename ManagedMemory::char_type char_type;
std::vector<char*> buffers;
const int BufferLen = 100;
const std::size_t BufferLen = 100;
char_type name[BufferLen];
typedef std::basic_string<char_type> string_type;
std::set<string_type> names;
@@ -177,7 +177,7 @@ bool test_shrink_to_fit(ManagedMemory &m)
{
typedef typename ManagedMemory::char_type char_type;
std::vector<char*> buffers;
const int BufferLen = 100;
const std::size_t BufferLen = 100;
char_type name[BufferLen];
basic_bufferstream<char_type> formatter(name, BufferLen);
@@ -218,7 +218,7 @@ bool test_direct_named_allocation_destruction(ManagedMemory &m)
{
typedef typename ManagedMemory::char_type char_type;
std::vector<char*> buffers;
const int BufferLen = 100;
const std::size_t BufferLen = 100;
char_type name[BufferLen];
basic_bufferstream<char_type> formatter(name, BufferLen);
@@ -259,7 +259,7 @@ bool test_named_allocation_inverse_destruction(ManagedMemory &m)
typedef typename ManagedMemory::char_type char_type;
std::vector<char*> buffers;
const int BufferLen = 100;
const std::size_t BufferLen = 100;
char_type name[BufferLen];
basic_bufferstream<char_type> formatter(name, BufferLen);
@@ -298,7 +298,7 @@ bool test_named_allocation_mixed_destruction(ManagedMemory &m)
typedef typename ManagedMemory::char_type char_type;
std::vector<char*> buffers;
const int BufferLen = 100;
const std::size_t BufferLen = 100;
char_type name[BufferLen];
basic_bufferstream<char_type> formatter(name, BufferLen);
@@ -339,7 +339,7 @@ bool test_inverse_named_allocation_destruction(ManagedMemory &m)
typedef typename ManagedMemory::char_type char_type;
std::vector<char*> buffers;
const int BufferLen = 100;
const std::size_t BufferLen = 100;
char_type name[BufferLen];
basic_bufferstream<char_type> formatter(name, BufferLen);

View File

@@ -25,7 +25,7 @@
#include <boost/interprocess/sync/scoped_lock.hpp>
#include <boost/interprocess/detail/os_thread_functions.hpp>
#if defined(BOOST_GCC) && (BOOST_GCC >= 40600)
#if defined(BOOST_CLANG) || (defined(BOOST_GCC) && (BOOST_GCC >= 40600))
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wsign-conversion"
#pragma GCC diagnostic ignored "-Wconversion"