mirror of
https://github.com/Kitware/CMake.git
synced 2026-05-06 14:19:59 -05:00
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:
+2
-2
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user