From 79063d18e40e6588ee7bfbff3fc67bfe7a657e6e Mon Sep 17 00:00:00 2001 From: Dario Gabriel Lipicar Date: Wed, 19 Aug 2026 12:44:56 -0300 Subject: [PATCH] fix(generator): refuse --backend qt before validating --impl-class The `backend == "qt"` refusal sat below the --impl-class / --impl-header requirement checks, so `--backend qt` alone never reached it: it exited 1 with "Error: --backend qt requires --impl-class ", which reads as though qt would work given one more flag. qt was removed; no flag rescues it. Hoisted the refusal (and the unsupported-backend error) above those checks. The cdylib branch returns on every path before this point, so the two checks could only ever gate a backend that was about to be rejected anyway; they are dropped rather than left unreachable. `--backend qt` now exits 6 with the removal message, `--backend bogus` exits 1, and cdylib is untouched. checks.generator-cli and checks.tests pass. Co-Authored-By: Claude Opus 5 --- cpp-generator/main.cpp | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/cpp-generator/main.cpp b/cpp-generator/main.cpp index 7d8a3f7..3e1c36e 100644 --- a/cpp-generator/main.cpp +++ b/cpp-generator/main.cpp @@ -743,18 +743,12 @@ int main(int argc, char* argv[]) return 0; } - if (implClassIdx == -1 || implClassIdx + 1 >= args.size()) { - err << "Error: --backend " << backend << " requires --impl-class \n"; - return 1; - } - if (implHeaderIdx == -1 || implHeaderIdx + 1 >= args.size()) { - err << "Error: --backend " << backend << " requires --impl-header \n"; - return 1; - } - - QString implClass = args.at(implClassIdx + 1); - QString implHeader = args.at(implHeaderIdx + 1); - + // The backend is not cdylib (that branch returned above), so the + // only thing left to do is refuse. This must come BEFORE any + // --impl-class / --impl-header validation: those flags cannot + // rescue a removed backend, and reporting them first told a user + // typing `--backend qt` that qt would work if they passed one more + // flag. if (backend == "qt") { err << "Error: --backend qt was removed. Qt-PLUGIN (provider) glue " "generation moved to logos-qt-host-generator --backend cdylib "