diff options
author | Joerg Bornemann <joerg.bornemann@qt.io> | 2023-04-12 13:06:53 +0200 |
---|---|---|
committer | Joerg Bornemann <joerg.bornemann@qt.io> | 2023-04-17 23:32:34 +0200 |
commit | 0aa9b08536b640fe5e8e55d3c6615d00f30763ec (patch) | |
tree | 0eed925ab3602f3ccfc33d2caf980601a3b35f95 | |
parent | 69d4ecd6ef9057cb3703178277042ff7a7411459 (diff) |
qmake: Fix infinite make loop if RESOURCES contains nonexistent .qrc
If RESOURCES contained a non-existent .qrc file, qmake produced
Makefiles that resulted in an infinite loop when running GNU Make.
Introduce a new extra compiler CONFIG value "remove_no_exist" that
removes non-existent extra compiler input. This value is now used in the
extra compiler that handles the RESOURCES variable.
The difference to the existing CONFIG value "ignore_no_exist" is that
qmake still prints a warning about the non-existent file.
Pick-to: 6.5
Fixes: QTBUG-112743
Change-Id: I3293af75b75f217e1a1738b49da0af1117cfdecb
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
-rw-r--r-- | mkspecs/features/resources.prf | 2 | ||||
-rw-r--r-- | qmake/generators/makefile.cpp | 23 | ||||
-rw-r--r-- | qmake/generators/makefile.h | 3 |
3 files changed, 19 insertions, 9 deletions
diff --git a/mkspecs/features/resources.prf b/mkspecs/features/resources.prf index 7fbd16d3bd..ab9761a83c 100644 --- a/mkspecs/features/resources.prf +++ b/mkspecs/features/resources.prf @@ -13,7 +13,7 @@ qtEnsurePluginResourcesCpp() rcc.input = RESOURCES rcc.name = RCC ${QMAKE_FILE_IN} rcc.depend_command = $$QMAKE_RCC_DEP -list $$QMAKE_RESOURCE_FLAGS ${QMAKE_FILE_IN} -rcc.CONFIG += add_inputs_as_makefile_deps dep_lines +rcc.CONFIG += add_inputs_as_makefile_deps dep_lines remove_no_exist !resources_big|ltcg|macx-xcode|wasm|contains(TEMPLATE, "vc.*") { diff --git a/qmake/generators/makefile.cpp b/qmake/generators/makefile.cpp index cc985a878b..11d2f0ff7d 100644 --- a/qmake/generators/makefile.cpp +++ b/qmake/generators/makefile.cpp @@ -297,9 +297,9 @@ MakefileGenerator::findFilesInVPATH(ProStringList l, uchar flags, const QString debug_msg(1, "%s:%d Failure to find %s in vpath (%s)", __FILE__, __LINE__, val.toLatin1().constData(), vpath.join(QString("::")).toLatin1().constData()); - if(flags & VPATH_RemoveMissingFiles) + if (flags & VPATH_RemoveMissingFiles) remove_file = true; - else if(flags & VPATH_WarnMissingFiles) + if (flags & VPATH_WarnMissingFiles) warn_msg(WarnLogic, "Failure to find: %s", val.toLatin1().constData()); } else { l.removeAt(val_it); @@ -315,9 +315,9 @@ MakefileGenerator::findFilesInVPATH(ProStringList l, uchar flags, const QString debug_msg(1, "%s:%d Cannot match %s%s, as %s does not exist.", __FILE__, __LINE__, real_dir.toLatin1().constData(), regex.toLatin1().constData(), real_dir.toLatin1().constData()); - if(flags & VPATH_RemoveMissingFiles) + if (flags & VPATH_RemoveMissingFiles) remove_file = true; - else if(flags & VPATH_WarnMissingFiles) + if (flags & VPATH_WarnMissingFiles) warn_msg(WarnLogic, "Failure to find: %s", val.toLatin1().constData()); } } @@ -338,9 +338,14 @@ MakefileGenerator::initCompiler(const MakefileGenerator::Compiler &comp) // find all the relevant file inputs if(!init_compiler_already.contains(comp.variable_in)) { init_compiler_already.insert(comp.variable_in, true); - if(!noIO()) - l = findFilesInVPATH(l, (comp.flags & Compiler::CompilerRemoveNoExist) ? - VPATH_RemoveMissingFiles : VPATH_WarnMissingFiles, "VPATH_" + comp.variable_in); + if(!noIO()) { + uchar flags = 0; + if (comp.flags & Compiler::CompilerRemoveNoExist) + flags |= VPATH_RemoveMissingFiles; + if (comp.flags & Compiler::CompilerWarnNoExist) + flags |= VPATH_WarnMissingFiles; + l = findFilesInVPATH(l, flags, "VPATH_" + comp.variable_in); + } } } @@ -613,6 +618,10 @@ MakefileGenerator::init() const ProStringList &config = v[ProKey(*it + ".CONFIG")]; if (config.indexOf("ignore_no_exist") != -1) compiler.flags |= Compiler::CompilerRemoveNoExist; + else + compiler.flags |= Compiler::CompilerWarnNoExist; + if (config.indexOf("remove_no_exist") != -1) + compiler.flags |= Compiler::CompilerRemoveNoExist; if (config.indexOf("no_dependencies") != -1) compiler.flags |= Compiler::CompilerNoCheckDeps; if (config.indexOf("add_inputs_as_makefile_deps") != -1) diff --git a/qmake/generators/makefile.h b/qmake/generators/makefile.h index 854defb1a0..6ab4ad505d 100644 --- a/qmake/generators/makefile.h +++ b/qmake/generators/makefile.h @@ -145,7 +145,8 @@ protected: CompilerBuiltin = 0x01, CompilerNoCheckDeps = 0x02, CompilerRemoveNoExist = 0x04, - CompilerAddInputsAsMakefileDeps = 0x08 + CompilerWarnNoExist = 0x08, + CompilerAddInputsAsMakefileDeps = 0x10 }; uint flags, type; }; |