FreeBSD targets: Predefine version FreeBSD_<major>

As newly required for druntime.
This commit is contained in:
Martin Kinkelin 2020-11-27 18:46:16 +01:00
parent 84a88ca9ec
commit 1ca4b9332b

View file

@ -779,6 +779,12 @@ void registerPredefinedTargetVersions() {
break; break;
case llvm::Triple::FreeBSD: case llvm::Triple::FreeBSD:
VersionCondition::addPredefinedGlobalIdent("FreeBSD"); VersionCondition::addPredefinedGlobalIdent("FreeBSD");
if (unsigned major = triple.getOSMajorVersion()) {
const auto withMajor = "FreeBSD_" + std::to_string(major);
VersionCondition::addPredefinedGlobalIdent(withMajor.c_str());
} else {
warning(Loc(), "FreeBSD major version not specified in target triple");
}
VersionCondition::addPredefinedGlobalIdent("Posix"); VersionCondition::addPredefinedGlobalIdent("Posix");
VersionCondition::addPredefinedGlobalIdent("CppRuntime_Clang"); VersionCondition::addPredefinedGlobalIdent("CppRuntime_Clang");
break; break;