allow some out of tree archs

This commit is contained in:
Pietro Albini 2023-03-10 14:09:17 +01:00
parent bc991de233
commit e085192729
No known key found for this signature in database
GPG key ID: CD76B35F7734769E

View file

@ -1,6 +1,8 @@
use crate::common::{CompareMode, Config, Debugger};
use std::collections::HashSet;
const EXTRA_ARCHS: &[&str] = &["asmjs", "spirv"];
/// Parses a name-value directive which contains config-specific information, e.g., `ignore-x86`
/// or `normalize-stderr-32bit`.
pub(super) fn parse_cfg_name_directive<'a>(
@ -99,7 +101,7 @@ pub(super) fn parse_cfg_name_directive<'a>(
}
condition! {
name: &target_cfg.arch,
allowed_names: &target_cfgs.all_archs,
allowed_names: ContainsEither { a: &target_cfgs.all_archs, b: &EXTRA_ARCHS },
message: "when the architecture is {name}"
}
condition! {
@ -257,3 +259,14 @@ impl<T: CustomContains> CustomContains for ContainsPrefixed<T> {
}
}
}
struct ContainsEither<'a, A: CustomContains, B: CustomContains> {
a: &'a A,
b: &'a B,
}
impl<A: CustomContains, B: CustomContains> CustomContains for ContainsEither<'_, A, B> {
fn custom_contains(&self, item: &str) -> bool {
self.a.custom_contains(item) || self.b.custom_contains(item)
}
}