Skip to content

Commit dac5ab0

Browse files
committed
FreeBSD targets: Predefine version
As newly required for druntime.
1 parent 84a88ca commit dac5ab0

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

driver/main.cpp

+6
Original file line numberDiff line numberDiff line change
@@ -779,6 +779,12 @@ void registerPredefinedTargetVersions() {
779779
break;
780780
case llvm::Triple::FreeBSD:
781781
VersionCondition::addPredefinedGlobalIdent("FreeBSD");
782+
if (unsigned major = triple.getOSMajorVersion()) {
783+
const auto withMajor = "FreeBSD_" + std::to_string(major);
784+
VersionCondition::addPredefinedGlobalIdent(withMajor.c_str());
785+
} else {
786+
warning(Loc(), "FreeBSD major version not specified in target triple");
787+
}
782788
VersionCondition::addPredefinedGlobalIdent("Posix");
783789
VersionCondition::addPredefinedGlobalIdent("CppRuntime_Clang");
784790
break;

0 commit comments

Comments
 (0)