Fix false flag strict alias warnings

This commit is contained in:
rexy712 2020-05-02 22:30:21 -07:00
parent cdf329065a
commit ea1ac1cca3
2 changed files with 9 additions and 3 deletions

View File

@ -173,6 +173,8 @@ namespace rexy{
} }
} //namespace rexy } //namespace rexy
#undef STOP_STRICT_ALIAS_WARNING
#ifdef REXY_STRING_BASE_HPP #ifdef REXY_STRING_BASE_HPP
#include "detail/binary_string_conv.hpp" #include "detail/binary_string_conv.hpp"
#endif #endif

View File

@ -25,6 +25,8 @@
#include "cx/utility.hpp" //max #include "cx/utility.hpp" //max
#define STOP_STRICT_ALIAS_WARNING(x) (x)
namespace rexy{ namespace rexy{
template<class Allocator> template<class Allocator>
@ -158,9 +160,9 @@ namespace rexy{
}else{ }else{
string_intermediary tmp(cx::max(m_length + len, m_cap*2)); string_intermediary tmp(cx::max(m_length + len, m_cap*2));
if(m_data) if(m_data)
memcpy(tmp.m_data, m_data, m_length); memcpy(STOP_STRING_ALIASING_WARNING(tmp).m_data, m_data, m_length);
memcpy(tmp.m_data+m_length, data, len); memcpy(STOP_STRING_ALIASING_WARNING(tmp).m_data+m_length, data, len);
tmp.m_length = len+m_length; STOP_STRING_ALIASING_WARNING(tmp).m_length = len+m_length;
tmp[m_length+len] = 0; tmp[m_length+len] = 0;
*this = std::move(tmp); *this = std::move(tmp);
} }
@ -275,4 +277,6 @@ namespace rexy{
} //namespace rexy } //namespace rexy
#undef STOP_STRICT_ALIAS_WARNING
#endif #endif