diff options
author | Ben Boeckel <ben.boeckel@kitware.com> | 2022-05-17 17:10:30 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2022-05-24 13:09:43 (GMT) |
commit | 6ff03d463f40176389943100690cf1ca8593d739 (patch) | |
tree | 09ad876ecf9d635108df5374f8c0f5ebb4400506 /Source/cmListCommand.cxx | |
parent | 9409e5c04f0a534b53ce2f0e0a81c5e7e70c38f1 (diff) | |
download | CMake-6ff03d463f40176389943100690cf1ca8593d739.zip CMake-6ff03d463f40176389943100690cf1ca8593d739.tar.gz CMake-6ff03d463f40176389943100690cf1ca8593d739.tar.bz2 |
clang-tidy: address `google-readability-casting` lints
At least those involving `static_cast`.
Diffstat (limited to 'Source/cmListCommand.cxx')
-rw-r--r-- | Source/cmListCommand.cxx | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/Source/cmListCommand.cxx b/Source/cmListCommand.cxx index 56345df..ebd089b 100644 --- a/Source/cmListCommand.cxx +++ b/Source/cmListCommand.cxx @@ -229,7 +229,7 @@ bool HandleAppendCommand(std::vector<std::string> const& args, // If `listString` or `args` is empty, no need to append `;`, // then index is going to be `1` and points to the end-of-string ";" auto const offset = - std::string::size_type(listString.empty() || args.empty()); + static_cast<std::string::size_type>(listString.empty() || args.empty()); listString += &";"[offset] + cmJoin(cmMakeRange(args).advance(2), ";"); makefile.AddDefinition(listName, listString); @@ -255,7 +255,7 @@ bool HandlePrependCommand(std::vector<std::string> const& args, // If `listString` or `args` is empty, no need to append `;`, // then `offset` is going to be `1` and points to the end-of-string ";" auto const offset = - std::string::size_type(listString.empty() || args.empty()); + static_cast<std::string::size_type>(listString.empty() || args.empty()); listString.insert(0, cmJoin(cmMakeRange(args).advance(2), ";") + &";"[offset]); @@ -1346,7 +1346,7 @@ bool HandleSublistCommand(std::vector<std::string> const& args, using size_type = decltype(varArgsExpanded)::size_type; - if (start < 0 || size_type(start) >= varArgsExpanded.size()) { + if (start < 0 || static_cast<size_type>(start) >= varArgsExpanded.size()) { status.SetError(cmStrCat("begin index: ", start, " is out of range 0 - ", varArgsExpanded.size() - 1)); return false; @@ -1357,9 +1357,10 @@ bool HandleSublistCommand(std::vector<std::string> const& args, } const size_type end = - (length == -1 || size_type(start + length) > varArgsExpanded.size()) + (length == -1 || + static_cast<size_type>(start + length) > varArgsExpanded.size()) ? varArgsExpanded.size() - : size_type(start + length); + : static_cast<size_type>(start + length); std::vector<std::string> sublist(varArgsExpanded.begin() + start, varArgsExpanded.begin() + end); status.GetMakefile().AddDefinition(variableName, cmJoin(sublist, ";")); |