aboutsummaryrefslogtreecommitdiff
path: root/tests/cfail/cfg-static.rs
blob: 91465a1e7ae35b642619b429231d67c988658126 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#![no_main]
#![no_std]

extern crate lm3s6965;
extern crate panic_halt;
extern crate rtfm;

use rtfm::app;

#[app(device = lm3s6965)]
const APP: () = {
    #[init]
    fn init(_: init::Context) {
        #[cfg(never)]
        static mut FOO: u32 = 0;

        FOO; //~ ERROR cannot find value `FOO` in this scope
    }

    #[idle]
    fn idle(_: idle::Context) -> ! {
        #[cfg(never)]
        static mut FOO: u32 = 0;

        FOO; //~ ERROR cannot find value `FOO` in this scope

        loop {}
    }

    #[exception]
    fn SVCall(_: SVCall::Context) {
        #[cfg(never)]
        static mut FOO: u32 = 0;

        FOO; //~ ERROR cannot find value `FOO` in this scope
    }

    #[interrupt]
    fn UART0(_: UART0::Context) {
        #[cfg(never)]
        static mut FOO: u32 = 0;

        FOO; //~ ERROR cannot find value `FOO` in this scope
    }

    #[task]
    fn foo(_: foo::Context) {
        #[cfg(never)]
        static mut FOO: u32 = 0;

        FOO; //~ ERROR cannot find value `FOO` in this scope
    }

    extern "C" {
        fn UART1();
    }
};