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.
This commit is contained in:
Brad King
2019-01-23 13:17:22 -05:00
parent a7f5cd45e1
commit 68eabb3576
+2 -2
View File
@@ -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);