Skip to content

Commit

Permalink
use setC/setCPP in --std option validation
Browse files Browse the repository at this point in the history
  • Loading branch information
ludviggunne committed Aug 30, 2024
1 parent 745f0ff commit 49140d4
Showing 1 changed file with 1 addition and 17 deletions.
18 changes: 1 addition & 17 deletions cli/cmdlineparser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit 49140d4

Please sign in to comment.