summaryrefslogtreecommitdiff
path: root/absl
diff options
context:
space:
mode:
authorGravatar Abseil Team <absl-team@google.com>2023-12-18 07:46:50 -0800
committerGravatar Copybara-Service <copybara-worker@google.com>2023-12-18 07:47:48 -0800
commit3ccc950c7902694ff9030b735e6decc87b16bcdd (patch)
tree7fe9863833d89687429081d1ea90531a0d4e4ff4 /absl
parent27478af36914f18867ea32cb42db00dba15fffcd (diff)
Add a pragma to disable a stringop-overflow warning for GCC12+
PiperOrigin-RevId: 591894838 Change-Id: Ib3fe72d255f49320e2728c210ba1faabc81e0ef8
Diffstat (limited to 'absl')
-rw-r--r--absl/strings/internal/cord_internal.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/absl/strings/internal/cord_internal.h b/absl/strings/internal/cord_internal.h
index a487fd59..8744540e 100644
--- a/absl/strings/internal/cord_internal.h
+++ b/absl/strings/internal/cord_internal.h
@@ -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;