Prepare for new riscv ecosystem

This commit is contained in:
Román Cárdenas Rodríguez 2024-10-23 18:50:12 +02:00 committed by Henrik Tjäder
parent bac77de9bc
commit 183e73904a
14 changed files with 164 additions and 134 deletions

View file

@ -1,16 +1,27 @@
use syn::{
parse::{Parse, ParseStream},
Ident, Result,
Result,
};
#[derive(Debug)]
pub struct BackendArgs {
pub hart_id: Ident,
#[cfg(feature = "riscv-clint")]
pub hart_id: syn::Ident,
}
impl Parse for BackendArgs {
fn parse(input: ParseStream) -> Result<Self> {
let hart_id = input.parse()?;
Ok(BackendArgs { hart_id })
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",
)),
}
}
}