From 36236a66fe60a62bf6c44efcc28e9d3cea09fd6b Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Tue, 10 Jan 2023 15:41:04 -0800 Subject: [PATCH] Suppress GCC 13's -Wmaybe-uninitialized in q_uninitialized_relocate_n MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Its objective is to copy uninitialized content and that's fine. qcontainertools_impl.h:73:25: error: ‘~~~’ may be used uninitialized [-Werror=maybe-uninitialized] 73 | std::memmove(static_cast(out), | ~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~ 74 | static_cast(first), | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 75 | n * sizeof(T)); | ~~~~~~~~~~~~~~ Change-Id: Ide4dbd0777a44ed0870efffd173917092b671dd0 Reviewed-by: Ahmad Samir Reviewed-by: Allan Sandfeld Jensen (cherry picked from commit a26d25be7b782d35a0b03b38dd0785188e1228e1) Reviewed-by: Qt Cherry-pick Bot --- src/corelib/tools/qcontainertools_impl.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/corelib/tools/qcontainertools_impl.h b/src/corelib/tools/qcontainertools_impl.h index 22f5cdf3363..adaa254a04a 100644 --- a/src/corelib/tools/qcontainertools_impl.h +++ b/src/corelib/tools/qcontainertools_impl.h @@ -56,6 +56,9 @@ static constexpr bool q_points_into_range(const T &p, const C &c) noexcept std::data(c) + std::distance(std::begin(c), std::end(c))); } +QT_WARNING_PUSH +QT_WARNING_DISABLE_GCC("-Wmaybe-uninitialized") + template void q_uninitialized_move_if_noexcept_n(T* first, N n, T* out) { @@ -81,6 +84,8 @@ void q_uninitialized_relocate_n(T* first, N n, T* out) } } +QT_WARNING_POP + template void q_relocate_overlap_n_left_move(iterator first, N n, iterator d_first) {