diff options
author | Brad King <brad.king@kitware.com> | 2019-01-23 18:17:22 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2019-01-23 18:17:22 (GMT) |
commit | 68eabb357616f7ef469b20dd8d9cb8ce588e113d (patch) | |
tree | 809ee6f6815416a9d6fda918f6b71a298f19a056 /Source/cmState.cxx | |
parent | a7f5cd45e135dd51d67176fc40e2d769ac5f7db8 (diff) | |
download | CMake-68eabb357616f7ef469b20dd8d9cb8ce588e113d.zip CMake-68eabb357616f7ef469b20dd8d9cb8ce588e113d.tar.gz CMake-68eabb357616f7ef469b20dd8d9cb8ce588e113d.tar.bz2 |
Avoid -Wstring-plus-int warning
In `cmState::GetGlobalProperty` we use a macro to produce a string of
the form ";a;b;c" and want to return "a;b;c" by skipping the leading
";". Switch from pointer arithmetic to indexing+addressing to silence
the "warning: adding 'int' to a string does not append to the string"
diagnostic from Clang.
Diffstat (limited to 'Source/cmState.cxx')
-rw-r--r-- | Source/cmState.cxx | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/Source/cmState.cxx b/Source/cmState.cxx index d4d3df5..fdd7b3d 100644 --- a/Source/cmState.cxx +++ b/Source/cmState.cxx @@ -545,10 +545,10 @@ const char* cmState::GetGlobalProperty(const std::string& prop) } #define STRING_LIST_ELEMENT(F) ";" #F if (prop == "CMAKE_C_KNOWN_FEATURES") { - return FOR_EACH_C_FEATURE(STRING_LIST_ELEMENT) + 1; + return &FOR_EACH_C_FEATURE(STRING_LIST_ELEMENT)[1]; } if (prop == "CMAKE_CXX_KNOWN_FEATURES") { - return FOR_EACH_CXX_FEATURE(STRING_LIST_ELEMENT) + 1; + return &FOR_EACH_CXX_FEATURE(STRING_LIST_ELEMENT)[1]; } #undef STRING_LIST_ELEMENT return this->GlobalProperties.GetPropertyValue(prop); |