Attribute Macro sel4_config::sel4_cfg

#[sel4_cfg]
Expand description

Make the attached code conditional on a seL4 kernel configuration expression.

Supports the same syntax as #[cfg], except primitive expressions are based on seL4 kernel configuration rather than rustc configuration.

Suppose $SEL4_PREFIX/libsel4/include/kernel/gen_config.json contains:

{
    "KERNEL_MCS": false,
    "HAVE_FPU": true
    "ARM_PLAT": "bcm2711",
    "MAX_NUM_NODES": "4",
    ...
}

Note that values are either booleans or strings. Configuration keys corresponding to boolean values are used as in #[sel4_cfg(KERNEL_MCS)], whereas those corresponding to strings are used in equalities as in #[sel4_cfg(MAX_NUM_NODES = 4)]. Expressions can be combined using not(), any(), and all(), just like expressions in #[cfg].

Unlike in #[cfg], using a configuration key that is not present in the seL4 kernel configuration will result in an error rather than just evaluating to false. That is, a key that is not part of an equality expression evaluates to itsqqqqqqqqqq boolean value, whereas in #[cfg] a key that is not part of an equality expression evaluates to whether it is present in the configuration.