mirror of
https://github.com/boostorg/charconv.git
synced 2026-02-09 11:02:30 +00:00
Ignore GCC10+ memcpy overflow warning
This commit is contained in:
@@ -9,6 +9,19 @@
|
||||
#include <cstring>
|
||||
#include <cstdint>
|
||||
|
||||
// GCC 10 added checks for length of memcpy which yields the following warning (converted to error with -Werror)
|
||||
// /usr/include/x86_64-linux-gnu/bits/string_fortified.h:34:33: error:
|
||||
// ‘void* __builtin___memcpy_chk(void*, const void*, long unsigned int, long unsigned int)’ specified size between
|
||||
// 18446744071562067968 and 18446744073709551615 exceeds maximum object size 9223372036854775807 [-Werror=stringop-overflow=]
|
||||
//
|
||||
// memcpy is defined as taking a size_t for the count and the largest count this will recieve is the number of digits
|
||||
// in a 128-bit int (39) so we can safely ignore
|
||||
#if __GNUC__ >= 10
|
||||
# pragma GCC diagnostic push
|
||||
# pragma GCC diagnostic ignored "-Wstringop-overflow"
|
||||
# define BOOST_CHARCONV_STRINGOP_OVERFLOW_DISABLED
|
||||
#endif
|
||||
|
||||
namespace boost { namespace charconv { namespace detail {
|
||||
|
||||
#if !defined(BOOST_CHARCONV_NO_CONSTEXPR_DETECTION) && defined(BOOST_CXX14_CONSTEXPR)
|
||||
@@ -45,4 +58,8 @@ inline void* memcpy(void* dest, const void* src, std::size_t count)
|
||||
|
||||
}}} // Namespace boost::charconv::detail
|
||||
|
||||
#ifdef BOOST_CHARCONV_STRINGOP_OVERFLOW_DISABLED
|
||||
# pragma GCC diagnostic pop
|
||||
#endif
|
||||
|
||||
#endif // BOOST_CHARCONV_DETAIL_MEMCPY_HPP
|
||||
|
||||
Reference in New Issue
Block a user