Skip to content

Commit

Permalink
Suppress a warning around BoundedVector. (#803)
Browse files Browse the repository at this point in the history
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 <clalancette@gmail.com>
  • Loading branch information
clalancette committed Apr 24, 2024
1 parent 2579950 commit 858e76a
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions rosidl_runtime_cpp/include/rosidl_runtime_cpp/bounded_vector.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,16 @@
#include <utility>
#include <vector>

// GCC 13 has false positive warnings around stringop-overflow and array-bounds.
// The layout of a BoundedVector<bool> 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
{

Expand Down Expand Up @@ -789,4 +799,8 @@ swap(BoundedVector<Tp, UpperBound, Alloc> & x, BoundedVector<Tp, UpperBound, All

} // namespace rosidl_runtime_cpp

#if defined(__GNUC__) && !defined(__clang__)
#pragma GCC diagnostic pop
#endif

#endif // ROSIDL_RUNTIME_CPP__BOUNDED_VECTOR_HPP_

0 comments on commit 858e76a

Please sign in to comment.