diff options
| author | Jorge Aparicio <jorge@japaric.io> | 2019-06-20 06:19:59 +0200 |
|---|---|---|
| committer | Jorge Aparicio <jorge@japaric.io> | 2019-06-20 06:19:59 +0200 |
| commit | 4e51bb68b976c6bb6a9a989dc560d2a8123a84ca (patch) | |
| tree | 5c14f21f904c15034d477c7e4400e01d212a9f2a /macros/src/check.rs | |
| parent | b150ab29e25637e41ba5de81f6cbbdfe24834a3f (diff) | |
RFC #207
Diffstat (limited to 'macros/src/check.rs')
| -rw-r--r-- | macros/src/check.rs | 19 |
1 files changed, 6 insertions, 13 deletions
diff --git a/macros/src/check.rs b/macros/src/check.rs index 619ec8f..85fda75 100644 --- a/macros/src/check.rs +++ b/macros/src/check.rs @@ -3,7 +3,7 @@ use std::collections::HashSet; use proc_macro2::Span; use rtfm_syntax::{ analyze::Analysis, - ast::{App, CustomArg, HardwareTaskKind}, + ast::{App, CustomArg}, }; use syn::{parse, Path}; @@ -44,18 +44,9 @@ pub fn app<'a>(app: &'a App, analysis: &Analysis) -> parse::Result<Extra<'a>> { // check that all exceptions are valid; only exceptions with configurable priorities are // accepted - for (name, task) in app - .hardware_tasks - .iter() - .filter(|(_, task)| task.kind == HardwareTaskKind::Exception) - { - let name_s = task.args.binds(name).to_string(); + for (name, task) in &app.hardware_tasks { + let name_s = task.args.binds.to_string(); match &*name_s { - // NOTE that some of these don't exist on ARMv6-M but we don't check that here -- the - // code we generate will check that the exception actually exists on ARMv6-M - "MemoryManagement" | "BusFault" | "UsageFault" | "SecureFault" | "SVCall" - | "DebugMonitor" | "PendSV" => {} // OK - "SysTick" => { if analysis.timer_queues.get(&task.args.core).is_some() { return Err(parse::Error::new( @@ -67,12 +58,14 @@ pub fn app<'a>(app: &'a App, analysis: &Analysis) -> parse::Result<Extra<'a>> { } } - _ => { + "NonMaskableInt" | "HardFault" => { return Err(parse::Error::new( name.span(), "only exceptions with configurable priority can be used as hardware tasks", )); } + + _ => {} } } |
