From 87054805872429c1c17135f9ae5364b050d3fdff Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Fri, 1 Feb 2013 20:03:02 +0100 Subject: support alternative and multiple suffixes in $$resolve_depends() this is undeniably a new feature, but it's needed for a bugfix. Change-Id: I951a3128eb580404ee0c7e3cdcb4d6170e899f70 Reviewed-by: Joerg Bornemann --- qmake/library/qmakebuiltins.cpp | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) (limited to 'qmake/library/qmakebuiltins.cpp') diff --git a/qmake/library/qmakebuiltins.cpp b/qmake/library/qmakebuiltins.cpp index 2ade267f74..3206425af3 100644 --- a/qmake/library/qmakebuiltins.cpp +++ b/qmake/library/qmakebuiltins.cpp @@ -382,14 +382,16 @@ QByteArray QMakeEvaluator::getCommandOutput(const QString &args) const } void QMakeEvaluator::populateDeps( - const ProStringList &deps, const ProString &prefix, + const ProStringList &deps, const ProString &prefix, const ProStringList &suffixes, QHash > &dependencies, ProValueMap &dependees, ProStringList &rootSet) const { foreach (const ProString &item, deps) if (!dependencies.contains(item.toKey())) { QSet &dset = dependencies[item.toKey()]; // Always create entry - ProStringList depends = values(ProKey(prefix + item + QString::fromLatin1(".depends"))); + ProStringList depends; + foreach (const ProString &suffix, suffixes) + depends += values(ProKey(prefix + item + suffix)); if (depends.isEmpty()) { rootSet << item; } else { @@ -397,7 +399,7 @@ void QMakeEvaluator::populateDeps( dset.insert(dep.toKey()); dependees[dep.toKey()] << item; } - populateDeps(depends, prefix, dependencies, dependees, rootSet); + populateDeps(depends, prefix, suffixes, dependencies, dependees, rootSet); } } } @@ -913,14 +915,17 @@ ProStringList QMakeEvaluator::evaluateBuiltinExpand( break; case E_SORT_DEPENDS: case E_RESOLVE_DEPENDS: - if (args.count() < 1 || args.count() > 2) { - evalError(fL1S("%1(var, prefix) requires one or two arguments.").arg(func.toQString(m_tmp1))); + if (args.count() < 1 || args.count() > 3) { + evalError(fL1S("%1(var, [prefix, [suffixes]]) requires one to three arguments.") + .arg(func.toQString(m_tmp1))); } else { QHash > dependencies; ProValueMap dependees; ProStringList rootSet; ProStringList orgList = values(args.at(0).toKey()); populateDeps(orgList, (args.count() < 2 ? ProString() : args.at(1)), + args.count() < 3 ? ProStringList(ProString(".depends")) + : split_value_list(args.at(2).toQString(m_tmp2)), dependencies, dependees, rootSet); for (int i = 0; i < rootSet.size(); ++i) { const ProString &item = rootSet.at(i); -- cgit v1.2.3 From 601ab660af07a11b1b394629a075c09828df1116 Mon Sep 17 00:00:00 2001 From: Orgad Shaneh Date: Tue, 8 Jan 2013 03:32:53 +0200 Subject: Remove braces for single lines of conditions #!/usr/bin/env ruby Dir.glob('**/*.cpp') { |file| # skip ast (excluding paste, astpath, and canv'ast'imer) next if file =~ /ast[^eip]|keywords\.|qualifiers|preprocessor|names.cpp/i s = File.read(file) next if s.include?('qlalr') orig = s.dup s.gsub!(/\n *if [^\n]*{\n[^\n]*\n\s+}(\s+else if [^\n]* {\n[^\n]*\n\s+})*(\s+else {\n[^\n]*\n\s+})?\n/m) { |m| res = $& if res =~ /^\s*(\/\/|[A-Z_]{3,})/ # C++ comment or macro (Q_UNUSED, SDEBUG), do not touch braces res else res.gsub!('} else', 'else') res.gsub!(/\n +} *\n/m, "\n") res.gsub(/ *{$/, '') end } s.gsub!(/ *$/, '') File.open(file, 'wb').write(s) if s != orig } Change-Id: I3b30ee60df0986f66c02132c65fc38a3fbb6bbdc Reviewed-by: hjk (cherry picked from qtcreator/29a93998df8405e8799ad23934a56cd99fb36403) Reviewed-by: Robin Burchell --- qmake/library/qmakebuiltins.cpp | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) (limited to 'qmake/library/qmakebuiltins.cpp') diff --git a/qmake/library/qmakebuiltins.cpp b/qmake/library/qmakebuiltins.cpp index 3206425af3..f46d66ba89 100644 --- a/qmake/library/qmakebuiltins.cpp +++ b/qmake/library/qmakebuiltins.cpp @@ -694,11 +694,10 @@ ProStringList QMakeEvaluator::evaluateBuiltinExpand( } break; case E_EVAL: - if (args.count() != 1) { + if (args.count() != 1) evalError(fL1S("eval(variable) requires one argument.")); - } else { + else ret += values(map(args.at(0))); - } break; case E_LIST: { QString tmp; @@ -1160,9 +1159,8 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateBuiltinConditional( for (int i = configs.size() - 1; i >= 0; i--) { for (int mut = 0; mut < mutuals.count(); mut++) { - if (configs[i] == mutuals[mut].trimmed()) { + if (configs[i] == mutuals[mut].trimmed()) return returnBool(configs[i] == args[0]); - } } } return ReturnFalse; @@ -1426,9 +1424,8 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateBuiltinConditional( } const QString &file = resolvePath(m_option->expandEnvVars(args.at(0).toQString(m_tmp1))); - if (IoUtils::exists(file)) { + if (IoUtils::exists(file)) return ReturnTrue; - } int slsh = file.lastIndexOf(QLatin1Char('/')); QString fn = file.mid(slsh+1); if (fn.contains(QLatin1Char('*')) || fn.contains(QLatin1Char('?'))) { -- cgit v1.2.3