diff options
author | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2017-08-23 11:06:20 +0200 |
---|---|---|
committer | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2017-08-23 09:12:33 +0000 |
commit | 31eb5b52d7ceb28e5783a4a383b547434ea832b5 (patch) | |
tree | f410b6b8c3bd6669ba1b916b55b44ff76ac9fb4b | |
parent | ecef77d751369cf7d66d5fccd110a30237755cdc (diff) |
shiboken: Prefix all warning messages by base prefix of typesystem file
shiboken is run in parallel when building PySide2, so it is sometimes
hard to tell where warnings come from.
Change-Id: Iaccd91543e14e6e9c38ebfa2b0c285417f924d03
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
-rw-r--r-- | sources/shiboken2/ApiExtractor/reporthandler.cpp | 12 | ||||
-rw-r--r-- | sources/shiboken2/ApiExtractor/reporthandler.h | 2 | ||||
-rw-r--r-- | sources/shiboken2/generator/main.cpp | 4 |
3 files changed, 17 insertions, 1 deletions
diff --git a/sources/shiboken2/ApiExtractor/reporthandler.cpp b/sources/shiboken2/ApiExtractor/reporthandler.cpp index 8abea42c6..bb3677772 100644 --- a/sources/shiboken2/ApiExtractor/reporthandler.cpp +++ b/sources/shiboken2/ApiExtractor/reporthandler.cpp @@ -52,6 +52,7 @@ static int m_suppressedCount = 0; static ReportHandler::DebugLevel m_debugLevel = ReportHandler::NoDebug; static QSet<QString> m_reportedWarnings; static QString m_progressBuffer; +static QString m_prefix; static int m_step_size = 0; static int m_step = -1; static int m_step_warning = 0; @@ -106,6 +107,11 @@ void ReportHandler::setSilent(bool silent) m_silent = silent; } +void ReportHandler::setPrefix(const QString &p) +{ + m_prefix = p; +} + void ReportHandler::messageOutput(QtMsgType type, const QMessageLogContext &context, const QString &text) { if (type == QtWarningMsg) { @@ -120,7 +126,11 @@ void ReportHandler::messageOutput(QtMsgType type, const QMessageLogContext &cont ++m_step_warning; m_reportedWarnings.insert(text); } - fprintf(stderr, "%s\n", qPrintable(qFormatLogMessage(type, context, text))); + QString message = m_prefix; + if (!message.isEmpty()) + message.append(QLatin1Char(' ')); + message.append(text); + fprintf(stderr, "%s\n", qPrintable(qFormatLogMessage(type, context, message))); } void ReportHandler::progress(const QString& str, ...) diff --git a/sources/shiboken2/ApiExtractor/reporthandler.h b/sources/shiboken2/ApiExtractor/reporthandler.h index 6896d6e86..a22e58d46 100644 --- a/sources/shiboken2/ApiExtractor/reporthandler.h +++ b/sources/shiboken2/ApiExtractor/reporthandler.h @@ -64,6 +64,8 @@ public: static bool isSilent(); static void setSilent(bool silent); + static void setPrefix(const QString &p); + private: static void messageOutput(QtMsgType type, const QMessageLogContext &context, const QString &msg); }; diff --git a/sources/shiboken2/generator/main.cpp b/sources/shiboken2/generator/main.cpp index 22bd3fa65..b22919981 100644 --- a/sources/shiboken2/generator/main.cpp +++ b/sources/shiboken2/generator/main.cpp @@ -539,6 +539,10 @@ int main(int argc, char *argv[]) QString cppFileName = argsHandler.removeArg(QLatin1String("arg-1")); QString typeSystemFileName = argsHandler.removeArg(QLatin1String("arg-2")); + QString messagePrefix = QFileInfo(typeSystemFileName).baseName(); + if (messagePrefix.startsWith(QLatin1String("typesystem_"))) + messagePrefix.remove(0, 11); + ReportHandler::setPrefix(QLatin1Char('(') + messagePrefix + QLatin1Char(')')); /* Make sure to remove the project file's arguments (if any) and * --project-file, also the arguments of each generator before |