From 0e15eb94b50a6070ff1c7d89ddf2fb2fdf12633d Mon Sep 17 00:00:00 2001 From: Michael Rebello Date: Fri, 18 Sep 2020 15:32:50 -0700 Subject: [PATCH 1/3] build: enable -Wrange-loop-analysis rule Xcode 12 builds with this enabled, so adding this to Envoy will ensure compatibility and prevent breakages in Envoy Mobile's iOS build. Resolves https://github.com/envoyproxy/envoy/pull/13140. Signed-off-by: Michael Rebello --- bazel/envoy_internal.bzl | 1 + source/extensions/filters/http/common/compressor/compressor.cc | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/bazel/envoy_internal.bzl b/bazel/envoy_internal.bzl index 10b3448c00eea..24642c945f389 100644 --- a/bazel/envoy_internal.bzl +++ b/bazel/envoy_internal.bzl @@ -13,6 +13,7 @@ def envoy_copts(repository, test = False): "-Wold-style-cast", "-Wformat", "-Wformat-security", + "-Wrange-loop-analysis", "-Wvla", ] diff --git a/source/extensions/filters/http/common/compressor/compressor.cc b/source/extensions/filters/http/common/compressor/compressor.cc index 4e0a1b48ce9be..e8e6042951982 100644 --- a/source/extensions/filters/http/common/compressor/compressor.cc +++ b/source/extensions/filters/http/common/compressor/compressor.cc @@ -224,7 +224,7 @@ CompressorFilter::chooseEncoding(const Http::ResponseHeaderMap& headers) const { } // Find all encodings accepted by the user agent and adjust the list of allowed compressors. - for (const auto token : StringUtil::splitToken(*accept_encoding_, ",", false /* keep_empty */)) { + for (const auto& token : StringUtil::splitToken(*accept_encoding_, ",", false /* keep_empty */)) { EncPair pair = std::make_pair(StringUtil::trim(StringUtil::cropRight(token, ";")), static_cast(1)); const auto params = StringUtil::cropLeft(token, ";"); From a6bf854ecb99890bb376fb3ed46a6402cb46554d Mon Sep 17 00:00:00 2001 From: Michael Rebello Date: Mon, 21 Sep 2020 10:00:40 -0700 Subject: [PATCH 2/3] violation Signed-off-by: Michael Rebello --- test/tools/router_check/coverage.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/tools/router_check/coverage.cc b/test/tools/router_check/coverage.cc index f079f0319fd72..6b23e93453bf9 100644 --- a/test/tools/router_check/coverage.cc +++ b/test/tools/router_check/coverage.cc @@ -5,7 +5,7 @@ namespace Envoy { double RouteCoverage::report() { uint64_t route_weight = 0; - for (const auto& covered_field : coverageFields()) { + for (const auto&& covered_field : coverageFields()) { if (covered_field) { route_weight += 1; } From ddb288ae9b1b7eb7ea10c6383cd6287aa12b6ede Mon Sep 17 00:00:00 2001 From: Michael Rebello Date: Mon, 21 Sep 2020 14:11:10 -0700 Subject: [PATCH 3/3] fixup Signed-off-by: Michael Rebello --- .../retry/priority/previous_priorities/previous_priorities.cc | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/source/extensions/retry/priority/previous_priorities/previous_priorities.cc b/source/extensions/retry/priority/previous_priorities/previous_priorities.cc index 96dc7c540b25f..5318eb1f13472 100644 --- a/source/extensions/retry/priority/previous_priorities/previous_priorities.cc +++ b/source/extensions/retry/priority/previous_priorities/previous_priorities.cc @@ -51,9 +51,7 @@ bool PreviousPrioritiesRetryPriority::adjustForAttemptedPriorities( // This allows us to fall back to the unmodified priority load when we run out of priorities // instead of failing to route requests. if (total_availability == 0) { - for (auto&& excluded_priority : excluded_priorities_) { - excluded_priority = false; - } + std::fill(excluded_priorities_.begin(), excluded_priorities_.end(), false); attempted_hosts_.clear(); total_availability = adjustedAvailability(adjusted_per_priority_health, adjusted_per_priority_degraded);