mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-26 01:51:41 +00:00
[wpiutil] Suppress protobuf warning false positives on GCC 13 (#5907)
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Peter Johnson <johnson.peter@gmail.com>
|
||||
Date: Sat, 10 Jun 2023 14:13:07 -0700
|
||||
Subject: [PATCH 01/11] Fix sign-compare warnings
|
||||
Subject: [PATCH 01/12] Fix sign-compare warnings
|
||||
|
||||
---
|
||||
src/google/protobuf/compiler/importer.cc | 2 +-
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Peter Johnson <johnson.peter@gmail.com>
|
||||
Date: Sat, 10 Jun 2023 14:41:39 -0700
|
||||
Subject: [PATCH 02/11] Remove redundant move
|
||||
Subject: [PATCH 02/12] Remove redundant move
|
||||
|
||||
---
|
||||
src/google/protobuf/extension_set.h | 2 +-
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Peter Johnson <johnson.peter@gmail.com>
|
||||
Date: Sat, 10 Jun 2023 15:00:20 -0700
|
||||
Subject: [PATCH 03/11] Fix maybe-uninitialized warnings
|
||||
Subject: [PATCH 03/12] Fix maybe-uninitialized warnings
|
||||
|
||||
---
|
||||
src/google/protobuf/arena.cc | 6 +++---
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Peter Johnson <johnson.peter@gmail.com>
|
||||
Date: Sat, 10 Jun 2023 15:03:38 -0700
|
||||
Subject: [PATCH 04/11] Fix coded_stream WriteRaw
|
||||
Subject: [PATCH 04/12] Fix coded_stream WriteRaw
|
||||
|
||||
---
|
||||
src/google/protobuf/implicit_weak_message.h | 2 +-
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Peter Johnson <johnson.peter@gmail.com>
|
||||
Date: Sat, 10 Jun 2023 15:13:45 -0700
|
||||
Subject: [PATCH 05/11] Suppress enum-enum conversion warning
|
||||
Subject: [PATCH 05/12] Suppress enum-enum conversion warning
|
||||
|
||||
---
|
||||
src/google/protobuf/generated_message_tctable_impl.h | 9 +++++++++
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Peter Johnson <johnson.peter@gmail.com>
|
||||
Date: Sat, 10 Jun 2023 15:16:46 -0700
|
||||
Subject: [PATCH 06/11] Fix noreturn function returning
|
||||
Subject: [PATCH 06/12] Fix noreturn function returning
|
||||
|
||||
---
|
||||
src/google/protobuf/generated_message_tctable_impl.h | 3 +++
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Peter Johnson <johnson.peter@gmail.com>
|
||||
Date: Sat, 10 Jun 2023 15:59:45 -0700
|
||||
Subject: [PATCH 07/11] Work around GCC 12 restrict warning compiler bug
|
||||
Subject: [PATCH 07/12] Work around GCC 12 restrict warning compiler bug
|
||||
|
||||
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105329
|
||||
---
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Peter Johnson <johnson.peter@gmail.com>
|
||||
Date: Tue, 13 Jun 2023 23:56:15 -0700
|
||||
Subject: [PATCH 08/11] Disable MSVC switch warning
|
||||
Subject: [PATCH 08/12] Disable MSVC switch warning
|
||||
|
||||
---
|
||||
src/google/protobuf/generated_message_reflection.cc | 4 ++++
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Peter Johnson <johnson.peter@gmail.com>
|
||||
Date: Tue, 13 Jun 2023 23:58:50 -0700
|
||||
Subject: [PATCH 09/11] Disable unused function warning
|
||||
Subject: [PATCH 09/12] Disable unused function warning
|
||||
|
||||
---
|
||||
src/google/protobuf/generated_message_tctable_lite.cc | 4 ++++
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Peter Johnson <johnson.peter@gmail.com>
|
||||
Date: Wed, 14 Jun 2023 00:02:26 -0700
|
||||
Subject: [PATCH 10/11] Disable pedantic warning
|
||||
Subject: [PATCH 10/12] Disable pedantic warning
|
||||
|
||||
---
|
||||
src/google/protobuf/descriptor.h | 8 ++++++++
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Peter Johnson <johnson.peter@gmail.com>
|
||||
Date: Mon, 9 Oct 2023 19:28:08 -0700
|
||||
Subject: [PATCH 11/11] Avoid use of sprintf
|
||||
Subject: [PATCH 11/12] Avoid use of sprintf
|
||||
|
||||
---
|
||||
src/google/protobuf/stubs/strutil.cc | 14 +++++++++++---
|
||||
1 file changed, 11 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/src/google/protobuf/stubs/strutil.cc b/src/google/protobuf/stubs/strutil.cc
|
||||
index 3462e91ff273dc071628f06b91698a0f166514fc..e063d0d3039c87d55a6df0dbfe50f365184fe292 100644
|
||||
index 3462e91ff273dc071628f06b91698a0f166514fc..58e03d0c4aa7c1b0337b5f650283f00117c12baa 100644
|
||||
--- a/src/google/protobuf/stubs/strutil.cc
|
||||
+++ b/src/google/protobuf/stubs/strutil.cc
|
||||
@@ -503,10 +503,18 @@ int CEscapeInternal(const char* src, int src_len, char* dest,
|
||||
|
||||
@@ -0,0 +1,50 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Tyler Veness <calcmogul@gmail.com>
|
||||
Date: Fri, 10 Nov 2023 14:17:53 -0800
|
||||
Subject: [PATCH 12/12] Suppress stringop-overflow warning false positives
|
||||
|
||||
---
|
||||
src/google/protobuf/io/coded_stream.h | 7 +++++++
|
||||
src/google/protobuf/unknown_field_set.cc | 7 +++++++
|
||||
2 files changed, 14 insertions(+)
|
||||
|
||||
diff --git a/src/google/protobuf/io/coded_stream.h b/src/google/protobuf/io/coded_stream.h
|
||||
index 6c0dd4ab4099d1d748957af8bfc5f8c59c2aa3d6..a102cec8ea0b56926f63cf9ece205c634cb6d528 100644
|
||||
--- a/src/google/protobuf/io/coded_stream.h
|
||||
+++ b/src/google/protobuf/io/coded_stream.h
|
||||
@@ -681,7 +681,14 @@ class PROTOBUF_EXPORT EpsCopyOutputStream {
|
||||
if (PROTOBUF_PREDICT_FALSE(end_ - ptr < static_cast<int>(size))) {
|
||||
return WriteRawFallback(data, size, ptr);
|
||||
}
|
||||
+#if __GNUC__ >= 13
|
||||
+#pragma GCC diagnostic push
|
||||
+#pragma GCC diagnostic ignored "-Wstringop-overflow="
|
||||
+#endif // __GNUC__ >= 13
|
||||
std::memcpy(ptr, data, size);
|
||||
+#if __GNUC__ >= 13
|
||||
+#pragma GCC diagnostic pop
|
||||
+#endif // __GNUC__ >= 13
|
||||
return ptr + size;
|
||||
}
|
||||
// Writes the buffer specified by data, size to the stream. Possibly by
|
||||
diff --git a/src/google/protobuf/unknown_field_set.cc b/src/google/protobuf/unknown_field_set.cc
|
||||
index 74c358e9a22c5475bfaef6c5ac63b05fc61b7074..c0587350b309839f3b8b99506d0417a9fd91b06d 100644
|
||||
--- a/src/google/protobuf/unknown_field_set.cc
|
||||
+++ b/src/google/protobuf/unknown_field_set.cc
|
||||
@@ -96,9 +96,16 @@ void UnknownFieldSet::MergeFromAndDestroy(UnknownFieldSet* other) {
|
||||
if (fields_.empty()) {
|
||||
fields_ = std::move(other->fields_);
|
||||
} else {
|
||||
+#if __GNUC__ >= 13
|
||||
+#pragma GCC diagnostic push
|
||||
+#pragma GCC diagnostic ignored "-Wstringop-overflow="
|
||||
+#endif // __GNUC__ >= 13
|
||||
fields_.insert(fields_.end(),
|
||||
std::make_move_iterator(other->fields_.begin()),
|
||||
std::make_move_iterator(other->fields_.end()));
|
||||
+#if __GNUC__ >= 13
|
||||
+#pragma GCC diagnostic pop
|
||||
+#endif // __GNUC__ >= 13
|
||||
}
|
||||
other->fields_.clear();
|
||||
}
|
||||
@@ -276,6 +276,7 @@ def main():
|
||||
"0009-Disable-unused-function-warning.patch",
|
||||
"0010-Disable-pedantic-warning.patch",
|
||||
"0011-Avoid-use-of-sprintf.patch",
|
||||
"0012-Suppress-stringop-overflow-warning-false-positives.patch",
|
||||
]:
|
||||
git_am(os.path.join(wpilib_root, "upstream_utils/protobuf_patches", f))
|
||||
|
||||
|
||||
@@ -681,7 +681,14 @@ class PROTOBUF_EXPORT EpsCopyOutputStream {
|
||||
if (PROTOBUF_PREDICT_FALSE(end_ - ptr < static_cast<int>(size))) {
|
||||
return WriteRawFallback(data, size, ptr);
|
||||
}
|
||||
#if __GNUC__ >= 13
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wstringop-overflow="
|
||||
#endif // __GNUC__ >= 13
|
||||
std::memcpy(ptr, data, size);
|
||||
#if __GNUC__ >= 13
|
||||
#pragma GCC diagnostic pop
|
||||
#endif // __GNUC__ >= 13
|
||||
return ptr + size;
|
||||
}
|
||||
// Writes the buffer specified by data, size to the stream. Possibly by
|
||||
|
||||
@@ -96,9 +96,16 @@ void UnknownFieldSet::MergeFromAndDestroy(UnknownFieldSet* other) {
|
||||
if (fields_.empty()) {
|
||||
fields_ = std::move(other->fields_);
|
||||
} else {
|
||||
#if __GNUC__ >= 13
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wstringop-overflow="
|
||||
#endif // __GNUC__ >= 13
|
||||
fields_.insert(fields_.end(),
|
||||
std::make_move_iterator(other->fields_.begin()),
|
||||
std::make_move_iterator(other->fields_.end()));
|
||||
#if __GNUC__ >= 13
|
||||
#pragma GCC diagnostic pop
|
||||
#endif // __GNUC__ >= 13
|
||||
}
|
||||
other->fields_.clear();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user