cmGeneratorTarget: Make CompatibleType enum private again.

This commit is contained in:
Stephen Kelly 2015-08-04 19:19:43 +02:00
parent 5ff813c7a6
commit 4b86f5edc9
2 changed files with 44 additions and 44 deletions

View File

@ -1524,18 +1524,26 @@ bool cmGeneratorTarget::IsLinkInterfaceDependentNumberMaxProperty(
return this->GetCompatibleInterfaces(config).PropsNumberMax.count(p) > 0; return this->GetCompatibleInterfaces(config).PropsNumberMax.count(p) > 0;
} }
enum CompatibleType
{
BoolType,
StringType,
NumberMinType,
NumberMaxType
};
template<typename PropertyType> template<typename PropertyType>
PropertyType getLinkInterfaceDependentProperty(cmGeneratorTarget const* tgt, PropertyType getLinkInterfaceDependentProperty(cmGeneratorTarget const* tgt,
const std::string& prop, const std::string& prop,
const std::string& config, const std::string& config,
cmTarget::CompatibleType, CompatibleType,
PropertyType *); PropertyType *);
template<> template<>
bool getLinkInterfaceDependentProperty(cmGeneratorTarget const* tgt, bool getLinkInterfaceDependentProperty(cmGeneratorTarget const* tgt,
const std::string& prop, const std::string& prop,
const std::string& config, const std::string& config,
cmTarget::CompatibleType, bool *) CompatibleType, bool *)
{ {
return tgt->GetLinkInterfaceDependentBoolProperty(prop, config); return tgt->GetLinkInterfaceDependentBoolProperty(prop, config);
} }
@ -1544,19 +1552,19 @@ template<>
const char * getLinkInterfaceDependentProperty(cmGeneratorTarget const* tgt, const char * getLinkInterfaceDependentProperty(cmGeneratorTarget const* tgt,
const std::string& prop, const std::string& prop,
const std::string& config, const std::string& config,
cmTarget::CompatibleType t, CompatibleType t,
const char **) const char **)
{ {
switch(t) switch(t)
{ {
case cmTarget::BoolType: case BoolType:
assert(0 && "String compatibility check function called for boolean"); assert(0 && "String compatibility check function called for boolean");
return 0; return 0;
case cmTarget::StringType: case StringType:
return tgt->GetLinkInterfaceDependentStringProperty(prop, config); return tgt->GetLinkInterfaceDependentStringProperty(prop, config);
case cmTarget::NumberMinType: case NumberMinType:
return tgt->GetLinkInterfaceDependentNumberMinProperty(prop, config); return tgt->GetLinkInterfaceDependentNumberMinProperty(prop, config);
case cmTarget::NumberMaxType: case NumberMaxType:
return tgt->GetLinkInterfaceDependentNumberMaxProperty(prop, config); return tgt->GetLinkInterfaceDependentNumberMaxProperty(prop, config);
} }
assert(0 && "Unreachable!"); assert(0 && "Unreachable!");
@ -1570,7 +1578,7 @@ void checkPropertyConsistency(cmGeneratorTarget const* depender,
const std::string& propName, const std::string& propName,
std::set<std::string> &emitted, std::set<std::string> &emitted,
const std::string& config, const std::string& config,
cmTarget::CompatibleType t, CompatibleType t,
PropertyType *) PropertyType *)
{ {
const char *prop = dependee->GetProperty(propName); const char *prop = dependee->GetProperty(propName);
@ -1683,7 +1691,7 @@ void cmGeneratorTarget::CheckPropertyCompatibility(
checkPropertyConsistency<bool>(this, li->Target, checkPropertyConsistency<bool>(this, li->Target,
strBool, strBool,
emittedBools, config, cmTarget::BoolType, 0); emittedBools, config, BoolType, 0);
if (cmSystemTools::GetErrorOccuredFlag()) if (cmSystemTools::GetErrorOccuredFlag())
{ {
return; return;
@ -1691,7 +1699,7 @@ void cmGeneratorTarget::CheckPropertyCompatibility(
checkPropertyConsistency<const char *>(this, li->Target, checkPropertyConsistency<const char *>(this, li->Target,
strString, strString,
emittedStrings, config, emittedStrings, config,
cmTarget::StringType, 0); StringType, 0);
if (cmSystemTools::GetErrorOccuredFlag()) if (cmSystemTools::GetErrorOccuredFlag())
{ {
return; return;
@ -1699,7 +1707,7 @@ void cmGeneratorTarget::CheckPropertyCompatibility(
checkPropertyConsistency<const char *>(this, li->Target, checkPropertyConsistency<const char *>(this, li->Target,
strNumMin, strNumMin,
emittedMinNumbers, config, emittedMinNumbers, config,
cmTarget::NumberMinType, 0); NumberMinType, 0);
if (cmSystemTools::GetErrorOccuredFlag()) if (cmSystemTools::GetErrorOccuredFlag())
{ {
return; return;
@ -1707,7 +1715,7 @@ void cmGeneratorTarget::CheckPropertyCompatibility(
checkPropertyConsistency<const char *>(this, li->Target, checkPropertyConsistency<const char *>(this, li->Target,
strNumMax, strNumMax,
emittedMaxNumbers, config, emittedMaxNumbers, config,
cmTarget::NumberMaxType, 0); NumberMaxType, 0);
if (cmSystemTools::GetErrorOccuredFlag()) if (cmSystemTools::GetErrorOccuredFlag())
{ {
return; return;
@ -1760,17 +1768,17 @@ void cmGeneratorTarget::CheckPropertyCompatibility(
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
std::string compatibilityType(cmTarget::CompatibleType t) std::string compatibilityType(CompatibleType t)
{ {
switch(t) switch(t)
{ {
case cmTarget::BoolType: case BoolType:
return "Boolean compatibility"; return "Boolean compatibility";
case cmTarget::StringType: case StringType:
return "String compatibility"; return "String compatibility";
case cmTarget::NumberMaxType: case NumberMaxType:
return "Numeric maximum compatibility"; return "Numeric maximum compatibility";
case cmTarget::NumberMinType: case NumberMinType:
return "Numeric minimum compatibility"; return "Numeric minimum compatibility";
} }
assert(0 && "Unreachable!"); assert(0 && "Unreachable!");
@ -1778,15 +1786,15 @@ std::string compatibilityType(cmTarget::CompatibleType t)
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
std::string compatibilityAgree(cmTarget::CompatibleType t, bool dominant) std::string compatibilityAgree(CompatibleType t, bool dominant)
{ {
switch(t) switch(t)
{ {
case cmTarget::BoolType: case BoolType:
case cmTarget::StringType: case StringType:
return dominant ? "(Disagree)\n" : "(Agree)\n"; return dominant ? "(Disagree)\n" : "(Agree)\n";
case cmTarget::NumberMaxType: case NumberMaxType:
case cmTarget::NumberMinType: case NumberMinType:
return dominant ? "(Dominant)\n" : "(Ignored)\n"; return dominant ? "(Dominant)\n" : "(Ignored)\n";
} }
assert(0 && "Unreachable!"); assert(0 && "Unreachable!");
@ -1842,12 +1850,12 @@ const char* impliedValue<const char*>(const char*)
template<typename PropertyType> template<typename PropertyType>
std::pair<bool, PropertyType> consistentProperty(PropertyType lhs, std::pair<bool, PropertyType> consistentProperty(PropertyType lhs,
PropertyType rhs, PropertyType rhs,
cmTarget::CompatibleType t); CompatibleType t);
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
template<> template<>
std::pair<bool, bool> consistentProperty(bool lhs, bool rhs, std::pair<bool, bool> consistentProperty(bool lhs, bool rhs,
cmTarget::CompatibleType) CompatibleType)
{ {
return std::make_pair(lhs == rhs, lhs); return std::make_pair(lhs == rhs, lhs);
} }
@ -1863,7 +1871,7 @@ std::pair<bool, const char*> consistentStringProperty(const char *lhs,
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
std::pair<bool, const char*> consistentNumberProperty(const char *lhs, std::pair<bool, const char*> consistentNumberProperty(const char *lhs,
const char *rhs, const char *rhs,
cmTarget::CompatibleType t) CompatibleType t)
{ {
char *pEnd; char *pEnd;
@ -1881,7 +1889,7 @@ std::pair<bool, const char*> consistentNumberProperty(const char *lhs,
return std::pair<bool, const char*>(false, null_ptr); return std::pair<bool, const char*>(false, null_ptr);
} }
if (t == cmTarget::NumberMaxType) if (t == NumberMaxType)
{ {
return std::make_pair(true, std::max(lnum, rnum) == lnum ? lhs : rhs); return std::make_pair(true, std::max(lnum, rnum) == lnum ? lhs : rhs);
} }
@ -1895,7 +1903,7 @@ std::pair<bool, const char*> consistentNumberProperty(const char *lhs,
template<> template<>
std::pair<bool, const char*> consistentProperty(const char *lhs, std::pair<bool, const char*> consistentProperty(const char *lhs,
const char *rhs, const char *rhs,
cmTarget::CompatibleType t) CompatibleType t)
{ {
if (!lhs && !rhs) if (!lhs && !rhs)
{ {
@ -1914,13 +1922,13 @@ std::pair<bool, const char*> consistentProperty(const char *lhs,
switch(t) switch(t)
{ {
case cmTarget::BoolType: case BoolType:
assert(0 && "consistentProperty for strings called with BoolType"); assert(0 && "consistentProperty for strings called with BoolType");
return std::pair<bool, const char*>(false, null_ptr); return std::pair<bool, const char*>(false, null_ptr);
case cmTarget::StringType: case StringType:
return consistentStringProperty(lhs, rhs); return consistentStringProperty(lhs, rhs);
case cmTarget::NumberMinType: case NumberMinType:
case cmTarget::NumberMaxType: case NumberMaxType:
return consistentNumberProperty(lhs, rhs, t); return consistentNumberProperty(lhs, rhs, t);
} }
assert(0 && "Unreachable!"); assert(0 && "Unreachable!");
@ -1933,7 +1941,7 @@ PropertyType checkInterfacePropertyCompatibility(cmTarget const* tgt,
const std::string &p, const std::string &p,
const std::string& config, const std::string& config,
const char *defaultValue, const char *defaultValue,
cmTarget::CompatibleType t, CompatibleType t,
PropertyType *) PropertyType *)
{ {
PropertyType propContent = getTypedProperty<PropertyType>(tgt, p); PropertyType propContent = getTypedProperty<PropertyType>(tgt, p);
@ -2119,7 +2127,7 @@ bool cmGeneratorTarget::GetLinkInterfaceDependentBoolProperty(
{ {
return checkInterfacePropertyCompatibility<bool>(this->Target, p, config, return checkInterfacePropertyCompatibility<bool>(this->Target, p, config,
"FALSE", "FALSE",
cmTarget::BoolType, 0); BoolType, 0);
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
@ -2131,7 +2139,7 @@ const char* cmGeneratorTarget::GetLinkInterfaceDependentStringProperty(
p, p,
config, config,
"empty", "empty",
cmTarget::StringType, 0); StringType, 0);
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
@ -2143,7 +2151,7 @@ const char * cmGeneratorTarget::GetLinkInterfaceDependentNumberMinProperty(
p, p,
config, config,
"empty", "empty",
cmTarget::NumberMinType, 0); NumberMinType, 0);
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
@ -2155,7 +2163,7 @@ const char * cmGeneratorTarget::GetLinkInterfaceDependentNumberMaxProperty(
p, p,
config, config,
"empty", "empty",
cmTarget::NumberMaxType, 0); NumberMaxType, 0);
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------

View File

@ -581,14 +581,6 @@ public:
return this->LinkLibrariesForVS6;} return this->LinkLibrariesForVS6;}
#endif #endif
enum CompatibleType
{
BoolType,
StringType,
NumberMinType,
NumberMaxType
};
private: private:
bool HandleLocationPropertyPolicy(cmMakefile* context) const; bool HandleLocationPropertyPolicy(cmMakefile* context) const;