summaryrefslogtreecommitdiffstats
path: root/Source/cmGeneratorExpressionEvaluator.cxx
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2013-10-23 12:19:52 (GMT)
committerCMake Topic Stage <kwrobot@kitware.com>2013-10-23 12:19:52 (GMT)
commit078530b4481e0f311e9180bf02cded228809076d (patch)
treee9ae569d4191a9256553a9f4d6f29ef1a27ddfa1 /Source/cmGeneratorExpressionEvaluator.cxx
parent6403a53f0e865337c5644a36c795a15a7d293b11 (diff)
parentd169b1f0372e8d6d44406d308381941513f0349a (diff)
downloadCMake-078530b4481e0f311e9180bf02cded228809076d.zip
CMake-078530b4481e0f311e9180bf02cded228809076d.tar.gz
CMake-078530b4481e0f311e9180bf02cded228809076d.tar.bz2
Merge topic 'cmarray-templates'
d169b1f Genex: Use cmArraySize for targetPolicyWhitelist 86d5d80 Genex: Remove use of TransitiveWhitelistCompare 73d7705 Add some templates for cleaner array iteration.
Diffstat (limited to 'Source/cmGeneratorExpressionEvaluator.cxx')
-rw-r--r--Source/cmGeneratorExpressionEvaluator.cxx35
1 files changed, 10 insertions, 25 deletions
diff --git a/Source/cmGeneratorExpressionEvaluator.cxx b/Source/cmGeneratorExpressionEvaluator.cxx
index dfd995e..33863f4 100644
--- a/Source/cmGeneratorExpressionEvaluator.cxx
+++ b/Source/cmGeneratorExpressionEvaluator.cxx
@@ -704,17 +704,6 @@ std::string getLinkedTargetsContent(const std::vector<std::string> &libraries,
}
//----------------------------------------------------------------------------
-struct TransitiveWhitelistCompare
-{
- explicit TransitiveWhitelistCompare(const std::string &needle)
- : Needle(needle) {}
- bool operator() (const char *item)
- { return strcmp(item, this->Needle.c_str()) == 0; }
-private:
- std::string Needle;
-};
-
-//----------------------------------------------------------------------------
static const struct TargetPropertyNode : public cmGeneratorExpressionNode
{
TargetPropertyNode() {}
@@ -864,8 +853,7 @@ static const struct TargetPropertyNode : public cmGeneratorExpressionNode
return std::string();
case cmGeneratorExpressionDAGChecker::ALREADY_SEEN:
for (size_t i = 1;
- i < (sizeof(targetPropertyTransitiveWhitelist) /
- sizeof(*targetPropertyTransitiveWhitelist));
+ i < cmArraySize(targetPropertyTransitiveWhitelist);
++i)
{
if (targetPropertyTransitiveWhitelist[i] == propertyName)
@@ -928,12 +916,13 @@ static const struct TargetPropertyNode : public cmGeneratorExpressionNode
cmTarget *headTarget = context->HeadTarget ? context->HeadTarget : target;
- const char **transBegin = targetPropertyTransitiveWhitelist + 1;
- const char **transEnd = targetPropertyTransitiveWhitelist
- + (sizeof(targetPropertyTransitiveWhitelist) /
- sizeof(*targetPropertyTransitiveWhitelist));
+ const char * const *transBegin =
+ cmArrayBegin(targetPropertyTransitiveWhitelist) + 1;
+ const char * const *transEnd =
+ cmArrayEnd(targetPropertyTransitiveWhitelist);
+
if (std::find_if(transBegin, transEnd,
- TransitiveWhitelistCompare(propertyName)) != transEnd)
+ cmStrCmp(propertyName)) != transEnd)
{
std::vector<std::string> libs;
@@ -949,7 +938,7 @@ static const struct TargetPropertyNode : public cmGeneratorExpressionNode
}
}
else if (std::find_if(transBegin, transEnd,
- TransitiveWhitelistCompare(interfacePropertyName)) != transEnd)
+ cmStrCmp(interfacePropertyName)) != transEnd)
{
const cmTarget::LinkImplementation *impl = target->GetLinkImplementation(
context->Config,
@@ -996,8 +985,7 @@ static const struct TargetPropertyNode : public cmGeneratorExpressionNode
}
for (size_t i = 1;
- i < (sizeof(targetPropertyTransitiveWhitelist) /
- sizeof(*targetPropertyTransitiveWhitelist));
+ i < cmArraySize(targetPropertyTransitiveWhitelist);
++i)
{
if (targetPropertyTransitiveWhitelist[i] == interfacePropertyName)
@@ -1113,10 +1101,7 @@ static const struct TargetPolicyNode : public cmGeneratorExpressionNode
context->HadContextSensitiveCondition = true;
- for (size_t i = 1;
- i < (sizeof(targetPolicyWhitelist) /
- sizeof(*targetPolicyWhitelist));
- ++i)
+ for (size_t i = 1; i < cmArraySize(targetPolicyWhitelist); ++i)
{
const char *policy = targetPolicyWhitelist[i];
if (parameters.front() == policy)