Fix bugzilla issue 24623 followup.

Rename CppRuntime to _LLVM and _GNU
Also accept c++ for cxx in target string.
This commit is contained in:
Johan Engelen 2024-06-22 18:56:16 +02:00 committed by The Dlang Bot
parent 748bc7d8ad
commit b5130fd880
23 changed files with 77 additions and 65 deletions

View file

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

View file

@ -298,10 +298,12 @@ struct Triple
{ {
with (TargetCPP.Runtime) switch (cppenv) with (TargetCPP.Runtime) switch (cppenv)
{ {
case "libcpp": return libcpp; case "libc++": return LLVM;
case "libstdcpp": return libstdcpp; case "libstdc++": return GNU;
case "clang": return libcpp; // legacy option case "libcxx": return LLVM;
case "gcc": return libstdcpp; // legacy option case "libstdcxx": return GNU;
case "clang": return LLVM; // legacy option
case "gcc": return GNU; // legacy option
case "msvc": return Microsoft; case "msvc": return Microsoft;
case "sun": return Sun; case "sun": return Sun;
default: default:

View file

@ -5994,8 +5994,8 @@ struct TargetCPP final
enum class Runtime : uint8_t enum class Runtime : uint8_t
{ {
Unspecified = 0u, Unspecified = 0u,
libcpp = 1u, LLVM = 1u,
libstdcpp = 2u, GNU = 2u,
Microsoft = 3u, Microsoft = 3u,
Sun = 4u, Sun = 4u,
}; };

View file

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

View file

@ -84,8 +84,8 @@ struct TargetCPP
enum class Runtime : unsigned char enum class Runtime : unsigned char
{ {
Unspecified, Unspecified,
libcpp, LLVM,
libstdcpp, GNU,
Microsoft, Microsoft,
Sun Sun
}; };

View file

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

View file

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

View file

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

View file

@ -1,5 +1,5 @@
version (CppRuntime_libcpp) version = CppMangle_Itanium; version (CppRuntime_LLVM) version = CppMangle_Itanium;
version (CppRuntime_libstdcpp) version = CppMangle_Itanium; version (CppRuntime_GNU) version = CppMangle_Itanium;
version (CppRuntime_Sun) version = CppMangle_Itanium; version (CppRuntime_Sun) version = CppMangle_Itanium;
template ScopeClass(C) 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(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(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(214): Error: version identifier `WASI` 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(215): Error: version identifier `CppRuntime_LLVM` 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(216): Error: version identifier `CppRuntime_DigitalMars` 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(217): Error: version identifier `CppRuntime_GNU` 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(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(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 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 = Emscripten;
version = WebAssembly; version = WebAssembly;
version = WASI; version = WASI;
version = CppRuntime_libcpp; version = CppRuntime_LLVM;
version = CppRuntime_DigitalMars; version = CppRuntime_DigitalMars;
version = CppRuntime_libstdcpp; version = CppRuntime_GNU;
version = CppRuntime_Microsoft; version = CppRuntime_Microsoft;
version = CppRuntime_Sun; version = CppRuntime_Sun;
version = D_PIE; version = D_PIE;
@ -339,9 +339,9 @@ debug = CRuntime_Musl;
debug = CRuntime_Newlib; debug = CRuntime_Newlib;
debug = CRuntime_UClibc; debug = CRuntime_UClibc;
debug = CRuntime_WASI; debug = CRuntime_WASI;
debug = CppRuntime_libcpp; debug = CppRuntime_LLVM;
debug = CppRuntime_DigitalMars; debug = CppRuntime_DigitalMars;
debug = CppRuntime_libstdcpp; debug = CppRuntime_GNU;
debug = CppRuntime_Microsoft; debug = CppRuntime_Microsoft;
debug = CppRuntime_Sun; debug = CppRuntime_Sun;
debug = D_Coverage; debug = D_Coverage;

View file

@ -86,9 +86,9 @@
// REQUIRED_ARGS: -version=CRuntime_Newlib // REQUIRED_ARGS: -version=CRuntime_Newlib
// REQUIRED_ARGS: -version=CRuntime_UClibc // REQUIRED_ARGS: -version=CRuntime_UClibc
// REQUIRED_ARGS: -version=CRuntime_WASI // REQUIRED_ARGS: -version=CRuntime_WASI
// REQUIRED_ARGS: -version=CppRuntime_libcpp // REQUIRED_ARGS: -version=CppRuntime_LLVM
// REQUIRED_ARGS: -version=CppRuntime_DigitalMars // REQUIRED_ARGS: -version=CppRuntime_DigitalMars
// REQUIRED_ARGS: -version=CppRuntime_libstdcpp // REQUIRED_ARGS: -version=CppRuntime_GNU
// REQUIRED_ARGS: -version=CppRuntime_Microsoft // REQUIRED_ARGS: -version=CppRuntime_Microsoft
// REQUIRED_ARGS: -version=CppRuntime_Sun // REQUIRED_ARGS: -version=CppRuntime_Sun
// REQUIRED_ARGS: -version=D_Coverage // REQUIRED_ARGS: -version=D_Coverage
@ -195,9 +195,9 @@
// REQUIRED_ARGS: -debug=CRuntime_Newlib // REQUIRED_ARGS: -debug=CRuntime_Newlib
// REQUIRED_ARGS: -debug=CRuntime_UClibc // REQUIRED_ARGS: -debug=CRuntime_UClibc
// REQUIRED_ARGS: -debug=CRuntime_WASI // REQUIRED_ARGS: -debug=CRuntime_WASI
// REQUIRED_ARGS: -debug=CppRuntime_libcpp // REQUIRED_ARGS: -debug=CppRuntime_LLVM
// REQUIRED_ARGS: -debug=CppRuntime_DigitalMars // REQUIRED_ARGS: -debug=CppRuntime_DigitalMars
// REQUIRED_ARGS: -debug=CppRuntime_libstdcpp // REQUIRED_ARGS: -debug=CppRuntime_GNU
// REQUIRED_ARGS: -debug=CppRuntime_Microsoft // REQUIRED_ARGS: -debug=CppRuntime_Microsoft
// REQUIRED_ARGS: -debug=CppRuntime_Sun // REQUIRED_ARGS: -debug=CppRuntime_Sun
// REQUIRED_ARGS: -debug=D_Coverage // 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_Newlib` is reserved and cannot be set
Error: version identifier `CRuntime_UClibc` 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 `CRuntime_WASI` is reserved and cannot be set
Error: version identifier `CppRuntime_libcpp` is reserved and cannot be set Error: version identifier `CppRuntime_LLVM` is reserved and cannot be set
Error: version identifier `CppRuntime_DigitalMars` is reserved and cannot be set Error: version identifier `CppRuntime_DigitalMars` is reserved and cannot be set
Error: version identifier `CppRuntime_libstdcpp` is reserved and cannot be set Error: version identifier `CppRuntime_GNU` is reserved and cannot be set
Error: version identifier `CppRuntime_Microsoft` 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 `CppRuntime_Sun` is reserved and cannot be set
Error: version identifier `D_Coverage` 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 // Disabled on windows because it needs bindings
version (CppRuntime_libcpp) version (CppRuntime_LLVM)
{ {
extern(C++, `std`, `__1`) extern(C++, `std`, `__1`)
{ {

View file

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

View file

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

View file

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

View file

@ -147,7 +147,7 @@ extern(D):
/// ///
enum size_t max_size = size_t.max / T.sizeof; enum size_t max_size = size_t.max / T.sizeof;
} }
else version (CppRuntime_libstdcpp) else version (CppRuntime_GNU)
{ {
/// ///
T* allocate(size_t count, const(void)* = null) @nogc 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; 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_libcpp) else version (CppRuntime_LLVM)
{ {
/// ///
T* allocate(size_t count, const(void)* = null) @nogc T* allocate(size_t count, const(void)* = null) @nogc
@ -360,7 +360,7 @@ version (CppRuntime_Microsoft)
} }
} }
} }
version (CppRuntime_libcpp) version (CppRuntime_LLVM)
{ {
// Helper for container swap // Helper for container swap
package(core.stdcpp) void __swap_allocator(Alloc)(ref Alloc __a1, ref Alloc __a2) package(core.stdcpp) void __swap_allocator(Alloc)(ref Alloc __a1, ref Alloc __a2)

View file

@ -74,7 +74,7 @@ pure nothrow @nogc:
private: private:
T[N ? N : 1] _Elems; T[N ? N : 1] _Elems;
} }
else version (CppRuntime_libstdcpp) else version (CppRuntime_GNU)
{ {
/// ///
inout(T)* data() inout @safe { static if (N > 0) { return &_M_elems[0]; } else { return null; } } 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; _Placeholder _M_placeholder;
} }
} }
else version (CppRuntime_libcpp) else version (CppRuntime_LLVM)
{ {
/// ///
inout(T)* data() inout @trusted { static if (N > 0) { return &__elems_[0]; } else { return cast(inout(T)*)__elems_.ptr; } } 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.stdcpp.xutility : __cplusplus, CppStdRevision;
import core.attribute : weak; import core.attribute : weak;
version (CppRuntime_libstdcpp) version (CppRuntime_GNU)
version = GenericBaseException; version = GenericBaseException;
version (CppRuntime_libcpp) version (CppRuntime_LLVM)
version = GenericBaseException; version = GenericBaseException;
version (CppRuntime_Sun) version (CppRuntime_Sun)
version = GenericBaseException; version = GenericBaseException;

View file

@ -123,7 +123,7 @@ nothrow pure @safe @nogc:
_Compressed_pair!(Deleter, pointer) _Mypair; _Compressed_pair!(Deleter, pointer) _Mypair;
} }
else version (CppRuntime_libstdcpp) else version (CppRuntime_GNU)
{ {
/// ///
ref inout(deleter_type) get_deleter() inout nothrow { return _M_t.get!1; } 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; tuple!(pointer, Deleter) _M_t;
} }
else version (CppRuntime_libcpp) else version (CppRuntime_LLVM)
{ {
/// ///
ref inout(deleter_type) get_deleter() inout nothrow { return __ptr_.second; } 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 = _LIBCPP_ABI_ALTERNATE_STRING_LAYOUT;
} }
version (CppRuntime_libstdcpp) version (CppRuntime_GNU)
{ {
version (_GLIBCXX_USE_CXX98_ABI) version (_GLIBCXX_USE_CXX98_ABI)
{ {
@ -894,7 +894,7 @@ extern(D):
_String_alloc!(_String_base_types!(T, Alloc)) _Base; _String_alloc!(_String_base_types!(T, Alloc)) _Base;
} }
else version (CppRuntime_libstdcpp) else version (CppRuntime_GNU)
{ {
version (_GLIBCXX_USE_CXX98_ABI) version (_GLIBCXX_USE_CXX98_ABI)
{ {
@ -1873,7 +1873,7 @@ extern(D):
__d[0 .. __n] = __s[0 .. __n]; __d[0 .. __n] = __s[0 .. __n];
} }
} }
else version (CppRuntime_libcpp) else version (CppRuntime_LLVM)
{ {
//---------------------------------------------------------------------------------- //----------------------------------------------------------------------------------
// libc++ implementation // libc++ implementation

View file

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

View file

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

View file

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