blob: b579b0181add06d65ed4701f2d1fbd12042f3944 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
use syn::{
parse::{Parse, ParseStream},
Result,
};
#[derive(Debug)]
pub struct BackendArgs {
#[cfg(feature = "riscv-clint")]
pub hart_id: syn::Ident,
}
impl Parse for BackendArgs {
fn parse(input: ParseStream) -> Result<Self> {
match () {
#[cfg(feature = "riscv-clint")]
() => {
let hart_id = input.parse()?;
Ok(BackendArgs { hart_id })
}
#[cfg(feature = "riscv-mecall")]
() => Err(syn::Error::new(
input.span(),
"riscv-mecall backend does not accept any arguments",
)),
}
}
}
|