Skip to content

Commit

Permalink
Ensure we don't break conditional compilation
Browse files Browse the repository at this point in the history
At the moment, any mistake passing the kernel configuration
for conditional compilation means we break things silently,
like initcall handling which implies panics or memory
corruption [1].

Let's prevent that from happening again.

[1] #23

Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
  • Loading branch information
ojeda committed Nov 28, 2020
1 parent c28ec6f commit d0a8472
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions rust/kernel/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@
#![no_std]
#![feature(allocator_api, alloc_error_handler)]

// Ensure conditional compilation based on the kernel configuration works;
// otherwise we may silently break things like initcall handling.
#[cfg(not(CONFIG_HAS_RUST))]
compile_error!("Missing kernel configuration for conditional compilation");

extern crate alloc;

use core::panic::PanicInfo;
Expand Down

0 comments on commit d0a8472

Please sign in to comment.