Skip to content

Commit

Permalink
Silence one more gcc false-positive. (#814)
Browse files Browse the repository at this point in the history
gcc 13 has false positives around array-bounds and
stringop-overflow, so suppress them here while generating
test cases.

Signed-off-by: Chris Lalancette <clalancette@gmail.com>
  • Loading branch information
clalancette authored Jun 21, 2024
1 parent 6a6287e commit 86fa398
Showing 1 changed file with 8 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,15 @@
// See the License for the specific language governing permissions and
// limitations under the License.

#if defined(__GNUC__) && !defined(__clang__)
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wstringop-overflow"
#pragma GCC diagnostic ignored "-Warray-bounds"
#endif
#include <gtest/gtest.h>
#if defined(__GNUC__) && !defined(__clang__)
#pragma GCC diagnostic pop
#endif

#include <algorithm>
#include <array>
Expand Down Expand Up @@ -478,15 +486,7 @@ TEST(Test_messages, constants_assign) {
// Defaults
TEST(Test_messages, defaults) {
rosidl_generator_tests::msg::Defaults message;
// workaround for https://github.com/google/googletest/issues/322
#ifdef __linux__
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wconversion-null"
#endif
TEST_BASIC_TYPE_FIELD_ASSIGNMENT(message, bool_value, true, false);
#ifdef __linux__
#pragma GCC diagnostic pop
#endif
TEST_BASIC_TYPE_FIELD_ASSIGNMENT(message, byte_value, 50, 255);
TEST_BASIC_TYPE_FIELD_ASSIGNMENT(message, char_value, 100, UINT8_MAX);
TEST_BASIC_TYPE_FIELD_ASSIGNMENT(message, float32_value, 1.125f, FLT_MAX);
Expand All @@ -510,7 +510,6 @@ TEST(Test_messages, string_arrays_default) {
ASSERT_EQ(3ul, message.string_values_default.size());
}

// TODO(mikaelarguedas) reenable this test when bounded strings enforce length
TEST(Test_messages, DISABLED_Test_bounded_strings) {
rosidl_generator_tests::msg::Strings message;
TEST_STRING_FIELD_ASSIGNMENT(message, bounded_string_value, "", "Deep into")
Expand Down

0 comments on commit 86fa398

Please sign in to comment.