Skip to content

Commit

Permalink
Adapt to renamed predefined CppRuntime_* versions
Browse files Browse the repository at this point in the history
  • Loading branch information
kinke committed Jul 16, 2024
1 parent 3b16b38 commit 4a770ba
Show file tree
Hide file tree
Showing 10 changed files with 44 additions and 34 deletions.
30 changes: 20 additions & 10 deletions driver/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -830,17 +830,20 @@ void registerPredefinedTargetVersions() {
if (triple.getEnvironment() == llvm::Triple::Android) {
VersionCondition::addPredefinedGlobalIdent("Android");
VersionCondition::addPredefinedGlobalIdent("CRuntime_Bionic");
VersionCondition::addPredefinedGlobalIdent("CppRuntime_Clang");
VersionCondition::addPredefinedGlobalIdent("CppRuntime_LLVM");
VersionCondition::addPredefinedGlobalIdent("CppRuntime_Clang"); // legacy
} else if (triple.isMusl()) {
VersionCondition::addPredefinedGlobalIdent("CRuntime_Musl");
VersionCondition::addPredefinedGlobalIdent("CppRuntime_Gcc");
VersionCondition::addPredefinedGlobalIdent("CppRuntime_GNU");
VersionCondition::addPredefinedGlobalIdent("CppRuntime_Gcc"); // legacy
// use libunwind for backtraces
VersionCondition::addPredefinedGlobalIdent("DRuntime_Use_Libunwind");
} else if (global.params.isUClibcEnvironment) {
VersionCondition::addPredefinedGlobalIdent("CRuntime_UClibc");
} else {
VersionCondition::addPredefinedGlobalIdent("CRuntime_Glibc");
VersionCondition::addPredefinedGlobalIdent("CppRuntime_Gcc");
VersionCondition::addPredefinedGlobalIdent("CppRuntime_GNU");
VersionCondition::addPredefinedGlobalIdent("CppRuntime_Gcc"); // legacy
}
break;
case llvm::Triple::Haiku:
Expand All @@ -853,7 +856,8 @@ void registerPredefinedTargetVersions() {
VersionCondition::addPredefinedGlobalIdent(
"darwin"); // For backwards compatibility.
VersionCondition::addPredefinedGlobalIdent("Posix");
VersionCondition::addPredefinedGlobalIdent("CppRuntime_Clang");
VersionCondition::addPredefinedGlobalIdent("CppRuntime_LLVM");
VersionCondition::addPredefinedGlobalIdent("CppRuntime_Clang"); // legacy
break;
case llvm::Triple::FreeBSD:
VersionCondition::addPredefinedGlobalIdent("FreeBSD");
Expand All @@ -864,7 +868,8 @@ void registerPredefinedTargetVersions() {
warning(Loc(), "FreeBSD major version not specified in target triple");
}
VersionCondition::addPredefinedGlobalIdent("Posix");
VersionCondition::addPredefinedGlobalIdent("CppRuntime_Clang");
VersionCondition::addPredefinedGlobalIdent("CppRuntime_LLVM");
VersionCondition::addPredefinedGlobalIdent("CppRuntime_Clang"); // legacy
break;
case llvm::Triple::Solaris:
VersionCondition::addPredefinedGlobalIdent("Solaris");
Expand All @@ -874,7 +879,8 @@ void registerPredefinedTargetVersions() {
case llvm::Triple::DragonFly:
VersionCondition::addPredefinedGlobalIdent("DragonFlyBSD");
VersionCondition::addPredefinedGlobalIdent("Posix");
VersionCondition::addPredefinedGlobalIdent("CppRuntime_Gcc");
VersionCondition::addPredefinedGlobalIdent("CppRuntime_GNU");
VersionCondition::addPredefinedGlobalIdent("CppRuntime_Gcc"); // legacy
break;
case llvm::Triple::NetBSD:
VersionCondition::addPredefinedGlobalIdent("NetBSD");
Expand All @@ -883,7 +889,8 @@ void registerPredefinedTargetVersions() {
case llvm::Triple::OpenBSD:
VersionCondition::addPredefinedGlobalIdent("OpenBSD");
VersionCondition::addPredefinedGlobalIdent("Posix");
VersionCondition::addPredefinedGlobalIdent("CppRuntime_Gcc");
VersionCondition::addPredefinedGlobalIdent("CppRuntime_GNU");
VersionCondition::addPredefinedGlobalIdent("CppRuntime_Gcc"); // legacy
break;
case llvm::Triple::AIX:
VersionCondition::addPredefinedGlobalIdent("AIX");
Expand All @@ -892,17 +899,20 @@ void registerPredefinedTargetVersions() {
case llvm::Triple::IOS:
VersionCondition::addPredefinedGlobalIdent("iOS");
VersionCondition::addPredefinedGlobalIdent("Posix");
VersionCondition::addPredefinedGlobalIdent("CppRuntime_Clang");
VersionCondition::addPredefinedGlobalIdent("CppRuntime_LLVM");
VersionCondition::addPredefinedGlobalIdent("CppRuntime_Clang"); // legacy
break;
case llvm::Triple::TvOS:
VersionCondition::addPredefinedGlobalIdent("TVOS");
VersionCondition::addPredefinedGlobalIdent("Posix");
VersionCondition::addPredefinedGlobalIdent("CppRuntime_Clang");
VersionCondition::addPredefinedGlobalIdent("CppRuntime_LLVM");
VersionCondition::addPredefinedGlobalIdent("CppRuntime_Clang"); // legacy
break;
case llvm::Triple::WatchOS:
VersionCondition::addPredefinedGlobalIdent("WatchOS");
VersionCondition::addPredefinedGlobalIdent("Posix");
VersionCondition::addPredefinedGlobalIdent("CppRuntime_Clang");
VersionCondition::addPredefinedGlobalIdent("CppRuntime_LLVM");
VersionCondition::addPredefinedGlobalIdent("CppRuntime_Clang"); // legacy
break;
case llvm::Triple::WASI:
VersionCondition::addPredefinedGlobalIdent("WASI");
Expand Down
6 changes: 3 additions & 3 deletions runtime/druntime/src/core/stdcpp/allocator.d
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@
module core.stdcpp.allocator;

// LDC: empty module for unsupported C++ runtimes
version (CppRuntime_Microsoft) version = Supported;
else version (CppRuntime_Gcc) version = Supported;
else version (CppRuntime_Clang) version = Supported;
version (CppRuntime_Microsoft) version = Supported;
else version (CppRuntime_GNU) version = Supported;
else version (CppRuntime_LLVM) version = Supported;
version (Supported):

import core.stdcpp.new_;
Expand Down
6 changes: 3 additions & 3 deletions runtime/druntime/src/core/stdcpp/array.d
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@
module core.stdcpp.array;

// LDC: empty module for unsupported C++ runtimes
version (CppRuntime_Microsoft) version = Supported;
else version (CppRuntime_Gcc) version = Supported;
else version (CppRuntime_Clang) version = Supported;
version (CppRuntime_Microsoft) version = Supported;
else version (CppRuntime_GNU) version = Supported;
else version (CppRuntime_LLVM) version = Supported;
version (Supported):

import core.stdcpp.xutility : StdNamespace;
Expand Down
6 changes: 3 additions & 3 deletions runtime/druntime/src/core/stdcpp/exception.d
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@
module core.stdcpp.exception;

// LDC: empty module for unsupported C++ runtimes
version (CppRuntime_Microsoft) version = Supported;
else version (CppRuntime_Gcc) version = Supported;
else version (CppRuntime_Clang) version = Supported;
version (CppRuntime_Microsoft) version = Supported;
else version (CppRuntime_GNU) version = Supported;
else version (CppRuntime_LLVM) version = Supported;
version (Supported):

import core.stdcpp.xutility : __cplusplus, CppStdRevision;
Expand Down
6 changes: 3 additions & 3 deletions runtime/druntime/src/core/stdcpp/memory.d
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@
module core.stdcpp.memory;

// LDC: empty module for unsupported C++ runtimes
version (CppRuntime_Microsoft) version = Supported;
else version (CppRuntime_Gcc) version = Supported;
else version (CppRuntime_Clang) version = Supported;
version (CppRuntime_Microsoft) version = Supported;
else version (CppRuntime_GNU) version = Supported;
else version (CppRuntime_LLVM) version = Supported;
version (Supported):

public import core.stdcpp.allocator;
Expand Down
6 changes: 3 additions & 3 deletions runtime/druntime/src/core/stdcpp/new_.d
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@
module core.stdcpp.new_;

// LDC: empty module for unsupported C++ runtimes
version (CppRuntime_Microsoft) version = Supported;
else version (CppRuntime_Gcc) version = Supported;
else version (CppRuntime_Clang) version = Supported;
version (CppRuntime_Microsoft) version = Supported;
else version (CppRuntime_GNU) version = Supported;
else version (CppRuntime_LLVM) version = Supported;
version (Supported):

import core.stdcpp.xutility : __cpp_sized_deallocation, __cpp_aligned_new;
Expand Down
6 changes: 3 additions & 3 deletions runtime/druntime/src/core/stdcpp/string.d
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@
module core.stdcpp.string;

// LDC: empty module for unsupported C++ runtimes
version (CppRuntime_Microsoft) version = Supported;
else version (CppRuntime_Gcc) version = Supported;
else version (CppRuntime_Clang) version = Supported;
version (CppRuntime_Microsoft) version = Supported;
else version (CppRuntime_GNU) version = Supported;
else version (CppRuntime_LLVM) version = Supported;
version (Supported):

import core.stdcpp.allocator;
Expand Down
6 changes: 3 additions & 3 deletions runtime/druntime/src/core/stdcpp/string_view.d
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@
module core.stdcpp.string_view;

// LDC: empty module for unsupported C++ runtimes
version (CppRuntime_Microsoft) version = Supported;
else version (CppRuntime_Gcc) version = Supported;
else version (CppRuntime_Clang) version = Supported;
version (CppRuntime_Microsoft) version = Supported;
else version (CppRuntime_GNU) version = Supported;
else version (CppRuntime_LLVM) version = Supported;
version (Supported):

import core.stdc.stddef : wchar_t;
Expand Down
4 changes: 2 additions & 2 deletions runtime/druntime/src/rt/dwarfeh.d
Original file line number Diff line number Diff line change
Expand Up @@ -1210,7 +1210,7 @@ int actionTableLookup(_Unwind_Exception* exceptionObject, uint actionRecordPtr,
ClassInfo ci = cast(ClassInfo)cast(void*)(entry);
if (typeid(ci) is typeid(__cpp_type_info_ptr))
{
version (CppRuntime_Gcc)
version (CppRuntime_GNU)
{
if (exceptionClass == cppExceptionClass || exceptionClass == cppExceptionClass1)
{
Expand Down Expand Up @@ -1256,7 +1256,7 @@ void terminate(uint line) @nogc

/****************************** C++ Support *****************************/

version (CppRuntime_Gcc)
version (CppRuntime_GNU)
{
enum _Unwind_Exception_Class cppExceptionClass =
(cast(_Unwind_Exception_Class)'G' << 56) |
Expand Down
2 changes: 1 addition & 1 deletion tests/dmd/runnable_cxx/cppa.d
Original file line number Diff line number Diff line change
Expand Up @@ -949,7 +949,7 @@ version (LDC)
{
version (CRuntime_Microsoft)
version = LDC_CppEH;
else version (CppRuntime_Gcc)
else version (CppRuntime_GNU)
version = LDC_CppEH;
// FIXME: support libc++ too
}
Expand Down

0 comments on commit 4a770ba

Please sign in to comment.