From 6241d42a2a18ee5bb07060a0a216a4eb333ef4a5 Mon Sep 17 00:00:00 2001 From: kang jinci Date: Fri, 16 Jun 2023 08:28:11 -0700 Subject: [PATCH] Modify port_def.inc to ignore -Wshadow warning (#13059) Closes #13037 Closes #13059 COPYBARA_INTEGRATE_REVIEW=https://github.com/protocolbuffers/protobuf/pull/13059 from 4kangjc:main 71b2fc5ada3abf1250c69568dddc23bfecd1427f PiperOrigin-RevId: 540886449 --- src/google/protobuf/port_def.inc | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/google/protobuf/port_def.inc b/src/google/protobuf/port_def.inc index 644bb87e0111..8ea7f8fe14d9 100644 --- a/src/google/protobuf/port_def.inc +++ b/src/google/protobuf/port_def.inc @@ -1010,6 +1010,10 @@ static_assert(PROTOBUF_ABSL_MIN(20230125, 3), // This error has been generally flaky, but we need to disable it specifically // to fix https://github.com/protocolbuffers/protobuf/issues/12313 #pragma clang diagnostic ignored "-Wunused-parameter" +// -Wshadow means that declaration shadows a variable. +// for (int i = 0; i < file_->public_dependency_count(); ++i) +// for (int i = 0; i < public_dep->message_type_count(); ++i) +#pragma clang diagnostic ignored "-Wshadow" #endif #ifdef __GNUC__ #pragma GCC diagnostic push @@ -1033,6 +1037,10 @@ static_assert(PROTOBUF_ABSL_MIN(20230125, 3), // This error has been generally flaky, but we need to disable it specifically // to fix https://github.com/protocolbuffers/protobuf/issues/12313 #pragma GCC diagnostic ignored "-Wunused-parameter" +// -Wshadow means that declaration shadows a variable. +// for (int i = 0; i < file_->public_dependency_count(); ++i) +// for (int i = 0; i < public_dep->message_type_count(); ++i) +#pragma GCC diagnostic ignored "-Wshadow" #ifndef __clang__ // This causes spurious warnings in GCC 13. #pragma GCC diagnostic ignored "-Wstringop-overflow"