Hello Alexey Serbin, Kudu Jenkins,

I'd like you to reexamine a change. Please visit

    http://gerrit.cloudera.org:8080/23057

to look at the new patch set (#3).

Change subject: [compile] Fix compiler warnings about -Wrange-loop-construct
......................................................................

[compile] Fix compiler warnings about -Wrange-loop-construct

This commit resolves multiple instances of the
`-Wrange-loop-construct` warning across various tests.
These warnings occur when using `const std::string&` as
a loop variable to iterate over a brace-enclosed initializer
list of string literals (`const char*`).
In such cases, temporary `std::string` objects are created
implicitly, even when using a reference as the loop variable,
and triggers compiler warnings.

The warnings were of the form:

    warning: loop variable '...' of type 'const string&' binds
    to a temporary constructed from type 'const char* const'
    [-Wrange-loop-construct]

To address this:

- Updated affected loops to use `std::string_view` instead
  of `const std::string&` or `const char*`, eliminating
  unnecessary string copies  while retaining compatibility
  with string operations like `.empty()` and `operator==`.
- In cases where `std::string` was still needed, an explicit
  conversion is done inside the loop body.
- Added a `std::string_view` constructor to `SubstituteArg`
  to support usage of `std::string_view` with the `Substitute()`
  utility.

This change eliminates warnings while maintaining safe and
readable code, and avoids unnecessary string copies when not
needed.

Change-Id: I32a9a043e7aade2c2c879472c13cbf2641daa7f3
---
M src/kudu/consensus/quorum_util-test.cc
M src/kudu/gutil/strings/substitute.h
M src/kudu/tools/kudu-tool-test.cc
M src/kudu/tserver/tablet_server-test.cc
4 files changed, 16 insertions(+), 8 deletions(-)


  git pull ssh://gerrit.cloudera.org:29418/kudu refs/changes/57/23057/3
--
To view, visit http://gerrit.cloudera.org:8080/23057
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-Project: kudu
Gerrit-Branch: master
Gerrit-MessageType: newpatchset
Gerrit-Change-Id: I32a9a043e7aade2c2c879472c13cbf2641daa7f3
Gerrit-Change-Number: 23057
Gerrit-PatchSet: 3
Gerrit-Owner: KeDeng <[email protected]>
Gerrit-Reviewer: Alexey Serbin <[email protected]>
Gerrit-Reviewer: KeDeng <[email protected]>
Gerrit-Reviewer: Kudu Jenkins (120)

Reply via email to