BUG: Do not replace @VAR@ syntax in list files. This addresses bug #2722.

This commit is contained in:
Brad King 2006-10-04 14:37:42 -04:00
parent 430f6f35eb
commit 523075ded5
7 changed files with 30 additions and 7 deletions

View File

@ -1320,7 +1320,7 @@ yyreduce:
case 17:
#line 178 "cmCommandArgumentParser.y"
{
(yyval.str) = yyGetParser->ExpandVariable((yyvsp[0].str));
(yyval.str) = yyGetParser->ExpandVariableForAt((yyvsp[0].str));
}
break;

View File

@ -193,7 +193,7 @@ cal_DCURLY MultipleIds cal_RCURLY
|
cal_ATNAME
{
$<str>$ = yyGetParser->ExpandVariable($<str>1);
$<str>$ = yyGetParser->ExpandVariableForAt($<str>1);
}
MultipleIds:

View File

@ -37,6 +37,7 @@ cmCommandArgumentParserHelper::cmCommandArgumentParserHelper()
strcpy(this->BSLASHVariable, "\\");
this->NoEscapeMode = false;
this->ReplaceAtSyntax = false;
}
@ -115,6 +116,21 @@ char* cmCommandArgumentParserHelper::ExpandVariable(const char* var)
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)
{
if ( !in1 )

View File

@ -59,6 +59,7 @@ public:
char* ExpandSpecialVariable(const char* key, const char* var);
char* ExpandVariable(const char* var);
char* ExpandVariableForAt(const char* var);
void SetResult(const char* value);
void SetMakefile(const cmMakefile* mf);
@ -68,6 +69,7 @@ public:
void SetLineFile(long line, const char* file);
void SetEscapeQuotes(bool b) { this->EscapeQuotes = b; }
void SetNoEscapeMode(bool b) { this->NoEscapeMode = b; }
void SetReplaceAtSyntax(bool b) { this->ReplaceAtSyntax = b; }
const char* GetError() { return this->ErrorString.c_str(); }
char EmptyVariable[1];
@ -101,6 +103,7 @@ private:
bool EscapeQuotes;
std::string ErrorString;
bool NoEscapeMode;
bool ReplaceAtSyntax;
};
#endif

View File

@ -1662,7 +1662,8 @@ const char *cmMakefile::ExpandVariablesInString(std::string& source,
bool atOnly,
const char* filename,
long line,
bool removeEmpty) const
bool removeEmpty,
bool replaceAt) const
{
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.SetEscapeQuotes(escapeQuotes);
parser.SetNoEscapeMode(noEscapes);
parser.SetReplaceAtSyntax(replaceAt);
int res = parser.ParseString(source.c_str(), 0);
if ( res )
{
@ -2022,7 +2024,8 @@ void cmMakefile::ExpandArguments(
// Expand the variables in the argument.
value = i->Value;
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.
// Otherwise, it may be a list of arguments.

View File

@ -570,7 +570,8 @@ public:
bool atOnly = false,
const char* filename = 0,
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

View File

@ -185,7 +185,7 @@ SET(CHECK_ARGS
dollar$sign
&ampersands&
amper&sand
\@two-ats\@
@two-ats@
one@at
"c:/posix/path/with space"
"c:\\windows\\path\\with space"
@ -204,7 +204,7 @@ SET(CHECK_ARGS
"dollar$sign with space"
"&ampersands& with space"
"amper&sand with space"
"\@two-ats\@ with space"
"@two-ats@ with space"
"one@at with space"
)
FOREACH(arg ${CHECK_ARGS})