Skip to content

Commit

Permalink
compiler/test: add tests to test LoongArch-related reserved versions
Browse files Browse the repository at this point in the history
  • Loading branch information
liushuyu committed Sep 24, 2023
1 parent 099733e commit b4c2424
Show file tree
Hide file tree
Showing 4 changed files with 71 additions and 43 deletions.
1 change: 1 addition & 0 deletions compiler/src/dmd/cond.d
Original file line number Diff line number Diff line change
Expand Up @@ -691,6 +691,7 @@ extern (C++) final class VersionCondition : DVCondition
case "LDC":
case "linux":
case "LittleEndian":
case "LoongArch32":
case "LoongArch64":
case "LoongArch_HardFloat":
case "LoongArch_SoftFloat":
Expand Down
98 changes: 55 additions & 43 deletions compiler/test/fail_compilation/reserved_version.d
Original file line number Diff line number Diff line change
Expand Up @@ -76,49 +76,53 @@ fail_compilation/reserved_version.d(175): Error: version identifier `SH` is rese
fail_compilation/reserved_version.d(176): Error: version identifier `Alpha` is reserved and cannot be set
fail_compilation/reserved_version.d(177): Error: version identifier `Alpha_SoftFloat` is reserved and cannot be set
fail_compilation/reserved_version.d(178): Error: version identifier `Alpha_HardFloat` is reserved and cannot be set
fail_compilation/reserved_version.d(179): Error: version identifier `LittleEndian` is reserved and cannot be set
fail_compilation/reserved_version.d(180): Error: version identifier `BigEndian` is reserved and cannot be set
fail_compilation/reserved_version.d(181): Error: version identifier `ELFv1` is reserved and cannot be set
fail_compilation/reserved_version.d(182): Error: version identifier `ELFv2` is reserved and cannot be set
fail_compilation/reserved_version.d(183): Error: version identifier `CRuntime_Bionic` is reserved and cannot be set
fail_compilation/reserved_version.d(184): Error: version identifier `CRuntime_DigitalMars` is reserved and cannot be set
fail_compilation/reserved_version.d(185): Error: version identifier `CRuntime_Glibc` is reserved and cannot be set
fail_compilation/reserved_version.d(186): Error: version identifier `CRuntime_Microsoft` is reserved and cannot be set
fail_compilation/reserved_version.d(187): Error: version identifier `CRuntime_Musl` is reserved and cannot be set
fail_compilation/reserved_version.d(188): Error: version identifier `CRuntime_Newlib` is reserved and cannot be set
fail_compilation/reserved_version.d(189): Error: version identifier `CRuntime_UClibc` is reserved and cannot be set
fail_compilation/reserved_version.d(190): Error: version identifier `CRuntime_WASI` is reserved and cannot be set
fail_compilation/reserved_version.d(191): Error: version identifier `D_Coverage` is reserved and cannot be set
fail_compilation/reserved_version.d(192): Error: version identifier `D_Ddoc` is reserved and cannot be set
fail_compilation/reserved_version.d(193): Error: version identifier `D_InlineAsm_X86` is reserved and cannot be set
fail_compilation/reserved_version.d(194): Error: version identifier `D_InlineAsm_X86_64` is reserved and cannot be set
fail_compilation/reserved_version.d(195): Error: version identifier `D_LP64` is reserved and cannot be set
fail_compilation/reserved_version.d(196): Error: version identifier `D_X32` is reserved and cannot be set
fail_compilation/reserved_version.d(197): Error: version identifier `D_HardFloat` is reserved and cannot be set
fail_compilation/reserved_version.d(198): Error: version identifier `D_SoftFloat` is reserved and cannot be set
fail_compilation/reserved_version.d(199): Error: version identifier `D_PIC` is reserved and cannot be set
fail_compilation/reserved_version.d(200): Error: version identifier `D_SIMD` is reserved and cannot be set
fail_compilation/reserved_version.d(201): Error: version identifier `D_Version2` is reserved and cannot be set
fail_compilation/reserved_version.d(202): Error: version identifier `D_NoBoundsChecks` is reserved and cannot be set
fail_compilation/reserved_version.d(205): Error: version identifier `all` is reserved and cannot be set
fail_compilation/reserved_version.d(206): Error: version identifier `none` is reserved and cannot be set
fail_compilation/reserved_version.d(207): Error: version identifier `AsmJS` is reserved and cannot be set
fail_compilation/reserved_version.d(208): Error: version identifier `Emscripten` is reserved and cannot be set
fail_compilation/reserved_version.d(209): Error: version identifier `WebAssembly` is reserved and cannot be set
fail_compilation/reserved_version.d(210): Error: version identifier `WASI` is reserved and cannot be set
fail_compilation/reserved_version.d(211): Error: version identifier `CppRuntime_Clang` is reserved and cannot be set
fail_compilation/reserved_version.d(212): Error: version identifier `CppRuntime_DigitalMars` is reserved and cannot be set
fail_compilation/reserved_version.d(213): Error: version identifier `CppRuntime_Gcc` is reserved and cannot be set
fail_compilation/reserved_version.d(214): Error: version identifier `CppRuntime_Microsoft` is reserved and cannot be set
fail_compilation/reserved_version.d(215): Error: version identifier `CppRuntime_Sun` is reserved and cannot be set
fail_compilation/reserved_version.d(216): Error: version identifier `D_PIE` is reserved and cannot be set
fail_compilation/reserved_version.d(217): Error: version identifier `AVR` is reserved and cannot be set
fail_compilation/reserved_version.d(218): Error: version identifier `D_PreConditions` is reserved and cannot be set
fail_compilation/reserved_version.d(219): Error: version identifier `D_PostConditions` is reserved and cannot be set
fail_compilation/reserved_version.d(220): Error: version identifier `D_ProfileGC` is reserved and cannot be set
fail_compilation/reserved_version.d(221): Error: version identifier `D_Invariants` is reserved and cannot be set
fail_compilation/reserved_version.d(222): Error: version identifier `D_Optimized` is reserved and cannot be set
fail_compilation/reserved_version.d(223): Error: version identifier `VisionOS` is reserved and cannot be set
fail_compilation/reserved_version.d(179): Error: version identifier `LoongArch32` is reserved and cannot be set
fail_compilation/reserved_version.d(180): Error: version identifier `LoongArch64` is reserved and cannot be set
fail_compilation/reserved_version.d(181): Error: version identifier `LoongArch_HardFloat` is reserved and cannot be set
fail_compilation/reserved_version.d(182): Error: version identifier `LoongArch_SoftFloat` is reserved and cannot be set
fail_compilation/reserved_version.d(183): Error: version identifier `LittleEndian` is reserved and cannot be set
fail_compilation/reserved_version.d(184): Error: version identifier `BigEndian` is reserved and cannot be set
fail_compilation/reserved_version.d(185): Error: version identifier `ELFv1` is reserved and cannot be set
fail_compilation/reserved_version.d(186): Error: version identifier `ELFv2` is reserved and cannot be set
fail_compilation/reserved_version.d(187): Error: version identifier `CRuntime_Bionic` is reserved and cannot be set
fail_compilation/reserved_version.d(188): Error: version identifier `CRuntime_DigitalMars` is reserved and cannot be set
fail_compilation/reserved_version.d(189): Error: version identifier `CRuntime_Glibc` is reserved and cannot be set
fail_compilation/reserved_version.d(190): Error: version identifier `CRuntime_Microsoft` is reserved and cannot be set
fail_compilation/reserved_version.d(191): Error: version identifier `CRuntime_Musl` is reserved and cannot be set
fail_compilation/reserved_version.d(192): Error: version identifier `CRuntime_Newlib` is reserved and cannot be set
fail_compilation/reserved_version.d(193): Error: version identifier `CRuntime_UClibc` is reserved and cannot be set
fail_compilation/reserved_version.d(194): Error: version identifier `CRuntime_WASI` is reserved and cannot be set
fail_compilation/reserved_version.d(195): Error: version identifier `D_Coverage` is reserved and cannot be set
fail_compilation/reserved_version.d(196): Error: version identifier `D_Ddoc` is reserved and cannot be set
fail_compilation/reserved_version.d(197): Error: version identifier `D_InlineAsm_X86` is reserved and cannot be set
fail_compilation/reserved_version.d(198): Error: version identifier `D_InlineAsm_X86_64` is reserved and cannot be set
fail_compilation/reserved_version.d(199): Error: version identifier `D_LP64` is reserved and cannot be set
fail_compilation/reserved_version.d(200): Error: version identifier `D_X32` is reserved and cannot be set
fail_compilation/reserved_version.d(201): Error: version identifier `D_HardFloat` is reserved and cannot be set
fail_compilation/reserved_version.d(202): Error: version identifier `D_SoftFloat` is reserved and cannot be set
fail_compilation/reserved_version.d(203): Error: version identifier `D_PIC` is reserved and cannot be set
fail_compilation/reserved_version.d(204): Error: version identifier `D_SIMD` is reserved and cannot be set
fail_compilation/reserved_version.d(205): Error: version identifier `D_Version2` is reserved and cannot be set
fail_compilation/reserved_version.d(206): Error: version identifier `D_NoBoundsChecks` is reserved and cannot be set
fail_compilation/reserved_version.d(209): Error: version identifier `all` is reserved and cannot be set
fail_compilation/reserved_version.d(210): Error: version identifier `none` is reserved and cannot be set
fail_compilation/reserved_version.d(211): Error: version identifier `AsmJS` 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(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(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(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
fail_compilation/reserved_version.d(221): Error: version identifier `AVR` is reserved and cannot be set
fail_compilation/reserved_version.d(222): Error: version identifier `D_PreConditions` is reserved and cannot be set
fail_compilation/reserved_version.d(223): Error: version identifier `D_PostConditions` is reserved and cannot be set
fail_compilation/reserved_version.d(224): Error: version identifier `D_ProfileGC` is reserved and cannot be set
fail_compilation/reserved_version.d(225): Error: version identifier `D_Invariants` is reserved and cannot be set
fail_compilation/reserved_version.d(226): Error: version identifier `D_Optimized` is reserved and cannot be set
fail_compilation/reserved_version.d(227): Error: version identifier `VisionOS` is reserved and cannot be set
---
*/

Expand Down Expand Up @@ -199,6 +203,10 @@ version = SH;
version = Alpha;
version = Alpha_SoftFloat;
version = Alpha_HardFloat;
version = LoongArch32;
version = LoongArch64;
version = LoongArch_HardFloat;
version = LoongArch_SoftFloat;
version = LittleEndian;
version = BigEndian;
version = ELFv1;
Expand Down Expand Up @@ -315,6 +323,10 @@ debug = WASI;
debug = Alpha;
debug = Alpha_SoftFloat;
debug = Alpha_HardFloat;
debug = LoongArch32;
debug = LoongArch64;
debug = LoongArch_HardFloat;
debug = LoongArch_SoftFloat;
debug = LittleEndian;
debug = BigEndian;
debug = ELFv1;
Expand Down
12 changes: 12 additions & 0 deletions compiler/test/fail_compilation/reserved_version_switch.d
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,10 @@
// REQUIRED_ARGS: -version=Alpha
// REQUIRED_ARGS: -version=Alpha_SoftFloat
// REQUIRED_ARGS: -version=Alpha_HardFloat
// REQUIRED_ARGS: -version=LoongArch32
// REQUIRED_ARGS: -version=LoongArch64
// REQUIRED_ARGS: -version=LoongArch_HardFloat
// REQUIRED_ARGS: -version=LoongArch_SoftFloat
// REQUIRED_ARGS: -version=LittleEndian
// REQUIRED_ARGS: -version=BigEndian
// REQUIRED_ARGS: -version=ELFv1
Expand Down Expand Up @@ -175,6 +179,10 @@
// REQUIRED_ARGS: -debug=Alpha
// REQUIRED_ARGS: -debug=Alpha_SoftFloat
// REQUIRED_ARGS: -debug=Alpha_HardFloat
// REQUIRED_ARGS: -debug=LoongArch32
// REQUIRED_ARGS: -debug=LoongArch64
// REQUIRED_ARGS: -debug=LoongArch_HardFloat
// REQUIRED_ARGS: -debug=LoongArch_SoftFloat
// REQUIRED_ARGS: -debug=LittleEndian
// REQUIRED_ARGS: -debug=BigEndian
// REQUIRED_ARGS: -debug=ELFv1
Expand Down Expand Up @@ -286,6 +294,10 @@ Error: version identifier `WASI` is reserved and cannot be set
Error: version identifier `Alpha` is reserved and cannot be set
Error: version identifier `Alpha_SoftFloat` is reserved and cannot be set
Error: version identifier `Alpha_HardFloat` is reserved and cannot be set
Error: version identifier `LoongArch32` is reserved and cannot be set
Error: version identifier `LoongArch64` is reserved and cannot be set
Error: version identifier `LoongArch_HardFloat` is reserved and cannot be set
Error: version identifier `LoongArch_SoftFloat` is reserved and cannot be set
Error: version identifier `LittleEndian` is reserved and cannot be set
Error: version identifier `BigEndian` is reserved and cannot be set
Error: version identifier `ELFv1` is reserved and cannot be set
Expand Down
3 changes: 3 additions & 0 deletions druntime/benchmark/gcbench/vdparser.extra/vdc/versions.d
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,9 @@ static @property int[string] sPredefinedVersions()
"Alpha" : -1,
"Alpha_SoftFloat" : -1,
"Alpha_HardFloat" : -1,
"LoongArch64": -1,
"LoongArch_HardFloat": -1,
"LoongArch_SoftFloat": -1,

"LittleEndian" : 1,
"BigEndian" : -1,
Expand Down

0 comments on commit b4c2424

Please sign in to comment.