Skip to content

Commit

Permalink
treat gnu++XX as c++XX when parsing command files
Browse files Browse the repository at this point in the history
  • Loading branch information
ludviggunne committed Aug 27, 2024
1 parent 960be69 commit 22de247
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 2 deletions.
8 changes: 6 additions & 2 deletions lib/importproject.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -319,8 +319,12 @@ bool ImportProject::fsParseCommand(FileSettings& fs, const std::string& command)
(void)Standards::getCPP(fs.standard, unknown_std);
if (unknown_std) (void)Standards::getC(fs.standard, unknown_std);
if (unknown_std) {
printError("unknown --std value '" + fs.standard + "'");
return false;
const Standards::cppstd_t gnustd = Standards::getGnuCPP(fs.standard, unknown_std);
if (unknown_std) {
printError("unknown --std value '" + fs.standard + "'");
return false;
}
fs.standard = Standards::getCPP(gnustd);
}
} else if (F == 'i' && fval == "system") {
++pos;
Expand Down
27 changes: 27 additions & 0 deletions lib/standards.h
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,33 @@ struct Standards {
unknown = true;
return Standards::CPPLatest;
}
static cppstd_t getGnuCPP(const std::string &std, bool &unknown) {
// treat gnu++XX as c++XX
unknown = false;
if (std == "gnu++03") {
return Standards::CPP03;
}
if (std == "gnu++11") {
return Standards::CPP11;
}
if (std == "gnu++14") {
return Standards::CPP14;
}
if (std == "gnu++17") {
return Standards::CPP17;
}
if (std == "gnu++20") {
return Standards::CPP20;
}
if (std == "gnu++23") {
return Standards::CPP23;
}
if (std == "gnu++26") {
return Standards::CPP26;
}
unknown = true;
return Standards::CPPLatest;
}
};

/// @}
Expand Down

0 comments on commit 22de247

Please sign in to comment.