From 49140d4132b8046a90d963f3fa9b03deebb47500 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ludvig=20Gunne=20Lindstr=C3=B6m?= Date: Fri, 30 Aug 2024 17:21:41 +0200 Subject: [PATCH] use setC/setCPP in --std option validation --- cli/cmdlineparser.cpp | 18 +----------------- 1 file changed, 1 insertion(+), 17 deletions(-) diff --git a/cli/cmdlineparser.cpp b/cli/cmdlineparser.cpp index fc8656b394a..f328a2d2fec 100644 --- a/cli/cmdlineparser.cpp +++ b/cli/cmdlineparser.cpp @@ -1257,23 +1257,7 @@ CmdLineParser::Result CmdLineParser::parseFromArgs(int argc, const char* const a // --std else if (std::strncmp(argv[i], "--std=", 6) == 0) { const std::string std = argv[i] + 6; - bool unknown = false; - if (std::strncmp(std.c_str(), "c++", 3) == 0) { - mSettings.standards.cpp = Standards::getCPP(std); - if (mSettings.standards.getCPP() != std) { - unknown = true; - } - } - else if (std::strncmp(std.c_str(), "c", 1) == 0) { - mSettings.standards.c = Standards::getC(std); - if (mSettings.standards.getC() != std) { - unknown = true; - } - } - else { - unknown = true; - } - if (unknown) { + if (!mSettings.standards.setC(std) && !mSettings.standards.setCPP(std)) { mLogger.printError("unknown --std value '" + std + "'"); return Result::Fail; }