From eb84b8a2bc86aa751ad6f472422e8abad63ff500 Mon Sep 17 00:00:00 2001 From: liushuyu Date: Sat, 23 Sep 2023 12:53:48 -0600 Subject: [PATCH] compiler/test: add tests to test LoongArch-related reserved versions --- compiler/src/dmd/cond.d | 1 + .../test/fail_compilation/reserved_version.d | 98 +++++++++++-------- .../reserved_version_switch.d | 12 +++ .../gcbench/vdparser.extra/vdc/versions.d | 3 + 4 files changed, 71 insertions(+), 43 deletions(-) diff --git a/compiler/src/dmd/cond.d b/compiler/src/dmd/cond.d index f5d7c5e1009b..70a7c882eb31 100644 --- a/compiler/src/dmd/cond.d +++ b/compiler/src/dmd/cond.d @@ -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": diff --git a/compiler/test/fail_compilation/reserved_version.d b/compiler/test/fail_compilation/reserved_version.d index f7a554ce729b..ac00b4d3b500 100644 --- a/compiler/test/fail_compilation/reserved_version.d +++ b/compiler/test/fail_compilation/reserved_version.d @@ -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 --- */ @@ -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; @@ -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; diff --git a/compiler/test/fail_compilation/reserved_version_switch.d b/compiler/test/fail_compilation/reserved_version_switch.d index f5f6b1c9acdd..44db40410289 100644 --- a/compiler/test/fail_compilation/reserved_version_switch.d +++ b/compiler/test/fail_compilation/reserved_version_switch.d @@ -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 @@ -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 @@ -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 diff --git a/druntime/benchmark/gcbench/vdparser.extra/vdc/versions.d b/druntime/benchmark/gcbench/vdparser.extra/vdc/versions.d index 2de8f980083c..f51988292a3b 100644 --- a/druntime/benchmark/gcbench/vdparser.extra/vdc/versions.d +++ b/druntime/benchmark/gcbench/vdparser.extra/vdc/versions.d @@ -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,