From 6504af87080ec0f5193e0cd623795dedc4a5d9c3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ion=20Gazta=C3=B1aga?= Date: Sat, 15 Sep 2018 01:15:25 +0200 Subject: [PATCH] Disable false positives on "-Wstringop-overflow" and "-Warray-bounds" in release mode --- .../boost/container/detail/copy_move_algo.hpp | 18 ++++++++++++++---- test/expand_bwd_test_allocator.hpp | 8 ++++---- 2 files changed, 18 insertions(+), 8 deletions(-) diff --git a/include/boost/container/detail/copy_move_algo.hpp b/include/boost/container/detail/copy_move_algo.hpp index f03800a..7102a38 100644 --- a/include/boost/container/detail/copy_move_algo.hpp +++ b/include/boost/container/detail/copy_move_algo.hpp @@ -36,9 +36,18 @@ // std #include //for memmove/memcpy -#if defined(BOOST_GCC) && (BOOST_GCC >= 80000) +#if defined(BOOST_GCC) && (BOOST_GCC >= 40600) #pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wclass-memaccess" +//pair memcpy optimizations rightfully detected by GCC +# if defined(BOOST_GCC) && (BOOST_GCC >= 80000) +# pragma GCC diagnostic ignored "-Wclass-memaccess" +# endif +//GCC 8 seems a bit confused about array access error with static_vector +//when out of bound exceptions are being thrown. +# if defined(BOOST_GCC) && (BOOST_GCC >= 80000) && (BOOST_GCC < 80200) +# pragma GCC diagnostic ignored "-Wstringop-overflow" +# endif +# pragma GCC diagnostic ignored "-Warray-bounds" #endif namespace boost { @@ -184,6 +193,7 @@ F memmove_n(I f, U n, F r) BOOST_NOEXCEPT_OR_NOTHROW std::memmove(boost::movelib::iterator_to_raw_pointer(r), boost::movelib::iterator_to_raw_pointer(f), sizeof(value_type)*n); boost::container::iterator_advance(r, n); } + return r; } @@ -1146,9 +1156,9 @@ void move_assign_range_alloc_n( Allocator &a, I inp_start, typename allocator_tr } //namespace container { } //namespace boost { -#if defined(BOOST_GCC) && (BOOST_GCC >= 80000) +//#pragma GCC diagnostic ignored "-Wclass-memaccess" +#if defined(BOOST_GCC) && (BOOST_GCC >= 40600) #pragma GCC diagnostic pop #endif - #endif //#ifndef BOOST_CONTAINER_DETAIL_COPY_MOVE_ALGO_HPP diff --git a/test/expand_bwd_test_allocator.hpp b/test/expand_bwd_test_allocator.hpp index 3a5bb6c..60b3283 100644 --- a/test/expand_bwd_test_allocator.hpp +++ b/test/expand_bwd_test_allocator.hpp @@ -180,14 +180,14 @@ class expand_bwd_test_allocator //!Equality test for same type of expand_bwd_test_allocator template inline -bool operator==(const expand_bwd_test_allocator &alloc1, - const expand_bwd_test_allocator &alloc2) +bool operator==(const expand_bwd_test_allocator &, + const expand_bwd_test_allocator &) { return false; } //!Inequality test for same type of expand_bwd_test_allocator template inline -bool operator!=(const expand_bwd_test_allocator &alloc1, - const expand_bwd_test_allocator &alloc2) +bool operator!=(const expand_bwd_test_allocator &, + const expand_bwd_test_allocator &) { return true; } } //namespace test {