forked from boostorg/static_string
fix restrict warning
This commit is contained in:
committed by
Alan de Freitas
parent
25579e482f
commit
c4f6491537
@ -38,8 +38,8 @@ def main(ctx):
|
||||
linux_cxx("Coverage", "g++-8", packages="g++-8", buildscript="drone", buildtype="codecov", image=linuxglobalimage, environment={'COMMENT': 'codecov.io', 'LCOV_BRANCH_COVERAGE': '0', 'B2_CXXSTD': '11', 'B2_TOOLSET': 'gcc-8', 'B2_DEFINES': 'BOOST_NO_STRESS_TEST=1', "CODECOV_TOKEN": {"from_secret": "codecov_token"}, "COVERALLS_REPO_TOKEN": {"from_secret": "coveralls_repo_token"}}, globalenv=globalenv),
|
||||
|
||||
# Latest gcc
|
||||
linux_cxx("GCC 12: C++17,20", "g++-12", packages="g++-12", buildscript="drone", buildtype="boost", image="cppalliance/droneubuntu2204:1", environment={'B2_TOOLSET': 'gcc-12', 'B2_CXXFLAGS': '-Werror -Wno-error=restrict', 'B2_CXXSTD': '17,20'}, globalenv=globalenv),
|
||||
linux_cxx("GCC 12: C++17,20 Standalone", "g++-12", packages="g++-12", buildscript="drone", buildtype="boost", image="cppalliance/droneubuntu2204:1", environment={'B2_TOOLSET': 'gcc-12', 'B2_CXXFLAGS': '-Werror -Wno-error=restrict', 'B2_DEFINES': 'define=BOOST_STATIC_STRING_STANDALONE', 'B2_CXXSTD': '17,20'}, globalenv=globalenv),
|
||||
linux_cxx("GCC 12: C++17,20", "g++-12", packages="g++-12", buildscript="drone", buildtype="boost", image="cppalliance/droneubuntu2204:1", environment={'B2_TOOLSET': 'gcc-12', 'B2_CXXFLAGS': '-Werror', 'B2_CXXSTD': '17,20'}, globalenv=globalenv),
|
||||
linux_cxx("GCC 12: C++17,20 Standalone", "g++-12", packages="g++-12", buildscript="drone", buildtype="boost", image="cppalliance/droneubuntu2204:1", environment={'B2_TOOLSET': 'gcc-12', 'B2_CXXFLAGS': '-Werror', 'B2_DEFINES': 'define=BOOST_STATIC_STRING_STANDALONE', 'B2_CXXSTD': '17,20'}, globalenv=globalenv),
|
||||
|
||||
# Latest clang
|
||||
linux_cxx("Clang 15: C++17,20", "clang++-15", packages="clang-15 libstdc++-10-dev", llvm_os="jammy", llvm_ver="15", buildscript="drone", buildtype="boost", image="cppalliance/droneubuntu2204:1", environment={'B2_TOOLSET': 'clang-15', 'B2_CXXFLAGS': '-Werror', 'B2_CXXSTD': '17,20'}, globalenv=globalenv),
|
||||
@ -58,7 +58,7 @@ def main(ctx):
|
||||
linux_cxx("Valgrind", "clang++-14", packages="clang-14 libc6-dbg libc++-dev libstdc++-9-dev", llvm_os="jammy", llvm_ver="14", buildscript="drone", buildtype="valgrind", image="cppalliance/droneubuntu2204:1", environment={'COMMENT': 'valgrind', 'B2_TOOLSET': 'clang-14', 'B2_CXXSTD': '11,14,17', 'B2_DEFINES': 'BOOST_NO_STRESS_TEST=1', 'B2_VARIANT': 'debug', 'B2_TESTFLAGS': 'testing.launcher=valgrind', 'VALGRIND_OPTS': '--error-exitcode=1'}, globalenv=globalenv),
|
||||
|
||||
# arm64 (unsigned char)
|
||||
linux_cxx("ARM64: GCC 11", "g++-11", packages="g++-11", buildscript="drone", buildtype="boost", image="cppalliance/droneubuntu2004:multiarch", environment={'B2_TOOLSET': 'gcc-11', 'B2_CXXFLAGS': '-Werror -Wno-error=array-bounds -Wno-error=restrict -Wno-error=stringop-overflow', 'B2_CXXSTD': '17,20'}, arch="arm64", globalenv=globalenv),
|
||||
linux_cxx("ARM64: GCC 11", "g++-11", packages="g++-11", buildscript="drone", buildtype="boost", image="cppalliance/droneubuntu2004:multiarch", environment={'B2_TOOLSET': 'gcc-11', 'B2_CXXFLAGS': '-Werror -Wno-error=array-bounds -Wno-error=stringop-overflow', 'B2_CXXSTD': '17,20'}, arch="arm64", globalenv=globalenv),
|
||||
|
||||
# s390x
|
||||
linux_cxx("S390x: Clang 12", "clang++-12", packages="clang-12 libstdc++-9-dev", llvm_os="focal", llvm_ver="12", buildtype="boost", buildscript="drone", image="cppalliance/droneubuntu2004:multiarch", environment={'B2_TOOLSET': 'clang-12', 'B2_CXXFLAGS': '-Werror', 'B2_CXXSTD': '17,20'}, arch="s390x", globalenv=globalenv),
|
||||
|
@ -6063,33 +6063,49 @@ insert(
|
||||
detail::is_forward_iterator<
|
||||
ForwardIterator>::value, iterator>::type
|
||||
{
|
||||
// input
|
||||
const std::size_t count = detail::distance(first, last);
|
||||
const auto first_addr = &*first;
|
||||
const auto last_addr = first_addr + count;
|
||||
|
||||
// output
|
||||
const auto curr_size = size();
|
||||
const auto curr_data = data();
|
||||
const std::size_t count = detail::distance(first, last);
|
||||
const std::size_t index = pos - curr_data;
|
||||
const auto first_addr = &*first;
|
||||
auto dest = &curr_data[index];
|
||||
|
||||
if (count > max_size() - curr_size)
|
||||
detail::throw_exception<std::length_error>(
|
||||
"count > max_size() - curr_size");
|
||||
|
||||
traits_type::move(dest + count, dest, curr_size - index + 1);
|
||||
const bool inside = detail::ptr_in_range(curr_data, curr_data + curr_size, first_addr);
|
||||
if (!inside || (inside && (first_addr + count <= pos)))
|
||||
if (!inside || last_addr <= pos)
|
||||
{
|
||||
traits_type::move(&curr_data[index + count], &curr_data[index], curr_size - index + 1);
|
||||
detail::copy_with_traits<Traits>(first, last, &curr_data[index]);
|
||||
detail::copy_with_traits<Traits>(first, last, dest);
|
||||
}
|
||||
else
|
||||
else /* if (inside) */
|
||||
{
|
||||
const size_type offset = first_addr - curr_data;
|
||||
traits_type::move(&curr_data[index + count], &curr_data[index], curr_size - index + 1);
|
||||
if (offset < index)
|
||||
{
|
||||
const size_type diff = index - offset;
|
||||
traits_type::copy(&curr_data[index], &curr_data[offset], diff);
|
||||
traits_type::copy(&curr_data[index + diff], &curr_data[index + count], count - diff);
|
||||
#if BOOST_WORKAROUND( BOOST_GCC, >= 120000 )
|
||||
detail::copy_with_traits<Traits>(&curr_data[offset], &curr_data[offset] + diff, dest);
|
||||
detail::copy_with_traits<Traits>(dest + count, dest + 2 * count - diff, &curr_data[index + diff]);
|
||||
#else
|
||||
traits_type::copy(dest, &curr_data[offset], diff);
|
||||
traits_type::copy(&curr_data[index + diff], dest + count, count - diff);
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
traits_type::copy(&curr_data[index], &curr_data[offset + count], count);
|
||||
auto src = &curr_data[offset + count];
|
||||
#if BOOST_WORKAROUND( BOOST_GCC, >= 120000 )
|
||||
detail::copy_with_traits<Traits>(src, src + count, dest);
|
||||
#else
|
||||
traits_type::copy(dest, src, count);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
this->set_size(curr_size + count);
|
||||
|
Reference in New Issue
Block a user