From b1ecb24bdc5c086285760d0d7187fcfd7dc7d191 Mon Sep 17 00:00:00 2001 From: "mergify[bot]" <37929162+mergify[bot]@users.noreply.github.com> Date: Thu, 25 Apr 2024 09:49:18 +0200 Subject: [PATCH] Suppress a warning around BoundedVector. (#803) (#804) The comment has more explanation, but in short GCC 13 has false positives around some warnings, so we suppress it for BoundedVector. Signed-off-by: Chris Lalancette (cherry picked from commit 858e76adb03edba00469b91d50dd5fe0dcb34236) Co-authored-by: Chris Lalancette --- .../include/rosidl_runtime_cpp/bounded_vector.hpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/rosidl_runtime_cpp/include/rosidl_runtime_cpp/bounded_vector.hpp b/rosidl_runtime_cpp/include/rosidl_runtime_cpp/bounded_vector.hpp index f2fa3c0b5..2adc767d1 100644 --- a/rosidl_runtime_cpp/include/rosidl_runtime_cpp/bounded_vector.hpp +++ b/rosidl_runtime_cpp/include/rosidl_runtime_cpp/bounded_vector.hpp @@ -21,6 +21,16 @@ #include #include +// GCC 13 has false positive warnings around stringop-overflow and array-bounds. +// The layout of a BoundedVector triggers these warnings. Suppress them +// until this is fixed in upstream gcc. See +// https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114758 for more details. +#if defined(__GNUC__) && !defined(__clang__) +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wstringop-overflow" +#pragma GCC diagnostic ignored "-Warray-bounds" +#endif + namespace rosidl_runtime_cpp { @@ -789,4 +799,8 @@ swap(BoundedVector & x, BoundedVector