aboutsummaryrefslogtreecommitdiff
path: root/macros/src
diff options
context:
space:
mode:
authorGravatar Emil Fresk <emil.fresk@gmail.com> 2023-01-08 16:36:48 +0100
committerGravatar Henrik Tjäder <henrik@tjaders.com> 2023-03-01 00:33:27 +0100
commitcbe592688047e41ebfd0f15e7bf5799f81bfcd4a (patch)
tree4026f3fc2058bc51e4f513757831b41d5275d9c3 /macros/src
parent584ac7e1b335411e3d923aeef92466efdc92ae50 (diff)
downloadrtic-cbe592688047e41ebfd0f15e7bf5799f81bfcd4a.tar.gz
rtic-cbe592688047e41ebfd0f15e7bf5799f81bfcd4a.tar.zst
rtic-cbe592688047e41ebfd0f15e7bf5799f81bfcd4a.zip
Fix failing UI test
Diffstat (limited to 'macros/src')
-rw-r--r--macros/src/syntax/analyze.rs18
1 files changed, 10 insertions, 8 deletions
diff --git a/macros/src/syntax/analyze.rs b/macros/src/syntax/analyze.rs
index ff0577da..dd5a9b40 100644
--- a/macros/src/syntax/analyze.rs
+++ b/macros/src/syntax/analyze.rs
@@ -13,17 +13,17 @@ use crate::syntax::{
pub(crate) fn app(app: &App) -> Result<Analysis, syn::Error> {
// Collect all tasks into a vector
- type TaskName = String;
+ type TaskName = Ident;
type Priority = u8;
// The task list is a Tuple (Name, Shared Resources, Local Resources, Priority)
let task_resources_list: Vec<(TaskName, Vec<&Ident>, &LocalResources, Priority)> =
Some(&app.init)
.iter()
- .map(|ht| ("init".to_string(), Vec::new(), &ht.args.local_resources, 0))
+ .map(|ht| (ht.name.clone(), Vec::new(), &ht.args.local_resources, 0))
.chain(app.idle.iter().map(|ht| {
(
- "idle".to_string(),
+ ht.name.clone(),
ht.args
.shared_resources
.iter()
@@ -35,7 +35,7 @@ pub(crate) fn app(app: &App) -> Result<Analysis, syn::Error> {
}))
.chain(app.software_tasks.iter().map(|(name, ht)| {
(
- name.to_string(),
+ name.clone(),
ht.args
.shared_resources
.iter()
@@ -47,7 +47,7 @@ pub(crate) fn app(app: &App) -> Result<Analysis, syn::Error> {
}))
.chain(app.hardware_tasks.iter().map(|(name, ht)| {
(
- name.to_string(),
+ name.clone(),
ht.args
.shared_resources
.iter()
@@ -77,16 +77,17 @@ pub(crate) fn app(app: &App) -> Result<Analysis, syn::Error> {
for r in tr {
// Get all uses of resources annotated lock_free
if lf_res == r {
- // lock_free resources are not allowed in async tasks
- error.push(syn::Error::new(
+ // Check so async tasks do not use lock free resources
+ if app.software_tasks.get(task).is_some() {
+ error.push(syn::Error::new(
r.span(),
format!(
"Lock free shared resource {:?} is used by an async tasks, which is forbidden",
r.to_string(),
),
));
+ }
- // TODO: Should this be removed?
// HashMap returns the previous existing object if old.key == new.key
if let Some(lf_res) = lf_hash.insert(r.to_string(), (task, r, priority)) {
// Check if priority differ, if it does, append to
@@ -95,6 +96,7 @@ pub(crate) fn app(app: &App) -> Result<Analysis, syn::Error> {
lf_res_with_error.push(lf_res.1);
lf_res_with_error.push(r);
}
+
// If the resource already violates lock free properties
if lf_res_with_error.contains(&r) {
lf_res_with_error.push(lf_res.1);