report to message handler whether evaluating cumulatively

we evaluate prf files precisely even when the pro file is evaluated
cumulatively. the message handler should know the mode a message is
reported in.

this just syncs up with qttools/08d0cb6f8e90a818bf6d3bec7a6d00f16419b8c0
and qttools/ea1a5c3534f089c0e704808a0fb029eda8f753b4 without
user-visible effect.

Change-Id: Ia14953a5a9dc31af56ad6c338017dd5b85bb4494
Reviewed-by: Joerg Bornemann <joerg.bornemann@theqtcompany.com>
This commit is contained in:
Oswald Buddenhagen
2013-09-02 16:43:49 +02:00
committed by Oswald Buddenhagen
parent 4996eb3433
commit 33ad0f1031
6 changed files with 19 additions and 9 deletions

View File

@@ -60,8 +60,9 @@ void ProMessageHandler::message(int type, const QString &msg, const QString &fil
emit writeMessage(format(fileName, lineNo, msg), Core::MessageManager::NoModeSwitch); emit writeMessage(format(fileName, lineNo, msg), Core::MessageManager::NoModeSwitch);
} }
void ProMessageHandler::fileMessage(const QString &msg) void ProMessageHandler::fileMessage(int type, const QString &msg)
{ {
Q_UNUSED(type)
if (m_verbose) if (m_verbose)
emit writeMessage(msg, Core::MessageManager::NoModeSwitch); emit writeMessage(msg, Core::MessageManager::NoModeSwitch);
} }

View File

@@ -55,7 +55,7 @@ public:
virtual void aboutToEval(ProFile *, ProFile *, EvalFileType) {} virtual void aboutToEval(ProFile *, ProFile *, EvalFileType) {}
virtual void doneWithEval(ProFile *) {} virtual void doneWithEval(ProFile *) {}
virtual void message(int type, const QString &msg, const QString &fileName, int lineNo); virtual void message(int type, const QString &msg, const QString &fileName, int lineNo);
virtual void fileMessage(const QString &msg); virtual void fileMessage(int type, const QString &msg);
void setVerbose(bool on) { m_verbose = on; } void setVerbose(bool on) { m_verbose = on; }

View File

@@ -399,7 +399,9 @@ QByteArray QMakeEvaluator::getCommandOutput(const QString &args) const
if (!errout.isEmpty()) { if (!errout.isEmpty()) {
if (errout.endsWith('\n')) if (errout.endsWith('\n'))
errout.chop(1); errout.chop(1);
m_handler->message(QMakeHandler::EvalError, QString::fromLocal8Bit(errout)); m_handler->message(
QMakeHandler::EvalError | (m_cumulative ? QMakeHandler::CumulativeEvalMessage : 0),
QString::fromLocal8Bit(errout));
} }
# endif # endif
out = proc.readAllStandardOutput(); out = proc.readAllStandardOutput();
@@ -1467,8 +1469,12 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateBuiltinConditional(
fputs(msg.toLatin1().constData(), stderr); fputs(msg.toLatin1().constData(), stderr);
#endif #endif
} else { } else {
m_handler->fileMessage(fL1S("Project %1: %2") m_handler->fileMessage(
.arg(function.toQString(m_tmp1).toUpper(), msg)); (func_t == T_ERROR ? QMakeHandler::ErrorMessage :
func_t == T_WARNING ? QMakeHandler::WarningMessage :
QMakeHandler::InfoMessage)
| (m_cumulative ? QMakeHandler::CumulativeEvalMessage : 0),
fL1S("Project %1: %2").arg(function.toQString(m_tmp1).toUpper(), msg));
} }
} }
return (func_t == T_ERROR && !m_cumulative) ? ReturnError : ReturnTrue; return (func_t == T_ERROR && !m_cumulative) ? ReturnError : ReturnTrue;

View File

@@ -1981,7 +1981,7 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateFileInto(
void QMakeEvaluator::message(int type, const QString &msg) const void QMakeEvaluator::message(int type, const QString &msg) const
{ {
if (!m_skipLevel) if (!m_skipLevel)
m_handler->message(type, msg, m_handler->message(type | (m_cumulative ? QMakeHandler::CumulativeEvalMessage : 0), msg,
m_current.line ? m_current.pro->fileName() : QString(), m_current.line ? m_current.pro->fileName() : QString(),
m_current.line != 0xffff ? m_current.line : -1); m_current.line != 0xffff ? m_current.line : -1);
} }

View File

@@ -65,6 +65,8 @@ public:
enum { enum {
SourceEvaluator = 0x10, SourceEvaluator = 0x10,
CumulativeEvalMessage = 0x1000,
EvalWarnLanguage = SourceEvaluator | WarningMessage | WarnLanguage, EvalWarnLanguage = SourceEvaluator | WarningMessage | WarnLanguage,
EvalWarnDeprecated = SourceEvaluator | WarningMessage | WarnDeprecated, EvalWarnDeprecated = SourceEvaluator | WarningMessage | WarnDeprecated,
@@ -72,7 +74,7 @@ public:
}; };
// error(), warning() and message() from .pro file // error(), warning() and message() from .pro file
virtual void fileMessage(const QString &msg) = 0; virtual void fileMessage(int type, const QString &msg) = 0;
enum EvalFileType { EvalProjectFile, EvalIncludeFile, EvalConfigFile, EvalFeatureFile, EvalAuxFile }; enum EvalFileType { EvalProjectFile, EvalIncludeFile, EvalConfigFile, EvalFeatureFile, EvalAuxFile };
virtual void aboutToEval(ProFile *parent, ProFile *proFile, EvalFileType type) = 0; virtual void aboutToEval(ProFile *parent, ProFile *proFile, EvalFileType type) = 0;

View File

@@ -47,8 +47,9 @@ class QMAKE_EXPORT QMakeParserHandler
public: public:
enum { enum {
CategoryMask = 0xf00, CategoryMask = 0xf00,
WarningMessage = 0x000, InfoMessage = 0x100,
ErrorMessage = 0x100, WarningMessage = 0x200,
ErrorMessage = 0x300,
SourceMask = 0xf0, SourceMask = 0xf0,
SourceParser = 0, SourceParser = 0,