Merge topic 'cmake-syntax-recorded-brackets'

b54dbeb Test foreach/function/macro handling of bracket arguments
ccdf7e0 macro: Do not substitute for placeholders in bracket arguments
999abb9 macro: Add extra indentation to placeholder substitution code
This commit is contained in:
Brad King 2013-11-01 09:39:56 -04:00 committed by CMake Topic Stage
commit a549b68d37
8 changed files with 80 additions and 49 deletions

View File

@ -140,6 +140,12 @@ bool cmMacroHelperCommand::InvokeInitialPass
// Set the FilePath on the arguments to match the function since it is // Set the FilePath on the arguments to match the function since it is
// not stored and the original values may be freed // not stored and the original values may be freed
k->FilePath = this->FilePath.c_str(); k->FilePath = this->FilePath.c_str();
if(k->Delim == cmListFileArgument::Bracket)
{
arg.Value = k->Value;
}
else
{
tmps = k->Value; tmps = k->Value;
// replace formal arguments // replace formal arguments
for (unsigned int j = 1; j < this->Args.size(); ++j) for (unsigned int j = 1; j < this->Args.size(); ++j)
@ -209,6 +215,7 @@ bool cmMacroHelperCommand::InvokeInitialPass
} }
arg.Value = tmps; arg.Value = tmps;
}
arg.Delim = k->Delim; arg.Delim = k->Delim;
arg.FilePath = k->FilePath; arg.FilePath = k->FilePath;
arg.Line = k->Line; arg.Line = k->Line;

View File

@ -0,0 +1,2 @@
^\${x}:a
\${x}:b$

View File

@ -0,0 +1,3 @@
foreach(x a b)
message([[${x}:]] "${x}")
endforeach()

View File

@ -0,0 +1,2 @@
^\${x},\${ARGN},\${ARGC},\${ARGV},\${ARGV0},\${ARGV1},\${ARGV2}:a,n,2,a;n,a,n,
\${x},\${ARGN},\${ARGC},\${ARGV},\${ARGV0},\${ARGV1},\${ARGV2}:b,n,2,b;n,b,n,$

View File

@ -0,0 +1,6 @@
function(fun x)
message([[${x},${ARGN},${ARGC},${ARGV},${ARGV0},${ARGV1},${ARGV2}:]]
"${x},${ARGN},${ARGC},${ARGV},${ARGV0},${ARGV1},${ARGV2}")
endfunction(fun)
fun(a n)
fun(b n)

View File

@ -0,0 +1,2 @@
^\${x},\${ARGN},\${ARGC},\${ARGV},\${ARGV0},\${ARGV1},\${ARGV2}:a,n,2,a;n,a,n,
\${x},\${ARGN},\${ARGC},\${ARGV},\${ARGV0},\${ARGV1},\${ARGV2}:b,n,2,b;n,b,n,$

View File

@ -0,0 +1,6 @@
macro(mac x)
message([[${x},${ARGN},${ARGC},${ARGV},${ARGV0},${ARGV1},${ARGV2}:]]
"${x},${ARGN},${ARGC},${ARGV},${ARGV0},${ARGV1},${ARGV2}")
endmacro(mac)
mac(a n)
mac(b n)

View File

@ -12,6 +12,9 @@ run_cmake(CommandComments)
run_cmake(CommandError0) run_cmake(CommandError0)
run_cmake(CommandError1) run_cmake(CommandError1)
run_cmake(CommandError2) run_cmake(CommandError2)
run_cmake(ForEachBracket1)
run_cmake(FunctionBracket1)
run_cmake(MacroBracket1)
run_cmake(String0) run_cmake(String0)
run_cmake(String1) run_cmake(String1)
run_cmake(StringBackslash) run_cmake(StringBackslash)