aboutsummaryrefslogtreecommitdiffstats
path: root/generator
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@qt.io>2017-03-07 16:34:48 +0100
committerFriedemann Kleint <Friedemann.Kleint@qt.io>2017-03-07 15:49:53 +0000
commit478300f770a49c077ea708788f254504160c3b2c (patch)
tree82f70d5a26c24abea726d46c862d13126ba7e91d /generator
parent39dc2f6072aa889625c9c3d910b9520a64a297b8 (diff)
shiboken: Improve error messages
Remove printing of version from errorPrint(), which was not used. Output the command line and call errorPrint() with a message from all places where EXIT_FAILURE is returned. Change-Id: I6bde49b461c24834be38ad9e18851a20cbe9e7bd Reviewed-by: Christian Tismer <tismer@stackless.com>
Diffstat (limited to 'generator')
-rw-r--r--generator/main.cpp24
1 files changed, 14 insertions, 10 deletions
diff --git a/generator/main.cpp b/generator/main.cpp
index e9a4ce7..72504f7 100644
--- a/generator/main.cpp
+++ b/generator/main.cpp
@@ -334,13 +334,12 @@ static inline void printVerAndBanner()
std::cout << "Copyright (C) 2016 The Qt Company Ltd." << std::endl;
}
-static inline void errorPrint(const QString& s,
- const bool& verAndBanner = false)
+static inline void errorPrint(const QString& s)
{
- if (verAndBanner)
- printVerAndBanner();
-
- std::cerr << s.toUtf8().constData() << std::endl;
+ QStringList arguments = QCoreApplication::arguments();
+ arguments.pop_front();
+ std::cerr << "shiboken: " << qPrintable(s)
+ << "\nCommand line: " << qPrintable(arguments.join(QLatin1Char(' '))) << '\n';
}
int main(int argc, char *argv[])
@@ -371,13 +370,13 @@ int main(int argc, char *argv[])
if (generatorSet == QLatin1String("qtdoc")) {
generators = docGenerators();
if (generators.isEmpty()) {
- errorPrint(QLatin1String("shiboken: Doc strings extractions was not enabled in this shiboken build."));
+ errorPrint(QLatin1String("Doc strings extractions was not enabled in this shiboken build."));
return EXIT_FAILURE;
}
} else if (generatorSet.isEmpty() || generatorSet == QLatin1String("shiboken")) {
generators = shibokenGenerators();
} else {
- errorPrint(QLatin1String("shiboken: Unknown generator set, try \"shiboken\" or \"qtdoc\"."));
+ errorPrint(QLatin1String("Unknown generator set, try \"shiboken\" or \"qtdoc\"."));
return EXIT_FAILURE;
}
@@ -488,8 +487,10 @@ int main(int argc, char *argv[])
extractor.setCppFileName(cppFileName);
extractor.setTypeSystem(typeSystemFileName);
- if (!extractor.run())
+ if (!extractor.run()) {
+ errorPrint(QLatin1String("Error running ApiExtractor."));
return EXIT_FAILURE;
+ }
if (!extractor.classCount())
qCWarning(lcShiboken) << "No C++ classes found!";
@@ -500,8 +501,11 @@ int main(int argc, char *argv[])
g->setOutputDirectory(outputDirectory);
g->setLicenseComment(licenseComment);
if (g->setup(extractor, args)) {
- if (!g->generate())
+ if (!g->generate()) {
+ errorPrint(QLatin1String("Error running generator: ")
+ + QLatin1String(g->name()) + QLatin1Char('.'));
return EXIT_FAILURE;
+ }
}
}