From ede55fec7dff9159520c088286ca2e1bd8207ecf Mon Sep 17 00:00:00 2001 From: Protobuf Team Bot Date: Tue, 27 Aug 2024 07:59:07 -0700 Subject: [PATCH] Fix `final_is_soo` being accidentally declared as int not bool. This check did behave correctly but causes warnings about comparing int and bool. PiperOrigin-RevId: 667987307 --- src/google/protobuf/repeated_field.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/google/protobuf/repeated_field.h b/src/google/protobuf/repeated_field.h index beed1f20d1..3f8065be79 100644 --- a/src/google/protobuf/repeated_field.h +++ b/src/google/protobuf/repeated_field.h @@ -858,7 +858,7 @@ inline void RepeatedField::Add(Element value) { // The below helps the compiler optimize dense loops. // Note: we can't call functions in PROTOBUF_ASSUME so use local variables. - ABSL_ATTRIBUTE_UNUSED const int final_is_soo = this->is_soo(); + ABSL_ATTRIBUTE_UNUSED const bool final_is_soo = this->is_soo(); PROTOBUF_ASSUME(is_soo == final_is_soo); ABSL_ATTRIBUTE_UNUSED const int final_size = size(is_soo); PROTOBUF_ASSUME(new_size == final_size); @@ -898,7 +898,7 @@ inline void RepeatedField::AddForwardIterator(Iter begin, Iter end) { // The below helps the compiler optimize dense loops. // Note: we can't call functions in PROTOBUF_ASSUME so use local variables. - ABSL_ATTRIBUTE_UNUSED const int final_is_soo = this->is_soo(); + ABSL_ATTRIBUTE_UNUSED const bool final_is_soo = this->is_soo(); PROTOBUF_ASSUME(is_soo == final_is_soo); ABSL_ATTRIBUTE_UNUSED const int final_size = size(is_soo); PROTOBUF_ASSUME(new_size == final_size);