Ignore gcc's inaccurate strict aliasing warnings
This commit is contained in:
parent
4d0b5fd125
commit
e37ead5e9b
@ -27,6 +27,8 @@
|
|||||||
#include <rexy/detail/util.hpp> //max
|
#include <rexy/detail/util.hpp> //max
|
||||||
#include <rexy/detail/default_allocator.hpp>
|
#include <rexy/detail/default_allocator.hpp>
|
||||||
|
|
||||||
|
#define STOP_STRICT_ALIAS_WARNING(x) (x)
|
||||||
|
|
||||||
namespace rexy{
|
namespace rexy{
|
||||||
|
|
||||||
class binary_base
|
class binary_base
|
||||||
@ -91,7 +93,7 @@ namespace rexy{
|
|||||||
Allocator::free(m_data);
|
Allocator::free(m_data);
|
||||||
}
|
}
|
||||||
binary_data& operator=(const binary_data& b){
|
binary_data& operator=(const binary_data& b){
|
||||||
binary_data tmp(b);
|
binary_data<allocator_type> tmp(b);
|
||||||
return (*this = std::move(tmp));
|
return (*this = std::move(tmp));
|
||||||
}
|
}
|
||||||
binary_data& operator=(binary_data&& b){
|
binary_data& operator=(binary_data&& b){
|
||||||
@ -114,12 +116,12 @@ namespace rexy{
|
|||||||
bool resize(size_t newsize){
|
bool resize(size_t newsize){
|
||||||
if(newsize < m_cap)
|
if(newsize < m_cap)
|
||||||
return false;
|
return false;
|
||||||
binary_data tmp(newsize);
|
binary_data<allocator_type> tmp(newsize);
|
||||||
if(!tmp)
|
if(!tmp)
|
||||||
return false;
|
return false;
|
||||||
memcpy(tmp.m_data, m_data, m_size);
|
memcpy(STOP_STRICT_ALIAS_WARNING(tmp).m_data, m_data, m_size);
|
||||||
std::swap(m_data, tmp.m_data);
|
std::swap(m_data, STOP_STRICT_ALIAS_WARNING(tmp).m_data);
|
||||||
m_cap = tmp.m_cap;
|
m_cap = STOP_STRICT_ALIAS_WARING(tmp).m_cap;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
void append(const char* data, size_t len){
|
void append(const char* data, size_t len){
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user