diff options
author | 2019-08-20 15:11:24 +0200 | |
---|---|---|
committer | 2019-08-20 15:17:37 +0200 | |
commit | 0e146f8d1142672725b6abb38478f503a9261c80 (patch) | |
tree | 846aedddb91908ac831cd15f7877d5ccfbd9a039 /macros | |
parent | 2f4f1857788a3c2c5e8b97a5b7cc2c39c26c659f (diff) | |
download | rtic-0e146f8d1142672725b6abb38478f503a9261c80.tar.gz rtic-0e146f8d1142672725b6abb38478f503a9261c80.tar.zst rtic-0e146f8d1142672725b6abb38478f503a9261c80.zip |
adapt to changes in rtfm-syntax
Diffstat (limited to 'macros')
-rw-r--r-- | macros/Cargo.toml | 6 | ||||
-rw-r--r-- | macros/src/check.rs | 7 | ||||
-rw-r--r-- | macros/src/codegen.rs | 2 | ||||
-rw-r--r-- | macros/src/codegen/hardware_tasks.rs | 1 | ||||
-rw-r--r-- | macros/src/codegen/idle.rs | 2 | ||||
-rw-r--r-- | macros/src/codegen/init.rs | 2 | ||||
-rw-r--r-- | macros/src/codegen/software_tasks.rs | 1 | ||||
-rw-r--r-- | macros/src/codegen/util.rs | 6 | ||||
-rw-r--r-- | macros/src/lib.rs | 1 |
9 files changed, 17 insertions, 11 deletions
diff --git a/macros/Cargo.toml b/macros/Cargo.toml index c4e897fa..ed7626f8 100644 --- a/macros/Cargo.toml +++ b/macros/Cargo.toml @@ -15,9 +15,9 @@ version = "0.5.0-alpha.1" proc-macro = true [dependencies] -proc-macro2 = "0.4.30" -quote = "0.6.12" -syn = "0.15.34" +proc-macro2 = "1" +quote = "1" +syn = "1" [dependencies.rtfm-syntax] git = "https://github.com/japaric/rtfm-syntax" diff --git a/macros/src/check.rs b/macros/src/check.rs index 85fda75b..0136370c 100644 --- a/macros/src/check.rs +++ b/macros/src/check.rs @@ -169,9 +169,10 @@ pub fn app<'a>(app: &'a App, analysis: &Analysis) -> parse::Result<Extra<'a>> { peripherals = if *x { Some(0) } else { None } } - CustomArg::UInt(x) if app.args.cores != 1 => { - peripherals = if *x < u64::from(app.args.cores) { - Some(*x as u8) + CustomArg::UInt(s) if app.args.cores != 1 => { + let x = s.parse::<u8>().ok(); + peripherals = if x.is_some() && x.unwrap() < app.args.cores { + Some(x.unwrap()) } else { return Err(parse::Error::new( k.span(), diff --git a/macros/src/codegen.rs b/macros/src/codegen.rs index 8ac06d53..02138481 100644 --- a/macros/src/codegen.rs +++ b/macros/src/codegen.rs @@ -126,7 +126,7 @@ pub fn app(app: &App, analysis: &Analysis, extra: &Extra) -> TokenStream2 { #(#root)* - #(#mod_resources)* + #mod_resources #(#root_hardware_tasks)* diff --git a/macros/src/codegen/hardware_tasks.rs b/macros/src/codegen/hardware_tasks.rs index cf92e078..a9c2a2bd 100644 --- a/macros/src/codegen/hardware_tasks.rs +++ b/macros/src/codegen/hardware_tasks.rs @@ -115,6 +115,7 @@ pub fn codegen( let stmts = &task.stmts; let section = util::link_section("text", core); // XXX shouldn't this have a cfg_core? + let locals_pat = locals_pat.iter(); user_tasks.push(quote!( #(#attrs)* #[allow(non_snake_case)] diff --git a/macros/src/codegen/idle.rs b/macros/src/codegen/idle.rs index d6560761..35a72523 100644 --- a/macros/src/codegen/idle.rs +++ b/macros/src/codegen/idle.rs @@ -58,6 +58,7 @@ pub fn codegen( let context = &idle.context; let stmts = &idle.stmts; let section = util::link_section("text", core); + let locals_pat = locals_pat.iter(); let user_idle = Some(quote!( #(#attrs)* #[allow(non_snake_case)] @@ -70,6 +71,7 @@ pub fn codegen( } )); + let locals_new = locals_new.iter(); let call_idle = quote!(#name( #(#locals_new,)* #name::Context::new(&rtfm::export::Priority::new(0)) diff --git a/macros/src/codegen/init.rs b/macros/src/codegen/init.rs index 878c633e..9c8ce31c 100644 --- a/macros/src/codegen/init.rs +++ b/macros/src/codegen/init.rs @@ -83,6 +83,7 @@ pub fn codegen( let attrs = &init.attrs; let stmts = &init.stmts; let section = util::link_section("text", core); + let locals_pat = locals_pat.iter(); let user_init = Some(quote!( #(#attrs)* #cfg_core @@ -102,6 +103,7 @@ pub fn codegen( const_app = Some(constructor); } + let locals_new = locals_new.iter(); let call_init = Some(quote!(let late = #name(#(#locals_new,)* #name::Context::new(core.into()));)); diff --git a/macros/src/codegen/software_tasks.rs b/macros/src/codegen/software_tasks.rs index 2960faf9..be1eb05c 100644 --- a/macros/src/codegen/software_tasks.rs +++ b/macros/src/codegen/software_tasks.rs @@ -168,6 +168,7 @@ pub fn codegen( let attrs = &task.attrs; let cfgs = &task.cfgs; let stmts = &task.stmts; + let locals_pat = locals_pat.iter(); user_tasks.push(quote!( #(#attrs)* #(#cfgs)* diff --git a/macros/src/codegen/util.rs b/macros/src/codegen/util.rs index f5f96dea..207272dc 100644 --- a/macros/src/codegen/util.rs +++ b/macros/src/codegen/util.rs @@ -3,13 +3,13 @@ use core::sync::atomic::{AtomicUsize, Ordering}; use proc_macro2::{Span, TokenStream as TokenStream2}; use quote::quote; use rtfm_syntax::{ast::App, Context, Core}; -use syn::{ArgCaptured, Attribute, Ident, IntSuffix, LitInt}; +use syn::{Attribute, Ident, LitInt, PatType}; use crate::check::Extra; /// Turns `capacity` into an unsuffixed integer literal pub fn capacity_literal(capacity: u8) -> LitInt { - LitInt::new(u64::from(capacity), IntSuffix::None, Span::call_site()) + LitInt::new(&capacity.to_string(), Span::call_site()) } /// Turns `capacity` into a type-level (`typenum`) integer @@ -194,7 +194,7 @@ pub fn rendezvous_ident(core: Core) -> Ident { // // `inputs` could be &[`input: Foo`] OR &[`mut x: i32`, `ref y: i64`] pub fn regroup_inputs( - inputs: &[ArgCaptured], + inputs: &[PatType], ) -> ( // args e.g. &[`_0`], &[`_0: i32`, `_1: i64`] Vec<TokenStream2>, diff --git a/macros/src/lib.rs b/macros/src/lib.rs index ed55095d..7a436e7b 100644 --- a/macros/src/lib.rs +++ b/macros/src/lib.rs @@ -1,5 +1,4 @@ #![deny(warnings)] -#![recursion_limit = "128"] extern crate proc_macro; |