From 6ae36202fd3003c6c2a1fd2a6e4293073071fa4a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Olivier=20De=20Canni=C3=A8re?= Date: Thu, 22 Aug 2024 15:57:59 +0200 Subject: [PATCH] qmlcachegen: Reject using --only-bytecode with compiler-only options [ChangeLog][QtQml] qmlcachegen will now exit with a failure state if --only-bytecode is set as the same time as Script Compiler exclusive options. The only-bytecode flag skips the compilation altogether. Remove one of the conflicting flag to solve the issue. Change-Id: I5c6a0610ec4c2eb06624c2d123ab62bc633a46b8 Reviewed-by: Ulf Hermann --- tools/qmlcachegen/qmlcachegen.cpp | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/tools/qmlcachegen/qmlcachegen.cpp b/tools/qmlcachegen/qmlcachegen.cpp index 37a2298717..9552c70898 100644 --- a/tools/qmlcachegen/qmlcachegen.cpp +++ b/tools/qmlcachegen/qmlcachegen.cpp @@ -140,6 +140,23 @@ int main(int argc, char **argv) if (target == GenerateLoader && parser.isSet(resourceNameOption)) target = GenerateLoaderStandAlone; + if (parser.isSet(onlyBytecode)) { + const std::array compilerOnlyOptions{ + &directCallsOption, &staticOption, &validateBasicBlocksOption, &dumpAotStatsOption, + &moduleIdOption + }; + + for (auto *compilerOnlyOption : compilerOnlyOptions) { + if (parser.isSet(*compilerOnlyOption)) { + std::string name = compilerOnlyOption->names().first().toStdString(); + fprintf(stderr, "Passing mutually exclusive options \"only-bytecode\" and \"%s\".\n" + "Remove --only-bytecode to be able to use compiler options like --%s", + name.c_str(), name.c_str()); + return EXIT_FAILURE; + } + } + } + if (parser.isSet(dumpAotStatsOption) && !parser.isSet(moduleIdOption)) { fprintf(stderr, "--dump-aot-stats set without setting --module-id"); return EXIT_FAILURE;