Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

common: fix -Wrange-loop-analysis error on Envoy Mobile #13342

Merged
merged 1 commit into from
Oct 1, 2020

Conversation

rebello95
Copy link
Contributor

@rebello95 rebello95 commented Sep 30, 2020

Envoy Mobile is failing compilation with this error:

external/envoy/source/common/http/header_map_impl.cc:506:23: error: loop variable 'values_it' of type 'const std::__1::__list_iterator<Envoy::Http::HeaderMapImpl::HeaderEntryImpl, void *>' creates a copy from type 'const std::__1::__list_iterator<Envoy::Http::HeaderMapImpl::HeaderEntryImpl, void *>' [-Werror,-Wrange-loop-analysis]
      for (const auto values_it : v) {
                      ^
external/envoy/source/common/http/header_map_impl.cc:506:12: note: use reference type 'const std::__1::__list_iterator<Envoy::Http::HeaderMapImpl::HeaderEntryImpl, void *> &' to prevent copying
      for (const auto values_it : v) {
           ^~~~~~~~~~~~~~~~~~~~~~
                      &

This regression was introduced in 442b3f1.

We're tracking enabling this rule on Envoy builds in #13154, but it's currently blocked.

Risk Level: Low
Testing: N/A
Docs Changes: N/A

Signed-off-by: Michael Rebello [email protected]

Envoy Mobile is failing compilation with this error:

```
external/envoy/source/common/http/header_map_impl.cc:506:23: error: loop variable 'values_it' of type 'const std::__1::__list_iterator<Envoy::Http::HeaderMapImpl::HeaderEntryImpl, void *>' creates a copy from type 'const std::__1::__list_iterator<Envoy::Http::HeaderMapImpl::HeaderEntryImpl, void *>' [-Werror,-Wrange-loop-analysis]
      for (const auto values_it : v) {
                      ^
external/envoy/source/common/http/header_map_impl.cc:506:12: note: use reference type 'const std::__1::__list_iterator<Envoy::Http::HeaderMapImpl::HeaderEntryImpl, void *> &' to prevent copying
      for (const auto values_it : v) {
           ^~~~~~~~~~~~~~~~~~~~~~
                      &
```

This regression was introduced in envoyproxy@442b3f1.

Signed-off-by: Michael Rebello <[email protected]>
@mattklein123 mattklein123 self-assigned this Oct 1, 2020
@mattklein123 mattklein123 merged commit b244b1b into envoyproxy:master Oct 1, 2020
@rebello95 rebello95 deleted the fix-envoy-mobile branch January 6, 2021 20:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants