From eef98705e295bcebc4dc392536e43141d8c24a6d Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen <oswald.buddenhagen@nokia.com> Date: Thu, 10 Dec 2009 18:53:25 +0100 Subject: sanitize evaluation of OS scopes this is marginally behavior-incompatible in that adding the name of an OS scope to CONFIG will not make it true any longer. the cleaned up semantics (besides having merit by themselves) will enable optimizations. Reviewed-by: mariusSO --- qmake/project.cpp | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/qmake/project.cpp b/qmake/project.cpp index 274e54a..ba0db66 100644 --- a/qmake/project.cpp +++ b/qmake/project.cpp @@ -1591,26 +1591,27 @@ QMakeProject::isActiveConfig(const QString &x, bool regex, QMap<QString, QString else if(x == "false") return false; - static QString spec; - if(spec.isEmpty()) - spec = QFileInfo(Option::mkfile::qmakespec).fileName(); - // Symbian is an exception to how scopes are resolved. Since we do not // have a separate target mode for Symbian, but we expect the scope to resolve // on other platforms we base it entirely on the mkspec. This means that // using a mkspec starting with 'symbian*' will resolve both the 'symbian' // and the 'unix' (because of Open C) scopes to true. - if(isForSymbian() && (x == "symbian" || x == "unix")) - return true; + if (x == "unix") { + return Option::target_mode == Option::TARG_UNIX_MODE + || Option::target_mode == Option::TARG_MACX_MODE + || isForSymbian(); + } else if (x == "macx" || x == "mac") { + return Option::target_mode == Option::TARG_MACX_MODE && !isForSymbian(); + } else if (x == "symbian") { + return isForSymbian(); + } else if (x == "win32") { + return Option::target_mode == Option::TARG_WIN_MODE && !isForSymbian(); + } //mkspecs - if((Option::target_mode == Option::TARG_MACX_MODE || - Option::target_mode == Option::TARG_UNIX_MODE) && x == "unix") - return !isForSymbian(); - else if(Option::target_mode == Option::TARG_MACX_MODE && (x == "macx" || x == "mac")) - return !isForSymbian(); - else if(Option::target_mode == Option::TARG_WIN_MODE && x == "win32") - return !isForSymbian(); + static QString spec; + if(spec.isEmpty()) + spec = QFileInfo(Option::mkfile::qmakespec).fileName(); QRegExp re(x, Qt::CaseSensitive, QRegExp::Wildcard); if((regex && re.exactMatch(spec)) || (!regex && spec == x)) return true; -- cgit v0.12