[wpiutil] Suppress protobuf warning false positives on GCC 13 (#5907)

This commit is contained in:
Tyler Veness
2023-11-10 15:12:18 -08:00
committed by GitHub
parent d504639bbe
commit fa6b171e1c
15 changed files with 77 additions and 12 deletions

View File

@@ -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

View File

@@ -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();
}