Commit 3ccc950c by Abseil Team Committed by Copybara-Service

Add a pragma to disable a stringop-overflow warning for GCC12+

PiperOrigin-RevId: 591894838
Change-Id: Ib3fe72d255f49320e2728c210ba1faabc81e0ef8
parent 27478af3
......@@ -101,8 +101,16 @@ inline void SmallMemmove(char* dst, const char* src, size_t n) {
if (nullify_tail) {
memset(dst + 7, 0, 8);
}
// GCC 12 has a false-positive -Wstringop-overflow warning here.
#if ABSL_INTERNAL_HAVE_MIN_GNUC_VERSION(12, 0)
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wstringop-overflow"
#endif
memcpy(dst, &buf1, 8);
memcpy(dst + n - 8, &buf2, 8);
#if ABSL_INTERNAL_HAVE_MIN_GNUC_VERSION(12, 0)
#pragma GCC diagnostic pop
#endif
} else if (n >= 4) {
uint32_t buf1;
uint32_t buf2;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment