[Cmake-commits] CMake branch, next, updated. v2.8.12-4699-g2527b5b
Brad King
brad.king at kitware.com
Thu Oct 31 10:18:02 EDT 2013
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "CMake".
The branch, next has been updated
via 2527b5bf691949664f900590e5b0c5ce7125c345 (commit)
via b54dbebf6259eb9fb688b1857e84cfcc2ffdbbe1 (commit)
via ccdf7e04d451ac9fa877835d7c167b8bbda70686 (commit)
via 999abb993e8bd951ec21e10a9d5390734f5d94c6 (commit)
from d679c25782d3173e9660d0c46fb603db4ed8d9b6 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=2527b5bf691949664f900590e5b0c5ce7125c345
commit 2527b5bf691949664f900590e5b0c5ce7125c345
Merge: d679c25 b54dbeb
Author: Brad King <brad.king at kitware.com>
AuthorDate: Thu Oct 31 10:17:55 2013 -0400
Commit: CMake Topic Stage <kwrobot at kitware.com>
CommitDate: Thu Oct 31 10:17:55 2013 -0400
Merge topic 'cmake-syntax-recorded-brackets' into next
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
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=b54dbebf6259eb9fb688b1857e84cfcc2ffdbbe1
commit b54dbebf6259eb9fb688b1857e84cfcc2ffdbbe1
Author: Brad King <brad.king at kitware.com>
AuthorDate: Wed Oct 30 19:12:59 2013 -0400
Commit: Brad King <brad.king at kitware.com>
CommitDate: Wed Oct 30 19:13:41 2013 -0400
Test foreach/function/macro handling of bracket arguments
Bracket arguments recorded in command invocations inside foreach,
function, and macro blocks should not have any replacements done when
the arguments are replayed later. Teach the RunCMake.Syntax test to
cover these cases.
diff --git a/Tests/RunCMake/Syntax/ForEachBracket1-stderr.txt b/Tests/RunCMake/Syntax/ForEachBracket1-stderr.txt
new file mode 100644
index 0000000..93c31cf
--- /dev/null
+++ b/Tests/RunCMake/Syntax/ForEachBracket1-stderr.txt
@@ -0,0 +1,2 @@
+^\${x}:a
+\${x}:b$
diff --git a/Tests/RunCMake/Syntax/ForEachBracket1.cmake b/Tests/RunCMake/Syntax/ForEachBracket1.cmake
new file mode 100644
index 0000000..a55e21f
--- /dev/null
+++ b/Tests/RunCMake/Syntax/ForEachBracket1.cmake
@@ -0,0 +1,3 @@
+foreach(x a b)
+ message([[${x}:]] "${x}")
+endforeach()
diff --git a/Tests/RunCMake/Syntax/FunctionBracket1-stderr.txt b/Tests/RunCMake/Syntax/FunctionBracket1-stderr.txt
new file mode 100644
index 0000000..9ba6179
--- /dev/null
+++ b/Tests/RunCMake/Syntax/FunctionBracket1-stderr.txt
@@ -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,$
diff --git a/Tests/RunCMake/Syntax/FunctionBracket1.cmake b/Tests/RunCMake/Syntax/FunctionBracket1.cmake
new file mode 100644
index 0000000..8ed4f65
--- /dev/null
+++ b/Tests/RunCMake/Syntax/FunctionBracket1.cmake
@@ -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)
diff --git a/Tests/RunCMake/Syntax/MacroBracket1-stderr.txt b/Tests/RunCMake/Syntax/MacroBracket1-stderr.txt
new file mode 100644
index 0000000..9ba6179
--- /dev/null
+++ b/Tests/RunCMake/Syntax/MacroBracket1-stderr.txt
@@ -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,$
diff --git a/Tests/RunCMake/Syntax/MacroBracket1.cmake b/Tests/RunCMake/Syntax/MacroBracket1.cmake
new file mode 100644
index 0000000..ef6de20
--- /dev/null
+++ b/Tests/RunCMake/Syntax/MacroBracket1.cmake
@@ -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)
diff --git a/Tests/RunCMake/Syntax/RunCMakeTest.cmake b/Tests/RunCMake/Syntax/RunCMakeTest.cmake
index 4f42a07..5f05cfc 100644
--- a/Tests/RunCMake/Syntax/RunCMakeTest.cmake
+++ b/Tests/RunCMake/Syntax/RunCMakeTest.cmake
@@ -12,6 +12,9 @@ run_cmake(CommandComments)
run_cmake(CommandError0)
run_cmake(CommandError1)
run_cmake(CommandError2)
+run_cmake(ForEachBracket1)
+run_cmake(FunctionBracket1)
+run_cmake(MacroBracket1)
run_cmake(String0)
run_cmake(String1)
run_cmake(StringBackslash)
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=ccdf7e04d451ac9fa877835d7c167b8bbda70686
commit ccdf7e04d451ac9fa877835d7c167b8bbda70686
Author: Brad King <brad.king at kitware.com>
AuthorDate: Wed Oct 30 19:12:28 2013 -0400
Commit: Brad King <brad.king at kitware.com>
CommitDate: Wed Oct 30 19:13:33 2013 -0400
macro: Do not substitute for placeholders in bracket arguments
Fix the macro command implementation to avoid substituting macro
placeholders in bracket arguments recorded inside the macro block.
diff --git a/Source/cmMacroCommand.cxx b/Source/cmMacroCommand.cxx
index eda82dd..499d3c6 100644
--- a/Source/cmMacroCommand.cxx
+++ b/Source/cmMacroCommand.cxx
@@ -140,6 +140,12 @@ bool cmMacroHelperCommand::InvokeInitialPass
// Set the FilePath on the arguments to match the function since it is
// not stored and the original values may be freed
k->FilePath = this->FilePath.c_str();
+ if(k->Delim == cmListFileArgument::Bracket)
+ {
+ arg.Value = k->Value;
+ }
+ else
+ {
tmps = k->Value;
// replace formal arguments
for (unsigned int j = 1; j < this->Args.size(); ++j)
@@ -209,6 +215,7 @@ bool cmMacroHelperCommand::InvokeInitialPass
}
arg.Value = tmps;
+ }
arg.Delim = k->Delim;
arg.FilePath = k->FilePath;
arg.Line = k->Line;
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=999abb993e8bd951ec21e10a9d5390734f5d94c6
commit 999abb993e8bd951ec21e10a9d5390734f5d94c6
Author: Brad King <brad.king at kitware.com>
AuthorDate: Wed Oct 30 19:04:18 2013 -0400
Commit: Brad King <brad.king at kitware.com>
CommitDate: Wed Oct 30 19:10:11 2013 -0400
macro: Add extra indentation to placeholder substitution code
The next commit will make this block conditional so pre-indent it
to clarify the simplicity of the change.
diff --git a/Source/cmMacroCommand.cxx b/Source/cmMacroCommand.cxx
index fd6537f..eda82dd 100644
--- a/Source/cmMacroCommand.cxx
+++ b/Source/cmMacroCommand.cxx
@@ -140,75 +140,75 @@ bool cmMacroHelperCommand::InvokeInitialPass
// Set the FilePath on the arguments to match the function since it is
// not stored and the original values may be freed
k->FilePath = this->FilePath.c_str();
- tmps = k->Value;
- // replace formal arguments
- for (unsigned int j = 1; j < this->Args.size(); ++j)
- {
- variable = "${";
- variable += this->Args[j];
- variable += "}";
- cmSystemTools::ReplaceString(tmps, variable.c_str(),
- expandedArgs[j-1].c_str());
- }
- // replace argc
- cmSystemTools::ReplaceString(tmps, "${ARGC}",argcDef.c_str());
+ tmps = k->Value;
+ // replace formal arguments
+ for (unsigned int j = 1; j < this->Args.size(); ++j)
+ {
+ variable = "${";
+ variable += this->Args[j];
+ variable += "}";
+ cmSystemTools::ReplaceString(tmps, variable.c_str(),
+ expandedArgs[j-1].c_str());
+ }
+ // replace argc
+ cmSystemTools::ReplaceString(tmps, "${ARGC}",argcDef.c_str());
- // repleace ARGN
- if (tmps.find("${ARGN}") != std::string::npos)
- {
- if (!argnDefInitialized)
+ // repleace ARGN
+ if (tmps.find("${ARGN}") != std::string::npos)
{
- std::vector<std::string>::const_iterator eit;
- std::vector<std::string>::size_type cnt = 0;
- for ( eit = expandedArgs.begin(); eit != expandedArgs.end(); ++eit )
+ if (!argnDefInitialized)
{
- if ( cnt >= this->Args.size()-1 )
+ std::vector<std::string>::const_iterator eit;
+ std::vector<std::string>::size_type cnt = 0;
+ for(eit = expandedArgs.begin(); eit != expandedArgs.end(); ++eit)
{
- if ( argnDef.size() > 0 )
+ if ( cnt >= this->Args.size()-1 )
{
- argnDef += ";";
+ if ( argnDef.size() > 0 )
+ {
+ argnDef += ";";
+ }
+ argnDef += *eit;
}
- argnDef += *eit;
+ cnt ++;
}
- cnt ++;
+ argnDefInitialized = true;
}
- argnDefInitialized = true;
+ cmSystemTools::ReplaceString(tmps, "${ARGN}", argnDef.c_str());
}
- cmSystemTools::ReplaceString(tmps, "${ARGN}", argnDef.c_str());
- }
-
- // if the current argument of the current function has ${ARGV in it
- // then try replacing ARGV values
- if (tmps.find("${ARGV") != std::string::npos)
- {
- char argvName[60];
- // repleace ARGV, compute it only once
- if (!argvDefInitialized)
+ // if the current argument of the current function has ${ARGV in it
+ // then try replacing ARGV values
+ if (tmps.find("${ARGV") != std::string::npos)
{
- std::vector<std::string>::const_iterator eit;
- for ( eit = expandedArgs.begin(); eit != expandedArgs.end(); ++eit )
+ char argvName[60];
+
+ // repleace ARGV, compute it only once
+ if (!argvDefInitialized)
{
- if ( argvDef.size() > 0 )
+ std::vector<std::string>::const_iterator eit;
+ for(eit = expandedArgs.begin(); eit != expandedArgs.end(); ++eit)
{
- argvDef += ";";
+ if ( argvDef.size() > 0 )
+ {
+ argvDef += ";";
+ }
+ argvDef += *eit;
}
- argvDef += *eit;
+ argvDefInitialized = true;
}
- argvDefInitialized = true;
- }
- cmSystemTools::ReplaceString(tmps, "${ARGV}", argvDef.c_str());
+ cmSystemTools::ReplaceString(tmps, "${ARGV}", argvDef.c_str());
- // also replace the ARGV1 ARGV2 ... etc
- for (unsigned int t = 0; t < expandedArgs.size(); ++t)
- {
- sprintf(argvName,"${ARGV%i}",t);
- cmSystemTools::ReplaceString(tmps, argvName,
- expandedArgs[t].c_str());
+ // also replace the ARGV1 ARGV2 ... etc
+ for (unsigned int t = 0; t < expandedArgs.size(); ++t)
+ {
+ sprintf(argvName,"${ARGV%i}",t);
+ cmSystemTools::ReplaceString(tmps, argvName,
+ expandedArgs[t].c_str());
+ }
}
- }
- arg.Value = tmps;
+ arg.Value = tmps;
arg.Delim = k->Delim;
arg.FilePath = k->FilePath;
arg.Line = k->Line;
-----------------------------------------------------------------------
Summary of changes:
Source/cmMacroCommand.cxx | 105 +++++++++++----------
Tests/RunCMake/Syntax/ForEachBracket1-stderr.txt | 2 +
Tests/RunCMake/Syntax/ForEachBracket1.cmake | 3 +
Tests/RunCMake/Syntax/FunctionBracket1-stderr.txt | 2 +
Tests/RunCMake/Syntax/FunctionBracket1.cmake | 6 +
Tests/RunCMake/Syntax/MacroBracket1-stderr.txt | 2 +
Tests/RunCMake/Syntax/MacroBracket1.cmake | 6 +
Tests/RunCMake/Syntax/RunCMakeTest.cmake | 3 +
8 files changed, 80 insertions(+), 49 deletions(-)
create mode 100644 Tests/RunCMake/Syntax/ForEachBracket1-stderr.txt
create mode 100644 Tests/RunCMake/Syntax/ForEachBracket1.cmake
create mode 100644 Tests/RunCMake/Syntax/FunctionBracket1-stderr.txt
create mode 100644 Tests/RunCMake/Syntax/FunctionBracket1.cmake
create mode 100644 Tests/RunCMake/Syntax/MacroBracket1-stderr.txt
create mode 100644 Tests/RunCMake/Syntax/MacroBracket1.cmake
hooks/post-receive
--
CMake
More information about the Cmake-commits
mailing list