BUG: Do not replace @VAR@ syntax in list files. This addresses bug #2722.
This commit is contained in:
parent
430f6f35eb
commit
523075ded5
|
@ -1320,7 +1320,7 @@ yyreduce:
|
||||||
case 17:
|
case 17:
|
||||||
#line 178 "cmCommandArgumentParser.y"
|
#line 178 "cmCommandArgumentParser.y"
|
||||||
{
|
{
|
||||||
(yyval.str) = yyGetParser->ExpandVariable((yyvsp[0].str));
|
(yyval.str) = yyGetParser->ExpandVariableForAt((yyvsp[0].str));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
|
@ -193,7 +193,7 @@ cal_DCURLY MultipleIds cal_RCURLY
|
||||||
|
|
|
|
||||||
cal_ATNAME
|
cal_ATNAME
|
||||||
{
|
{
|
||||||
$<str>$ = yyGetParser->ExpandVariable($<str>1);
|
$<str>$ = yyGetParser->ExpandVariableForAt($<str>1);
|
||||||
}
|
}
|
||||||
|
|
||||||
MultipleIds:
|
MultipleIds:
|
||||||
|
|
|
@ -37,6 +37,7 @@ cmCommandArgumentParserHelper::cmCommandArgumentParserHelper()
|
||||||
strcpy(this->BSLASHVariable, "\\");
|
strcpy(this->BSLASHVariable, "\\");
|
||||||
|
|
||||||
this->NoEscapeMode = false;
|
this->NoEscapeMode = false;
|
||||||
|
this->ReplaceAtSyntax = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -115,6 +116,21 @@ char* cmCommandArgumentParserHelper::ExpandVariable(const char* var)
|
||||||
return this->AddString(value);
|
return this->AddString(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
char* cmCommandArgumentParserHelper::ExpandVariableForAt(const char* var)
|
||||||
|
{
|
||||||
|
if(this->ReplaceAtSyntax)
|
||||||
|
{
|
||||||
|
return this->ExpandVariable(var);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
std::string ref = "@";
|
||||||
|
ref += var;
|
||||||
|
ref += "@";
|
||||||
|
return this->AddString(ref.c_str());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
char* cmCommandArgumentParserHelper::CombineUnions(char* in1, char* in2)
|
char* cmCommandArgumentParserHelper::CombineUnions(char* in1, char* in2)
|
||||||
{
|
{
|
||||||
if ( !in1 )
|
if ( !in1 )
|
||||||
|
|
|
@ -59,6 +59,7 @@ public:
|
||||||
|
|
||||||
char* ExpandSpecialVariable(const char* key, const char* var);
|
char* ExpandSpecialVariable(const char* key, const char* var);
|
||||||
char* ExpandVariable(const char* var);
|
char* ExpandVariable(const char* var);
|
||||||
|
char* ExpandVariableForAt(const char* var);
|
||||||
void SetResult(const char* value);
|
void SetResult(const char* value);
|
||||||
|
|
||||||
void SetMakefile(const cmMakefile* mf);
|
void SetMakefile(const cmMakefile* mf);
|
||||||
|
@ -68,6 +69,7 @@ public:
|
||||||
void SetLineFile(long line, const char* file);
|
void SetLineFile(long line, const char* file);
|
||||||
void SetEscapeQuotes(bool b) { this->EscapeQuotes = b; }
|
void SetEscapeQuotes(bool b) { this->EscapeQuotes = b; }
|
||||||
void SetNoEscapeMode(bool b) { this->NoEscapeMode = b; }
|
void SetNoEscapeMode(bool b) { this->NoEscapeMode = b; }
|
||||||
|
void SetReplaceAtSyntax(bool b) { this->ReplaceAtSyntax = b; }
|
||||||
|
|
||||||
const char* GetError() { return this->ErrorString.c_str(); }
|
const char* GetError() { return this->ErrorString.c_str(); }
|
||||||
char EmptyVariable[1];
|
char EmptyVariable[1];
|
||||||
|
@ -101,6 +103,7 @@ private:
|
||||||
bool EscapeQuotes;
|
bool EscapeQuotes;
|
||||||
std::string ErrorString;
|
std::string ErrorString;
|
||||||
bool NoEscapeMode;
|
bool NoEscapeMode;
|
||||||
|
bool ReplaceAtSyntax;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -1662,7 +1662,8 @@ const char *cmMakefile::ExpandVariablesInString(std::string& source,
|
||||||
bool atOnly,
|
bool atOnly,
|
||||||
const char* filename,
|
const char* filename,
|
||||||
long line,
|
long line,
|
||||||
bool removeEmpty) const
|
bool removeEmpty,
|
||||||
|
bool replaceAt) const
|
||||||
{
|
{
|
||||||
if ( source.empty() || source.find_first_of("$@\\") == source.npos)
|
if ( source.empty() || source.find_first_of("$@\\") == source.npos)
|
||||||
{
|
{
|
||||||
|
@ -1681,6 +1682,7 @@ const char *cmMakefile::ExpandVariablesInString(std::string& source,
|
||||||
parser.SetLineFile(line, filename);
|
parser.SetLineFile(line, filename);
|
||||||
parser.SetEscapeQuotes(escapeQuotes);
|
parser.SetEscapeQuotes(escapeQuotes);
|
||||||
parser.SetNoEscapeMode(noEscapes);
|
parser.SetNoEscapeMode(noEscapes);
|
||||||
|
parser.SetReplaceAtSyntax(replaceAt);
|
||||||
int res = parser.ParseString(source.c_str(), 0);
|
int res = parser.ParseString(source.c_str(), 0);
|
||||||
if ( res )
|
if ( res )
|
||||||
{
|
{
|
||||||
|
@ -2022,7 +2024,8 @@ void cmMakefile::ExpandArguments(
|
||||||
// Expand the variables in the argument.
|
// Expand the variables in the argument.
|
||||||
value = i->Value;
|
value = i->Value;
|
||||||
this->ExpandVariablesInString(value, false, false, false,
|
this->ExpandVariablesInString(value, false, false, false,
|
||||||
i->FilePath, i->Line);
|
i->FilePath, i->Line,
|
||||||
|
false, false);
|
||||||
|
|
||||||
// If the argument is quoted, it should be one argument.
|
// If the argument is quoted, it should be one argument.
|
||||||
// Otherwise, it may be a list of arguments.
|
// Otherwise, it may be a list of arguments.
|
||||||
|
|
|
@ -570,7 +570,8 @@ public:
|
||||||
bool atOnly = false,
|
bool atOnly = false,
|
||||||
const char* filename = 0,
|
const char* filename = 0,
|
||||||
long line = -1,
|
long line = -1,
|
||||||
bool removeEmpty = false) const;
|
bool removeEmpty = false,
|
||||||
|
bool replaceAt = true) const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Remove any remaining variables in the string. Anything with ${var} or
|
* Remove any remaining variables in the string. Anything with ${var} or
|
||||||
|
|
|
@ -185,7 +185,7 @@ SET(CHECK_ARGS
|
||||||
dollar$sign
|
dollar$sign
|
||||||
&ersands&
|
&ersands&
|
||||||
amper&sand
|
amper&sand
|
||||||
\@two-ats\@
|
@two-ats@
|
||||||
one@at
|
one@at
|
||||||
"c:/posix/path/with space"
|
"c:/posix/path/with space"
|
||||||
"c:\\windows\\path\\with space"
|
"c:\\windows\\path\\with space"
|
||||||
|
@ -204,7 +204,7 @@ SET(CHECK_ARGS
|
||||||
"dollar$sign with space"
|
"dollar$sign with space"
|
||||||
"&ersands& with space"
|
"&ersands& with space"
|
||||||
"amper&sand with space"
|
"amper&sand with space"
|
||||||
"\@two-ats\@ with space"
|
"@two-ats@ with space"
|
||||||
"one@at with space"
|
"one@at with space"
|
||||||
)
|
)
|
||||||
FOREACH(arg ${CHECK_ARGS})
|
FOREACH(arg ${CHECK_ARGS})
|
||||||
|
|
Loading…
Reference in New Issue