diff options
author | Brad King <brad.king@kitware.com> | 2013-08-06 15:48:28 -0400 |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2013-08-08 13:26:28 -0400 |
commit | bf73264694234c4e82b31689b64b8a33d61552a9 (patch) | |
tree | 4d32a31f13043804a9dbc1357bf250c94241a39a /Source/cmListFileCache.cxx | |
parent | 58e524165d44e672e391cca261d9f7dd723d2c70 (diff) | |
download | cmake-bf73264694234c4e82b31689b64b8a33d61552a9.tar.gz |
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.cxx | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/Source/cmListFileCache.cxx b/Source/cmListFileCache.cxx index c499b6fb5e..c02866cb56 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; |