From 41f211d25f655343e47f8928497abcc23ea8b29f Mon Sep 17 00:00:00 2001 From: Joerg Bornemann Date: Tue, 4 Jan 2022 14:35:24 +0100 Subject: qmake: Print error and exit if a response file cannot be created This is always an error, and we should not silently return an empty string and pretend that everything is in order. Drive-by change: Add a comment stating what createResponseFile() returns. Pick-to: 6.3 Change-Id: I4ee940cfac826c7ae5d15e977b692f1368ab29ea Reviewed-by: Alexey Edelev --- qmake/generators/makefile.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'qmake/generators/makefile.cpp') diff --git a/qmake/generators/makefile.cpp b/qmake/generators/makefile.cpp index 53d50f23f9..59dc24f022 100644 --- a/qmake/generators/makefile.cpp +++ b/qmake/generators/makefile.cpp @@ -3492,6 +3492,9 @@ ProKey MakefileGenerator::fullTargetVariable() const return "TARGET"; } +/* + * Create a response file and return its file name. + */ QString MakefileGenerator::createResponseFile( const QString &baseName, const ProStringList &objList, @@ -3504,8 +3507,11 @@ QString MakefileGenerator::createResponseFile( fileName += '.' + var("MAKEFILE"); QString filePath = Option::output_dir + QDir::separator() + fileName; QFile file(filePath); - if (!file.open(QIODevice::WriteOnly | QIODevice::Text)) - return QString(); + if (!file.open(QIODevice::WriteOnly | QIODevice::Text)) { + fprintf(stderr, "Error: Cannot open response file '%s' for writing.\n", + qPrintable(filePath)); + exit(1); + } QTextStream t(&file); for (ProStringList::ConstIterator it = objList.constBegin(); it != objList.constEnd(); ++it) { QString path = (*it).toQString(); -- cgit v1.2.3