From f4a25874a2cb5468e7ecce6812e5833e10943017 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Mon, 6 Jul 2015 02:00:32 +0200 Subject: cmMakefile: Inline internal policy status method. --- Source/cmMakefile.cxx | 47 ++++++++++++++++++----------------------------- Source/cmMakefile.h | 2 -- 2 files changed, 18 insertions(+), 31 deletions(-) diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index cae7bbc..7a35a26 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -4742,34 +4742,6 @@ const char* cmMakefile::GetDefineFlagsCMP0059() const cmPolicies::PolicyStatus cmMakefile::GetPolicyStatus(cmPolicies::PolicyID id) const { - // Get the current setting of the policy. - cmPolicies::PolicyStatus cur = this->GetPolicyStatusInternal(id); - - // If the policy is required to be set to NEW but is not, ignore the - // current setting and tell the caller. - if(cur != cmPolicies::NEW) - { - if(cur == cmPolicies::REQUIRED_ALWAYS || - cur == cmPolicies::REQUIRED_IF_USED) - { - return cur; - } - cmPolicies::PolicyStatus def = cmPolicies::GetPolicyStatus(id); - if(def == cmPolicies::REQUIRED_ALWAYS || - def == cmPolicies::REQUIRED_IF_USED) - { - return def; - } - } - - // The current setting is okay. - return cur; -} - -//---------------------------------------------------------------------------- -cmPolicies::PolicyStatus -cmMakefile::GetPolicyStatusInternal(cmPolicies::PolicyID id) const -{ cmPolicies::PolicyStatus status = cmPolicies::GetPolicyStatus(id); cmLocalGenerator* lg = this->LocalGenerator; while(lg) @@ -4787,7 +4759,24 @@ cmMakefile::GetPolicyStatusInternal(cmPolicies::PolicyID id) const lg = lg->GetParent(); } - // The policy is not set. Use the default for this CMake version. + // If the policy is required to be set to NEW but is not, ignore the + // current setting and tell the caller. + if(status != cmPolicies::NEW) + { + if(status == cmPolicies::REQUIRED_ALWAYS || + status == cmPolicies::REQUIRED_IF_USED) + { + return status; + } + cmPolicies::PolicyStatus def = cmPolicies::GetPolicyStatus(id); + if(def == cmPolicies::REQUIRED_ALWAYS || + def == cmPolicies::REQUIRED_IF_USED) + { + return def; + } + } + + // The current setting is okay. return status; } diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h index 2fc4d78..6dbea89 100644 --- a/Source/cmMakefile.h +++ b/Source/cmMakefile.h @@ -938,8 +938,6 @@ private: typedef std::vector PolicyStackType; PolicyStackType PolicyStack; std::vector PolicyBarriers; - cmPolicies::PolicyStatus - GetPolicyStatusInternal(cmPolicies::PolicyID id) const; // CMP0053 == old cmake::MessageType ExpandVariablesInStringOld( -- cgit v0.12