From bc3eb5c54784c32ccfff404dba58a27d5a47f04e Mon Sep 17 00:00:00 2001 From: Emil Fresk Date: Mon, 16 Aug 2021 15:37:39 +0200 Subject: Remove linked list impl - use heapless, linked list init now const fn --- macros/src/codegen/module.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'macros/src/codegen/module.rs') diff --git a/macros/src/codegen/module.rs b/macros/src/codegen/module.rs index c7092bd..d3afb27 100644 --- a/macros/src/codegen/module.rs +++ b/macros/src/codegen/module.rs @@ -327,7 +327,7 @@ pub fn codegen( impl #internal_spawn_handle_ident { pub fn cancel(self) -> Result<#ty, ()> { rtic::export::interrupt::free(|_| unsafe { - let tq = &mut *#tq.get_mut_unchecked().as_mut_ptr(); + let tq = #tq.get_mut_unchecked(); if let Some((_task, index)) = tq.cancel_marker(self.marker) { // Get the message let msg = #inputs @@ -359,7 +359,7 @@ pub fn codegen( let marker = *#tq_marker.get_mut_unchecked(); *#tq_marker.get_mut_unchecked() = #tq_marker.get_mut_unchecked().wrapping_add(1); - let tq = &mut *#tq.get_mut_unchecked().as_mut_ptr(); + let tq = #tq.get_mut_unchecked(); tq.update_marker(self.marker, marker, instant, || #pend).map(|_| #name::#m::SpawnHandle { marker }) }) @@ -420,7 +420,7 @@ pub fn codegen( *#tq_marker.get_mut_unchecked() = #tq_marker.get_mut_unchecked().wrapping_add(1); - let tq = &mut *#tq.get_mut_unchecked().as_mut_ptr(); + let tq = #tq.get_mut_unchecked(); tq.enqueue_unchecked( nr, -- cgit v1.2.3 From 13f7516a4d88f15763b7186cc3a95ccb3cfbd5c0 Mon Sep 17 00:00:00 2001 From: Emil Fresk Date: Thu, 19 Aug 2021 08:21:18 +0200 Subject: Fixed some lints from Rust Analyzer with experimental proc-macros --- macros/src/codegen/module.rs | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'macros/src/codegen/module.rs') diff --git a/macros/src/codegen/module.rs b/macros/src/codegen/module.rs index d3afb27..cac89c7 100644 --- a/macros/src/codegen/module.rs +++ b/macros/src/codegen/module.rs @@ -131,6 +131,7 @@ pub fn codegen( items.push(quote!( /// Monotonics used by the system #[allow(non_snake_case)] + #[allow(non_camel_case_types)] pub struct #internal_monotonics_ident( #(pub #monotonic_types),* ); @@ -178,6 +179,8 @@ pub fn codegen( items.push(quote!( #(#cfgs)* /// Execution context + #[allow(non_snake_case)] + #[allow(non_camel_case_types)] pub struct #internal_context_name<#lt> { #(#fields,)* } @@ -318,6 +321,8 @@ pub fn codegen( items.push(quote!( #(#cfgs)* + #[allow(non_snake_case)] + #[allow(non_camel_case_types)] pub struct #internal_spawn_handle_ident { #[doc(hidden)] marker: u32, -- cgit v1.2.3 From cdbd8a2cede668e1181030bd7c439592a8f0e980 Mon Sep 17 00:00:00 2001 From: datdenkikniet Date: Thu, 19 Aug 2021 21:32:12 +0200 Subject: Use `mark_internal_name` by default for methods in `util` to make usage of these functions more straightforward. fq_ident is always internal rq_ident is always internal monotonic_ident is always internal inputs_ident is always internal local_resources_ident is always internal shared_resources_ident is always internal monotonic_instants_ident is always internal tq_ident is always internal timer_queue_marker_ident is always internal static_shared_resource_ident is always internal static_local_resource_ident is always internal declared_static_local_resource_ident is always internal Only names, not idents, are now marked as internal Use same rtic internal everywhere --- macros/src/codegen/module.rs | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) (limited to 'macros/src/codegen/module.rs') diff --git a/macros/src/codegen/module.rs b/macros/src/codegen/module.rs index cac89c7..ddaf1e5 100644 --- a/macros/src/codegen/module.rs +++ b/macros/src/codegen/module.rs @@ -67,7 +67,6 @@ pub fn codegen( if ctxt.has_local_resources(app) { let ident = util::local_resources_ident(ctxt, app); - let ident = util::mark_internal_ident(&ident); let lt = if local_resources_tick { lt = Some(quote!('a)); Some(quote!('a)) @@ -90,7 +89,6 @@ pub fn codegen( if ctxt.has_shared_resources(app) { let ident = util::shared_resources_ident(ctxt, app); - let ident = util::mark_internal_ident(&ident); let lt = if shared_resources_tick { lt = Some(quote!('a)); Some(quote!('a)) @@ -212,11 +210,8 @@ pub fn codegen( let args = &args; let tupled = &tupled; let fq = util::fq_ident(name); - let fq = util::mark_internal_ident(&fq); let rq = util::rq_ident(priority); - let rq = util::mark_internal_ident(&rq); let inputs = util::inputs_ident(name); - let inputs = util::mark_internal_ident(&inputs); let device = &extra.device; let enum_ = util::interrupt_ident(); @@ -266,16 +261,13 @@ pub fn codegen( // Schedule caller for (_, monotonic) in &app.monotonics { let instants = util::monotonic_instants_ident(name, &monotonic.ident); - let instants = util::mark_internal_ident(&instants); let monotonic_name = monotonic.ident.to_string(); let tq = util::tq_ident(&monotonic.ident.to_string()); - let tq = util::mark_internal_ident(&tq); let t = util::schedule_t_ident(); let m = &monotonic.ident; let mono_type = &monotonic.ident; let m_ident = util::monotonic_ident(&monotonic_name); - let m_ident = util::mark_internal_ident(&m_ident); let m_isr = &monotonic.args.binds; let enum_ = util::interrupt_ident(); @@ -293,7 +285,7 @@ pub fn codegen( ) }; - let tq_marker = util::mark_internal_ident(&util::timer_queue_marker_ident()); + let tq_marker = &util::timer_queue_marker_ident(); // For future use // let doc = format!(" RTIC internal: {}:{}", file!(), line!()); -- cgit v1.2.3 From 52dc324aa7eafd855a22a95248feab70f1c1a19d Mon Sep 17 00:00:00 2001 From: Emil Fresk Date: Fri, 20 Aug 2021 09:21:02 +0200 Subject: More rustanalyzer lint fixes --- macros/src/codegen/module.rs | 2 ++ 1 file changed, 2 insertions(+) (limited to 'macros/src/codegen/module.rs') diff --git a/macros/src/codegen/module.rs b/macros/src/codegen/module.rs index cac89c7..656ae6c 100644 --- a/macros/src/codegen/module.rs +++ b/macros/src/codegen/module.rs @@ -376,6 +376,7 @@ pub fn codegen( /// /// This will use the time `Instant::new(0)` as baseline if called in `#[init]`, /// so if you use a non-resetable timer use `spawn_at` when in `#[init]` + #[allow(non_snake_case)] pub fn #internal_spawn_after_ident( duration: D #(,#args)* @@ -395,6 +396,7 @@ pub fn codegen( #(#cfgs)* /// Spawns the task at a fixed time instant + #[allow(non_snake_case)] pub fn #internal_spawn_at_ident( instant: rtic::time::Instant<#mono_type> #(,#args)* -- cgit v1.2.3