Fix bugzilla issue 24623: Rename CppRuntime_Clang/Gcc to CppRuntime_libcpp/libstdcpp. Add libcpp and libstdcpp -target= option recognition.

This commit is contained in:
Johan Engelen 2024-06-22 11:38:46 +02:00
parent 1d8f290318
commit 349b493810
21 changed files with 75 additions and 62 deletions

View file

@ -659,9 +659,9 @@ extern (C++) final class VersionCondition : DVCondition
case "AVR":
case "BigEndian":
case "BSD":
case "CppRuntime_Clang":
case "CppRuntime_libcpp":
case "CppRuntime_DigitalMars":
case "CppRuntime_Gcc":
case "CppRuntime_libstdcpp":
case "CppRuntime_Microsoft":
case "CppRuntime_Sun":
case "CRuntime_Bionic":

View file

@ -298,8 +298,10 @@ struct Triple
{
with (TargetCPP.Runtime) switch (cppenv)
{
case "clang": return Clang;
case "gcc": return Gcc;
case "libcpp": return libcpp;
case "libstdcpp": return libstdcpp;
case "clang": return libcpp; // legacy option
case "gcc": return libstdcpp; // legacy option
case "msvc": return Microsoft;
case "sun": return Sun;
default:

View file

@ -268,11 +268,22 @@ void addCppRuntimePredefinedGlobalIdent(const ref TargetCPP cpp)
with (TargetCPP.Runtime) switch (cpp.runtime)
{
default:
case Unspecified: return;
case Clang: return predef("CppRuntime_Clang");
case Gcc: return predef("CppRuntime_Gcc");
case Microsoft: return predef("CppRuntime_Microsoft");
case Sun: return predef("CppRuntime_Sun");
case Unspecified:
return;
case libcpp:
predef("CppRuntime_libcpp");
predef("CppRuntime_Clang"); // legacy
return;
case libstdcpp:
predef("CppRuntime_libstdcpp");
predef("CppRuntime_Gcc"); // legacy
return;
case Microsoft:
predef("CppRuntime_Microsoft");
return;
case Sun:
predef("CppRuntime_Sun");
return;
}
}
@ -1454,8 +1465,8 @@ struct TargetCPP
enum Runtime : ubyte
{
Unspecified,
Clang,
Gcc,
libcpp,
libstdcpp,
Microsoft,
Sun
}
@ -1484,11 +1495,11 @@ struct TargetCPP
if (os == Target.OS.Windows)
runtime = Runtime.Microsoft;
else if (os & (Target.OS.linux | Target.OS.DragonFlyBSD))
runtime = Runtime.Gcc;
runtime = Runtime.libstdcpp;
else if (os & (Target.OS.OSX | Target.OS.FreeBSD | Target.OS.OpenBSD))
runtime = Runtime.Clang;
runtime = Runtime.libcpp;
else if (os == Target.OS.Solaris)
runtime = Runtime.Gcc;
runtime = Runtime.libstdcpp;
else
assert(0);
// C++ and D ABI incompatible on all (?) x86 32-bit platforms

View file

@ -7,8 +7,8 @@
import core.stdc.stdio;
version (CppRuntime_Clang) version = CppMangle_Itanium;
version (CppRuntime_Gcc) version = CppMangle_Itanium;
version (CppRuntime_libcpp) version = CppMangle_Itanium;
version (CppRuntime_libstdcpp) version = CppMangle_Itanium;
version (CppRuntime_Microsoft) version = CppMangle_MSVC;
version (CppRuntime_Sun) version = CppMangle_Itanium;

View file

@ -3,8 +3,8 @@
// https://issues.dlang.org/show_bug.cgi?id=19920
module cppmangle3;
version (CppRuntime_Clang) version = CppMangle_Itanium;
version (CppRuntime_Gcc) version = CppMangle_Itanium;
version (CppRuntime_libcpp) version = CppMangle_Itanium;
version (CppRuntime_libstdcpp) version = CppMangle_Itanium;
version (CppRuntime_Microsoft) version = CppMangle_MSVC;
version (CppRuntime_Sun) version = CppMangle_Itanium;

View file

@ -1,5 +1,5 @@
version (CppRuntime_Clang) version = CppMangle_Itanium;
version (CppRuntime_Gcc) version = CppMangle_Itanium;
version (CppRuntime_libcpp) version = CppMangle_Itanium;
version (CppRuntime_libstdcpp) version = CppMangle_Itanium;
version (CppRuntime_Sun) version = CppMangle_Itanium;
template ScopeClass(C , string name = C.stringof)

View file

@ -1,5 +1,5 @@
version (CppRuntime_Clang) version = CppMangle_Itanium;
version (CppRuntime_Gcc) version = CppMangle_Itanium;
version (CppRuntime_libcpp) version = CppMangle_Itanium;
version (CppRuntime_libstdcpp) version = CppMangle_Itanium;
version (CppRuntime_Sun) version = CppMangle_Itanium;
template ScopeClass(C)

View file

@ -110,9 +110,9 @@ fail_compilation/reserved_version.d(211): Error: version identifier `AsmJS` is r
fail_compilation/reserved_version.d(212): Error: version identifier `Emscripten` is reserved and cannot be set
fail_compilation/reserved_version.d(213): Error: version identifier `WebAssembly` is reserved and cannot be set
fail_compilation/reserved_version.d(214): Error: version identifier `WASI` is reserved and cannot be set
fail_compilation/reserved_version.d(215): Error: version identifier `CppRuntime_Clang` is reserved and cannot be set
fail_compilation/reserved_version.d(215): Error: version identifier `CppRuntime_libcpp` is reserved and cannot be set
fail_compilation/reserved_version.d(216): Error: version identifier `CppRuntime_DigitalMars` is reserved and cannot be set
fail_compilation/reserved_version.d(217): Error: version identifier `CppRuntime_Gcc` is reserved and cannot be set
fail_compilation/reserved_version.d(217): Error: version identifier `CppRuntime_libstdcpp` is reserved and cannot be set
fail_compilation/reserved_version.d(218): Error: version identifier `CppRuntime_Microsoft` is reserved and cannot be set
fail_compilation/reserved_version.d(219): Error: version identifier `CppRuntime_Sun` is reserved and cannot be set
fail_compilation/reserved_version.d(220): Error: version identifier `D_PIE` is reserved and cannot be set
@ -239,9 +239,9 @@ version = AsmJS;
version = Emscripten;
version = WebAssembly;
version = WASI;
version = CppRuntime_Clang;
version = CppRuntime_libcpp;
version = CppRuntime_DigitalMars;
version = CppRuntime_Gcc;
version = CppRuntime_libstdcpp;
version = CppRuntime_Microsoft;
version = CppRuntime_Sun;
version = D_PIE;
@ -339,9 +339,9 @@ debug = CRuntime_Musl;
debug = CRuntime_Newlib;
debug = CRuntime_UClibc;
debug = CRuntime_WASI;
debug = CppRuntime_Clang;
debug = CppRuntime_libcpp;
debug = CppRuntime_DigitalMars;
debug = CppRuntime_Gcc;
debug = CppRuntime_libstdcpp;
debug = CppRuntime_Microsoft;
debug = CppRuntime_Sun;
debug = D_Coverage;

View file

@ -86,9 +86,9 @@
// REQUIRED_ARGS: -version=CRuntime_Newlib
// REQUIRED_ARGS: -version=CRuntime_UClibc
// REQUIRED_ARGS: -version=CRuntime_WASI
// REQUIRED_ARGS: -version=CppRuntime_Clang
// REQUIRED_ARGS: -version=CppRuntime_libcpp
// REQUIRED_ARGS: -version=CppRuntime_DigitalMars
// REQUIRED_ARGS: -version=CppRuntime_Gcc
// REQUIRED_ARGS: -version=CppRuntime_libstdcpp
// REQUIRED_ARGS: -version=CppRuntime_Microsoft
// REQUIRED_ARGS: -version=CppRuntime_Sun
// REQUIRED_ARGS: -version=D_Coverage
@ -195,9 +195,9 @@
// REQUIRED_ARGS: -debug=CRuntime_Newlib
// REQUIRED_ARGS: -debug=CRuntime_UClibc
// REQUIRED_ARGS: -debug=CRuntime_WASI
// REQUIRED_ARGS: -debug=CppRuntime_Clang
// REQUIRED_ARGS: -debug=CppRuntime_libcpp
// REQUIRED_ARGS: -debug=CppRuntime_DigitalMars
// REQUIRED_ARGS: -debug=CppRuntime_Gcc
// REQUIRED_ARGS: -debug=CppRuntime_libstdcpp
// REQUIRED_ARGS: -debug=CppRuntime_Microsoft
// REQUIRED_ARGS: -debug=CppRuntime_Sun
// REQUIRED_ARGS: -debug=D_Coverage
@ -310,9 +310,9 @@ Error: version identifier `CRuntime_Musl` is reserved and cannot be set
Error: version identifier `CRuntime_Newlib` is reserved and cannot be set
Error: version identifier `CRuntime_UClibc` is reserved and cannot be set
Error: version identifier `CRuntime_WASI` is reserved and cannot be set
Error: version identifier `CppRuntime_Clang` is reserved and cannot be set
Error: version identifier `CppRuntime_libcpp` is reserved and cannot be set
Error: version identifier `CppRuntime_DigitalMars` is reserved and cannot be set
Error: version identifier `CppRuntime_Gcc` is reserved and cannot be set
Error: version identifier `CppRuntime_libstdcpp` is reserved and cannot be set
Error: version identifier `CppRuntime_Microsoft` is reserved and cannot be set
Error: version identifier `CppRuntime_Sun` is reserved and cannot be set
Error: version identifier `D_Coverage` is reserved and cannot be set

View file

@ -5,7 +5,7 @@ import core.stdc.stdio;
// Disabled on windows because it needs bindings
version (CppRuntime_Clang)
version (CppRuntime_libcpp)
{
extern(C++, `std`, `__1`)
{

View file

@ -455,7 +455,7 @@ extern (C++, std)
{
}
version (CppRuntime_Gcc)
version (CppRuntime_libstdcpp)
{
// https://gcc.gnu.org/onlinedocs/libstdc++/manual/using_dual_abi.html
static if (__traits(getTargetInfo, "cppStd") >= 201103)

View file

@ -212,9 +212,9 @@ immutable(EnvData) processEnvironment()
{
case "dmd":
case "ldc":
version (CppRuntime_Gcc)
version (CppRuntime_libstdcpp)
envData.cxxCompatFlags = " -L-lstdc++ -L--no-demangle";
else version (CppRuntime_Clang)
else version (CppRuntime_libcpp)
envData.cxxCompatFlags = " -L-lc++ -L--no-demangle";
break;

View file

@ -37,14 +37,14 @@ unittest
assert(triple.cpu == CPU.avx2);
}
@("-target=x86_64-unknown-linux-musl-clang")
@("-target=x86_64-unknown-linux-musl-libcpp")
unittest
{
auto triple = Triple("x86_64-unknown-linux-musl-clang");
auto triple = Triple("x86_64-unknown-linux-musl-libcpp");
assert(triple.isX86_64 == true);
assert(triple.os == Target.OS.linux);
assert(triple.cenv == TargetC.Runtime.Musl);
assert(triple.cppenv == TargetCPP.Runtime.Clang);
assert(triple.cppenv == TargetCPP.Runtime.libcpp);
}
@("-target=x86_64-freebsd12")

View file

@ -147,7 +147,7 @@ extern(D):
///
enum size_t max_size = size_t.max / T.sizeof;
}
else version (CppRuntime_Gcc)
else version (CppRuntime_libstdcpp)
{
///
T* allocate(size_t count, const(void)* = null) @nogc
@ -174,7 +174,7 @@ extern(D):
///
enum size_t max_size = (ptrdiff_t.max < size_t.max ? cast(size_t)ptrdiff_t.max : size_t.max) / T.sizeof;
}
else version (CppRuntime_Clang)
else version (CppRuntime_libcpp)
{
///
T* allocate(size_t count, const(void)* = null) @nogc
@ -360,7 +360,7 @@ version (CppRuntime_Microsoft)
}
}
}
version (CppRuntime_Clang)
version (CppRuntime_libcpp)
{
// Helper for container swap
package(core.stdcpp) void __swap_allocator(Alloc)(ref Alloc __a1, ref Alloc __a2)

View file

@ -74,7 +74,7 @@ pure nothrow @nogc:
private:
T[N ? N : 1] _Elems;
}
else version (CppRuntime_Gcc)
else version (CppRuntime_libstdcpp)
{
///
inout(T)* data() inout @safe { static if (N > 0) { return &_M_elems[0]; } else { return null; } }
@ -94,7 +94,7 @@ pure nothrow @nogc:
_Placeholder _M_placeholder;
}
}
else version (CppRuntime_Clang)
else version (CppRuntime_libcpp)
{
///
inout(T)* data() inout @trusted { static if (N > 0) { return &__elems_[0]; } else { return cast(inout(T)*)__elems_.ptr; } }

View file

@ -15,9 +15,9 @@ module core.stdcpp.exception;
import core.stdcpp.xutility : __cplusplus, CppStdRevision;
import core.attribute : weak;
version (CppRuntime_Gcc)
version (CppRuntime_libstdcpp)
version = GenericBaseException;
version (CppRuntime_Clang)
version (CppRuntime_libcpp)
version = GenericBaseException;
version (CppRuntime_Sun)
version = GenericBaseException;

View file

@ -123,7 +123,7 @@ nothrow pure @safe @nogc:
_Compressed_pair!(Deleter, pointer) _Mypair;
}
else version (CppRuntime_Gcc)
else version (CppRuntime_libstdcpp)
{
///
ref inout(deleter_type) get_deleter() inout nothrow { return _M_t.get!1; }
@ -136,7 +136,7 @@ nothrow pure @safe @nogc:
tuple!(pointer, Deleter) _M_t;
}
else version (CppRuntime_Clang)
else version (CppRuntime_libcpp)
{
///
ref inout(deleter_type) get_deleter() inout nothrow { return __ptr_.second; }

View file

@ -31,7 +31,7 @@ version (Darwin)
version = _LIBCPP_ABI_ALTERNATE_STRING_LAYOUT;
}
version (CppRuntime_Gcc)
version (CppRuntime_libstdcpp)
{
version (_GLIBCXX_USE_CXX98_ABI)
{
@ -894,7 +894,7 @@ extern(D):
_String_alloc!(_String_base_types!(T, Alloc)) _Base;
}
else version (CppRuntime_Gcc)
else version (CppRuntime_libstdcpp)
{
version (_GLIBCXX_USE_CXX98_ABI)
{
@ -1873,10 +1873,10 @@ extern(D):
__d[0 .. __n] = __s[0 .. __n];
}
}
else version (CppRuntime_Clang)
else version (CppRuntime_libcpp)
{
//----------------------------------------------------------------------------------
// Clang/libc++ implementation
// libc++ implementation
//----------------------------------------------------------------------------------
///

View file

@ -99,7 +99,7 @@ private:
alias __data = _Mydata;
alias __size = _Mysize;
}
else version (CppRuntime_Gcc)
else version (CppRuntime_libstdcpp)
{
size_t _M_len;
const(T)* _M_str;
@ -107,7 +107,7 @@ private:
alias __data = _M_str;
alias __size = _M_len;
}
else version (CppRuntime_Clang)
else version (CppRuntime_libcpp)
{
const value_type* __data;
size_type __size;

View file

@ -56,7 +56,7 @@ version (CppRuntime_Microsoft)
//virtual ~this();
}
}
else version (CppRuntime_Gcc)
else version (CppRuntime_libstdcpp)
{
import core.stdcpp.exception;
@ -110,7 +110,7 @@ else version (CppRuntime_Gcc)
@weak override const(char)* what() const nothrow { return "bad typeid"; }
}
}
else version (CppRuntime_Clang)
else version (CppRuntime_libcpp)
{
import core.stdcpp.exception;

View file

@ -13,7 +13,7 @@ module core.stdcpp.xutility;
@nogc:
version (CppRuntime_Clang)
version (CppRuntime_libcpp)
{
import core.internal.traits : AliasSeq;
enum StdNamespace = AliasSeq!("std", "__1");
@ -349,7 +349,7 @@ package:
void _Xoverflow_error(const(char)* message) nothrow;
void _Xruntime_error(const(char)* message) nothrow;
}
else version (CppRuntime_Clang)
else version (CppRuntime_libcpp)
{
import core.stdcpp.type_traits : is_empty;
@ -379,7 +379,7 @@ extern(C++, "std"):
@property ref inout(_T2) __value2_() inout nothrow @trusted @nogc { return *__get_base2(); }
}
}
version (CppRuntime_Gcc)
version (CppRuntime_libstdcpp)
{
import core.atomic;