Skip to content

Commit

Permalink
Suppress warning false positives in release build
Browse files Browse the repository at this point in the history
  • Loading branch information
calcmogul committed Sep 19, 2023
1 parent 4d3bea7 commit a31ecbb
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 1 deletion.
11 changes: 10 additions & 1 deletion ntcore/src/main/native/include/networktables/NetworkTableValue.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,11 @@

namespace nt {

#if __GNUC__ >= 13
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wmaybe-uninitialized"
#endif

/**
* A network table entry value.
* @ingroup ntcore_cpp_api
Expand Down Expand Up @@ -641,9 +646,13 @@ class Value final {
private:
NT_Value m_val = {};
std::shared_ptr<void> m_storage;
size_t m_size;
size_t m_size = 0;
};

#if __GNUC__ >= 13
#pragma GCC diagnostic pop
#endif

bool operator==(const Value& lhs, const Value& rhs);

/**
Expand Down
14 changes: 14 additions & 0 deletions wpinet/src/test/native/cpp/WebSocketServerTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -396,7 +396,14 @@ TEST_F(WebSocketServerTest, ReceiveFragment) {
std::vector<uint8_t> data2(4, 0x04);
std::vector<uint8_t> data3(4, 0x05);
std::vector<uint8_t> combData{data};
#if __GNUC__ == 11
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wstringop-overread"
#endif // __GNUC__ == 11
combData.insert(combData.end(), data2.begin(), data2.end());
#if __GNUC__ == 11
#pragma GCC diagnostic pop
#endif // __GNUC__ == 11
combData.insert(combData.end(), data3.begin(), data3.end());

setupWebSocket = [&] {
Expand Down Expand Up @@ -481,7 +488,14 @@ TEST_F(WebSocketServerTest, ReceiveFragmentWithControl) {
std::vector<uint8_t> data3(4, 0x05);
std::vector<uint8_t> data4(4, 0x06);
std::vector<uint8_t> combData{data};
#if __GNUC__ == 11
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wstringop-overread"
#endif // __GNUC__ == 11
combData.insert(combData.end(), data2.begin(), data2.end());
#if __GNUC__ == 11
#pragma GCC diagnostic pop
#endif // __GNUC__ == 11
combData.insert(combData.end(), data4.begin(), data4.end());

setupWebSocket = [&] {
Expand Down

0 comments on commit a31ecbb

Please sign in to comment.