mirror of
https://github.com/rtic-rs/rtic.git
synced 2025-12-18 05:45:19 +01:00
properly handle #[cfg] (conditional compilation) on resources
This commit is contained in:
parent
9757c33b00
commit
4345c10596
8 changed files with 362 additions and 77 deletions
49
tests/cpass/cfg.rs
Normal file
49
tests/cpass/cfg.rs
Normal file
|
|
@ -0,0 +1,49 @@
|
|||
//! Compile-pass test that checks that `#[cfg]` attributes are respected
|
||||
|
||||
#![deny(unsafe_code)]
|
||||
#![deny(warnings)]
|
||||
#![no_main]
|
||||
#![no_std]
|
||||
|
||||
extern crate lm3s6965;
|
||||
extern crate panic_semihosting;
|
||||
extern crate rtfm;
|
||||
|
||||
use rtfm::app;
|
||||
|
||||
#[app(device = lm3s6965)]
|
||||
const APP: () = {
|
||||
#[cfg(never)]
|
||||
static mut FOO: u32 = 0;
|
||||
|
||||
#[init]
|
||||
fn init() {
|
||||
#[cfg(never)]
|
||||
static mut BAR: u32 = 0;
|
||||
}
|
||||
|
||||
#[idle]
|
||||
fn idle() -> ! {
|
||||
#[cfg(never)]
|
||||
static mut BAR: u32 = 0;
|
||||
|
||||
loop {}
|
||||
}
|
||||
|
||||
#[task(resources = [FOO])]
|
||||
fn foo() {
|
||||
#[cfg(never)]
|
||||
static mut BAR: u32 = 0;
|
||||
}
|
||||
|
||||
#[task(priority = 3, resources = [FOO])]
|
||||
fn bar() {
|
||||
#[cfg(never)]
|
||||
static mut BAR: u32 = 0;
|
||||
}
|
||||
|
||||
extern "C" {
|
||||
fn UART0();
|
||||
fn UART1();
|
||||
}
|
||||
};
|
||||
Loading…
Add table
Add a link
Reference in a new issue