From 3e125c0c017e346768f9882882c31b81cc07940f Mon Sep 17 00:00:00 2001 From: Brad King Date: Tue, 11 Sep 2018 14:04:33 -0400 Subject: [PATCH] Ninja,Makefile: Drop extra space after RULE_LAUNCH_CUSTOM value The Ninja and Makefile generators were adding a space to the value both before and after expanding rule variables. Only the latter is needed. While at it, revise some outdated comments since the rule variable expansion is no longer responsible for inserting the launcher. Suggested-by: Mate Pek Fixes: #18340 --- Source/cmLocalNinjaGenerator.cxx | 7 ++----- Source/cmLocalUnixMakefileGenerator3.cxx | 4 +--- 2 files changed, 3 insertions(+), 8 deletions(-) diff --git a/Source/cmLocalNinjaGenerator.cxx b/Source/cmLocalNinjaGenerator.cxx index 360f73da58..eb31478800 100644 --- a/Source/cmLocalNinjaGenerator.cxx +++ b/Source/cmLocalNinjaGenerator.cxx @@ -564,8 +564,7 @@ std::string cmLocalNinjaGenerator::MakeCustomLauncher( return std::string(); } - // Expand rules in the empty string. It may insert the launcher and - // perform replacements. + // Expand rule variables referenced in the given launcher command. cmRulePlaceholderExpander::RuleVariables vars; std::string output; @@ -580,12 +579,10 @@ std::string cmLocalNinjaGenerator::MakeCustomLauncher( } vars.Output = output.c_str(); - std::string launcher = property_value; - launcher += " "; - std::unique_ptr rulePlaceholderExpander( this->CreateRulePlaceholderExpander()); + std::string launcher = property_value; rulePlaceholderExpander->ExpandRuleVariables(this, launcher, vars); if (!launcher.empty()) { launcher += " "; diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx index bc83ce268c..690b8279e2 100644 --- a/Source/cmLocalUnixMakefileGenerator3.cxx +++ b/Source/cmLocalUnixMakefileGenerator3.cxx @@ -967,8 +967,7 @@ void cmLocalUnixMakefileGenerator3::AppendCustomCommand( // Short-circuit if there is no launcher. const char* val = this->GetRuleLauncher(target, "RULE_LAUNCH_CUSTOM"); if (val && *val) { - // Expand rules in the empty string. It may insert the launcher and - // perform replacements. + // Expand rule variables referenced in the given launcher command. cmRulePlaceholderExpander::RuleVariables vars; vars.CMTargetName = target->GetName().c_str(); vars.CMTargetType = cmState::GetTargetTypeName(target->GetType()); @@ -986,7 +985,6 @@ void cmLocalUnixMakefileGenerator3::AppendCustomCommand( vars.Output = output.c_str(); launcher = val; - launcher += " "; rulePlaceholderExpander->ExpandRuleVariables(this, launcher, vars); if (!launcher.empty()) { launcher += " ";