Skip to content

Commit 70366d7

Browse files
[#2499] Suppress compiler warnings
1 parent fe77d35 commit 70366d7

File tree

3 files changed

+33
-1
lines changed

3 files changed

+33
-1
lines changed

iceoryx_hoofs/test/moduletests/test_vocabulary_string.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,14 @@ TYPED_TEST(stringTyped_test, UnsafeRawAccessCStringOfSizeCapaResultsInSizeCapa)
8383
using MyString = typename TestFixture::stringType;
8484
constexpr auto STRINGCAP = MyString::capacity();
8585
std::vector<char> testCharstring(STRINGCAP, 'M');
86+
#if (defined(__GNUC__))
87+
#pragma GCC diagnostic push
88+
#pragma GCC diagnostic ignored "-Warray-bounds"
89+
#endif
8690
testCharstring.emplace_back('\0');
91+
#if (defined(__GNUC__))
92+
#pragma GCC diagnostic pop
93+
#endif
8794
this->testSubject.unsafe_raw_access([&](char* str, const auto) -> uint64_t {
8895
//NOLINTNEXTLINE(clang-analyzer-security.insecureAPI.strcpy,-warnings-as-errors)
8996
strcpy(str, testCharstring.data());

iceoryx_hoofs/test/moduletests/test_vocabulary_string_ctor_and_assign.cpp

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -727,7 +727,15 @@ TYPED_TEST(stringTyped_test, UnsafeAssignCStringOfSizeCapaResultsInSizeCapa)
727727
using MyString = typename TestFixture::stringType;
728728
constexpr auto STRINGCAP = MyString::capacity();
729729
std::vector<char> testCharstring(STRINGCAP, 'M');
730+
#if (defined(__GNUC__))
731+
#pragma GCC diagnostic push
732+
#pragma GCC diagnostic ignored "-Warray-bounds"
733+
#pragma GCC diagnostic ignored "-Wstringop-overflow"
734+
#endif
730735
testCharstring.emplace_back('\0');
736+
#if (defined(__GNUC__))
737+
#pragma GCC diagnostic pop
738+
#endif
731739
EXPECT_THAT(this->testSubject.unsafe_assign(testCharstring.data()), Eq(true));
732740
EXPECT_THAT(this->testSubject.size(), Eq(STRINGCAP));
733741
}
@@ -738,7 +746,15 @@ TYPED_TEST(stringTyped_test, UnsafeAssignCStringOfSizeGreaterCapaResultsInSize0)
738746
using MyString = typename TestFixture::stringType;
739747
constexpr auto STRINGCAP = MyString::capacity();
740748
std::vector<char> testCharstring(STRINGCAP + 1U, 'M');
749+
#if (defined(__GNUC__))
750+
#pragma GCC diagnostic push
751+
#pragma GCC diagnostic ignored "-Warray-bounds"
752+
#pragma GCC diagnostic ignored "-Wstringop-overflow"
753+
#endif
741754
testCharstring.emplace_back('\0');
755+
#if (defined(__GNUC__))
756+
#pragma GCC diagnostic pop
757+
#endif
742758
EXPECT_THAT(this->testSubject.unsafe_assign(testCharstring.data()), Eq(false));
743759
EXPECT_THAT(this->testSubject.size(), Eq(0U));
744760
EXPECT_THAT(this->testSubject.c_str(), StrEq(""));
@@ -752,7 +768,15 @@ TYPED_TEST(stringTyped_test, UnsafeAssignOfInvalidCStringFails)
752768
using MyString = typename TestFixture::stringType;
753769
constexpr auto STRINGCAP = MyString::capacity();
754770
std::vector<char> testCharstring(STRINGCAP + 1U, 'M');
771+
#if (defined(__GNUC__))
772+
#pragma GCC diagnostic push
773+
#pragma GCC diagnostic ignored "-Warray-bounds"
774+
#pragma GCC diagnostic ignored "-Wstringop-overflow"
775+
#endif
755776
testCharstring.emplace_back('\0');
777+
#if (defined(__GNUC__))
778+
#pragma GCC diagnostic pop
779+
#endif
756780

757781
EXPECT_THAT(this->testSubject.unsafe_assign(testCharstring.data()), Eq(false));
758782
EXPECT_THAT(this->testSubject.size(), Eq(1U));

iceoryx_hoofs/testing/include/iceoryx_hoofs/testing/fatal_failure.inl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,9 +77,10 @@ inline bool IOX_EXPECT_FATAL_FAILURE(const function_ref<void()> testFunction,
7777
template <typename ErrorType>
7878
// NOLINTJUSTIFICATION The complexity comes from the expanded macros; without the expansions the function is quite readable
7979
// NOLINTNEXTLINE(readability-function-size, readability-function-cognitive-complexity)
80-
inline bool IOX_EXPECT_FATAL_FAILURE(const function_ref<void()> testFunction,
80+
inline bool IOX_EXPECT_FATAL_FAILURE(const function_ref<void()> testFunction [[maybe_unused]],
8181
const ErrorType expectedError [[maybe_unused]])
8282
{
83+
// TODO
8384
return true;
8485
}
8586
#endif

0 commit comments

Comments
 (0)