From e67f35888557f4a78341ed373a96a4c4352da9a0 Mon Sep 17 00:00:00 2001 From: Zoey Greer Date: Mon, 9 Sep 2024 19:40:23 -0400 Subject: [PATCH] fix unknown pragma warning when building with non-clang --- src/google/protobuf/wire_format_lite.cc | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/google/protobuf/wire_format_lite.cc b/src/google/protobuf/wire_format_lite.cc index 6a9caa9041..4dd5fb5ba3 100644 --- a/src/google/protobuf/wire_format_lite.cc +++ b/src/google/protobuf/wire_format_lite.cc @@ -665,9 +665,11 @@ static size_t VarintSize(const T* data, const int n) { if (x > 0x1FFFFF) sum++; if (x > 0xFFFFFFF) sum++; } +#ifdef __clang__ // Clang is not smart enough to see that this loop doesn't run many times // NOLINTNEXTLINE(google3-runtime-pragma-loop-hint): b/315043579 #pragma clang loop vectorize(disable) unroll(disable) interleave(disable) +#endif for (; i < n; i++) { uint32_t x = data[i]; if (ZigZag) { @@ -707,9 +709,11 @@ static size_t VarintSize64(const T* data, const int n) { if (x > 0x1FFFFF) sum++; if (x > 0xFFFFFFF) sum++; } +#ifdef __clang__ // Clang is not smart enough to see that this loop doesn't run many times // NOLINTNEXTLINE(google3-runtime-pragma-loop-hint): b/315043579 #pragma clang loop vectorize(disable) unroll(disable) interleave(disable) +#endif for (; i < n; i++) { uint64_t x = data[i]; if (ZigZag) {