diff options
author | Oswald Buddenhagen <oswald.buddenhagen@nokia.com> | 2011-01-28 17:03:16 (GMT) |
---|---|---|
committer | Oswald Buddenhagen <oswald.buddenhagen@nokia.com> | 2011-02-03 13:31:56 (GMT) |
commit | dbfca8da2807921069c0e53da33f6e7bd3e73479 (patch) | |
tree | 11e479c26f8c999553bb5f9a4752156ccbcc7536 /qmake/project.cpp | |
parent | b13f4901968c62d8a378a619c1ae8c2095780040 (diff) | |
download | Qt-dbfca8da2807921069c0e53da33f6e7bd3e73479.zip Qt-dbfca8da2807921069c0e53da33f6e7bd3e73479.tar.gz Qt-dbfca8da2807921069c0e53da33f6e7bd3e73479.tar.bz2 |
complain about unmatched quotes/parens
using WarnDeprecated instead of WarnParser is a bit backwards, but we
need something which is on by default and i don't feel like introducing
a second parser warning mode for that.
Reviewed-by: mariusSO
Diffstat (limited to 'qmake/project.cpp')
-rw-r--r-- | qmake/project.cpp | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/qmake/project.cpp b/qmake/project.cpp index 1a13639..9c99c44 100644 --- a/qmake/project.cpp +++ b/qmake/project.cpp @@ -280,6 +280,8 @@ static QStringList split_arg_list(const QString ¶ms) ++last; } } + // Could do a check for unmatched parens here, but split_value_list() + // is called on all our output, so mistakes will be caught anyway. return args; } @@ -288,6 +290,7 @@ static QStringList split_value_list(const QString &vals) QString build; QStringList ret; QStack<char> quote; + int parens = 0; const ushort LPAREN = '('; const ushort RPAREN = ')'; @@ -298,7 +301,7 @@ static QStringList split_value_list(const QString &vals) ushort unicode; const QChar *vals_data = vals.data(); const int vals_len = vals.length(); - for(int x = 0, parens = 0; x < vals_len; x++) { + for(int x = 0; x < vals_len; x++) { unicode = vals_data[x].unicode(); if(x != (int)vals_len-1 && unicode == BACKSLASH && (vals_data[x+1].unicode() == SINGLEQUOTE || vals_data[x+1].unicode() == DOUBLEQUOTE)) { @@ -322,6 +325,11 @@ static QStringList split_value_list(const QString &vals) } if(!build.isEmpty()) ret << build; + if (parens) + warn_msg(WarnDeprecated, "%s:%d: Unmatched parentheses are deprecated.", + parser.file.toLatin1().constData(), parser.line_no); + // Could do a check for unmatched quotes here, but doVariableReplaceExpand() + // is called on all our output, so mistakes will be caught anyway. return ret; } @@ -2966,6 +2974,9 @@ QMakeProject::doVariableReplaceExpand(const QString &str, QMap<QString, QStringL else if(!current.isEmpty()) ret.append(current); //qDebug() << "REPLACE" << str << ret; + if (quote) + warn_msg(WarnDeprecated, "%s:%d: Unmatched quotes are deprecated.", + parser.file.toLatin1().constData(), parser.line_no); return ret; } |