aboutsummaryrefslogtreecommitdiff
path: root/macros/src/check.rs
diff options
context:
space:
mode:
authorJorge Aparicio <jorge@japaric.io>2017-07-06 23:25:29 -0500
committerJorge Aparicio <jorge@japaric.io>2017-07-06 23:25:29 -0500
commit3cebf49a2feb10b6dbf7e40e4671dbf7a3d8bedf (patch)
treed9b842d6f60439370ef81a4015993ed70f9aa7f8 /macros/src/check.rs
parent4b0c3bff871eb6125835fd911891bf503c61c820 (diff)
syntax tweaks, relax check, add set_pending(), deal with imported types
- allow trailing commas in list of resources - make task.resources optional - add rtfm::set_pending function which can be used to force an interrupt into the pending state. This is a replacement of the old rtfm::request. rtfm::set_pending takes the Interrupt enum provided by the device crate as argument. (The old rtfm::request took a task function as argument) - the user may want to use types they imported into the root of the crate. These types are not available in e.g. `mod idle` so `idle::Resources` *can't* be defined in that module. To workaround this problem `idle::Resources` will be defined in the root, with some other name, and then be re-exported in the `idle` module. - remove the "a resource only used by one task should be local data" check. In some cases you do want a resource owned by a single task instead of local data since `init` can access resources but not a task local data.
Diffstat (limited to 'macros/src/check.rs')
-rw-r--r--macros/src/check.rs21
1 files changed, 8 insertions, 13 deletions
diff --git a/macros/src/check.rs b/macros/src/check.rs
index ddd9abc..7c86326 100644
--- a/macros/src/check.rs
+++ b/macros/src/check.rs
@@ -1,17 +1,12 @@
-use syntax::Resources;
-use util::{Ceiling, Ceilings};
+use syntax::Statics;
+use util::Ceilings;
-pub fn resources(resources: &Resources, ceilings: &Ceilings) {
+pub fn resources(resources: &Statics, ceilings: &Ceilings) {
for resource in resources.keys() {
- if let Some(ceiling) = ceilings.get(&resource) {
- assert_ne!(
- *ceiling,
- Ceiling::Owned,
- "{} should be local data",
- resource
- );
- } else {
- panic!("resource {} is unused", resource)
- }
+ assert!(
+ ceilings.get(&resource).is_some(),
+ "resource {} is unused",
+ resource
+ );
}
}