summaryrefslogtreecommitdiffstats
path: root/Source/cmListFileCache.cxx
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2013-08-06 19:48:28 (GMT)
committerBrad King <brad.king@kitware.com>2013-08-08 17:26:28 (GMT)
commitbf73264694234c4e82b31689b64b8a33d61552a9 (patch)
tree4d32a31f13043804a9dbc1357bf250c94241a39a /Source/cmListFileCache.cxx
parent58e524165d44e672e391cca261d9f7dd723d2c70 (diff)
downloadCMake-bf73264694234c4e82b31689b64b8a33d61552a9.zip
CMake-bf73264694234c4e82b31689b64b8a33d61552a9.tar.gz
CMake-bf73264694234c4e82b31689b64b8a33d61552a9.tar.bz2
Warn about unquoted arguments that look like long brackets
In the future CMake will introduce Lua-style long bracket syntax. Warn about unquoted arguments that in the future will be treated as opening long brackets. Teach the RunCMake.Syntax test to cover such cases and ensure that the warning appears.
Diffstat (limited to 'Source/cmListFileCache.cxx')
-rw-r--r--Source/cmListFileCache.cxx21
1 files changed, 21 insertions, 0 deletions
diff --git a/Source/cmListFileCache.cxx b/Source/cmListFileCache.cxx
index c499b6f..c02866c 100644
--- a/Source/cmListFileCache.cxx
+++ b/Source/cmListFileCache.cxx
@@ -343,6 +343,27 @@ void cmListFileParser::AddArgument(cmListFileLexer_Token* token,
{
cmListFileArgument a(token->text, delim, this->FileName, token->line);
this->Function.Arguments.push_back(a);
+ if(delim == cmListFileArgument::Unquoted)
+ {
+ // Warn about a future behavior change.
+ const char* c = a.Value.c_str();
+ if(*c++ == '[')
+ {
+ while(*c == '=')
+ { ++c; }
+ if(*c == '[')
+ {
+ cmOStringStream m;
+ m << "Syntax Warning in cmake code at\n"
+ << " " << this->FileName << ":" << token->line << ":"
+ << token->column << "\n"
+ << "A future version of CMake may treat unquoted argument:\n"
+ << " " << a.Value << "\n"
+ << "as an opening long bracket. Double-quote the argument.";
+ this->Makefile->IssueMessage(cmake::AUTHOR_WARNING, m.str().c_str());
+ }
+ }
+ }
if(this->Separation == SeparationOkay)
{
return;