diff options
| author | Juan Aguilar Santillana <mhpoin@gmail.com> | 2019-02-03 20:20:08 +0100 |
|---|---|---|
| committer | gnzlbg <gnzlbg@users.noreply.github.com> | 2019-02-04 12:37:48 +0100 |
| commit | e51ee17aa79ec4ccb2901ba128819bfccd5af651 (patch) | |
| tree | a70297aa92172c5adf9e63c70b2f50cc5b791f89 /library/stdarch/crates/std_detect/src | |
| parent | d226e329845ee3012793e11b684e980b77858ae2 (diff) | |
| download | rust-e51ee17aa79ec4ccb2901ba128819bfccd5af651.tar.gz rust-e51ee17aa79ec4ccb2901ba128819bfccd5af651.zip | |
Add detect macros should support trailing commas (Fix #443)
Diffstat (limited to 'library/stdarch/crates/std_detect/src')
7 files changed, 21 insertions, 0 deletions
diff --git a/library/stdarch/crates/std_detect/src/detect/arch/aarch64.rs b/library/stdarch/crates/std_detect/src/detect/arch/aarch64.rs index 882c22cc174..7571dfbfec3 100644 --- a/library/stdarch/crates/std_detect/src/detect/arch/aarch64.rs +++ b/library/stdarch/crates/std_detect/src/detect/arch/aarch64.rs @@ -66,6 +66,9 @@ macro_rules! is_aarch64_feature_detected { ("v8.3a") => { compile_error!("\"v8.3a\" feature cannot be detected at run-time") }; + ($t:tt,) => { + is_aarch64_feature_detected!($t); + }; ($t:tt) => { compile_error!(concat!("unknown aarch64 target feature: ", $t)) }; } diff --git a/library/stdarch/crates/std_detect/src/detect/arch/arm.rs b/library/stdarch/crates/std_detect/src/detect/arch/arm.rs index cb6ac6badcc..5f91c9269ad 100644 --- a/library/stdarch/crates/std_detect/src/detect/arch/arm.rs +++ b/library/stdarch/crates/std_detect/src/detect/arch/arm.rs @@ -17,6 +17,9 @@ macro_rules! is_arm_feature_detected { ("vfp2") => { compile_error!("\"vfp2\" feature cannot be detected at run-time") }; ("vfp3") => { compile_error!("\"vfp3\" feature cannot be detected at run-time") }; ("vfp4") => { compile_error!("\"vfp4\" feature cannot be detected at run-time") }; + ($t:tt,) => { + is_arm_feature_detected!($t); + }; ($t:tt) => { compile_error!(concat!("unknown arm target feature: ", $t)) }; } diff --git a/library/stdarch/crates/std_detect/src/detect/arch/mips.rs b/library/stdarch/crates/std_detect/src/detect/arch/mips.rs index 876f8dde262..58e3ee6d204 100644 --- a/library/stdarch/crates/std_detect/src/detect/arch/mips.rs +++ b/library/stdarch/crates/std_detect/src/detect/arch/mips.rs @@ -9,6 +9,9 @@ macro_rules! is_mips_feature_detected { cfg!(target_feature = "msa") || $crate::detect::check_for($crate::detect::Feature::msa) }; + ($t:tt,) => { + is_mips_feature_detected!($t); + }; ($t:tt) => { compile_error!(concat!("unknown mips target feature: ", $t)) }; } diff --git a/library/stdarch/crates/std_detect/src/detect/arch/mips64.rs b/library/stdarch/crates/std_detect/src/detect/arch/mips64.rs index ab837b3d5c9..aa42c0e55df 100644 --- a/library/stdarch/crates/std_detect/src/detect/arch/mips64.rs +++ b/library/stdarch/crates/std_detect/src/detect/arch/mips64.rs @@ -9,6 +9,9 @@ macro_rules! is_mips64_feature_detected { cfg!(target_feature = "msa") || $crate::detect::check_for($crate::detect::Feature::msa) }; + ($t:tt,) => { + is_mips64_feature_detected!($t); + }; ($t:tt) => { compile_error!(concat!("unknown mips64 target feature: ", $t)) }; } diff --git a/library/stdarch/crates/std_detect/src/detect/arch/powerpc.rs b/library/stdarch/crates/std_detect/src/detect/arch/powerpc.rs index 9c440b1d6b0..8270e5bee46 100644 --- a/library/stdarch/crates/std_detect/src/detect/arch/powerpc.rs +++ b/library/stdarch/crates/std_detect/src/detect/arch/powerpc.rs @@ -17,6 +17,9 @@ macro_rules! is_powerpc_feature_detected { cfg!(target_feature = "power8") || $crate::detect::check_for($crate::detect::Feature::power8) }; + ($t:tt,) => { + is_powerpc_feature_detected!($t); + }; ($t:tt) => { compile_error!(concat!("unknown powerpc target feature: ", $t)) }; } diff --git a/library/stdarch/crates/std_detect/src/detect/arch/powerpc64.rs b/library/stdarch/crates/std_detect/src/detect/arch/powerpc64.rs index 910940f0bb9..2f754713650 100644 --- a/library/stdarch/crates/std_detect/src/detect/arch/powerpc64.rs +++ b/library/stdarch/crates/std_detect/src/detect/arch/powerpc64.rs @@ -17,6 +17,9 @@ macro_rules! is_powerpc64_feature_detected { cfg!(target_feature = "power8") || $crate::detect::check_for($crate::detect::Feature::power8) }; + ($t:tt,) => { + is_powerpc64_feature_detected!($t); + }; ($t:tt) => { compile_error!(concat!("unknown powerpc64 target feature: ", $t)) }; } diff --git a/library/stdarch/crates/std_detect/src/detect/arch/x86.rs b/library/stdarch/crates/std_detect/src/detect/arch/x86.rs index 3ef8d31d12b..5425aeecd0c 100644 --- a/library/stdarch/crates/std_detect/src/detect/arch/x86.rs +++ b/library/stdarch/crates/std_detect/src/detect/arch/x86.rs @@ -234,6 +234,9 @@ macro_rules! is_x86_feature_detected { cfg!(target_feature = "adx") || $crate::detect::check_for( $crate::detect::Feature::adx) }; + ($t:tt,) => { + is_x86_feature_detected!($t); + }; ($t:tt) => { compile_error!(concat!("unknown target feature: ", $t)) }; |
