From a11ea95bc3f2eb81af4840c3a6a283a854c0447e Mon Sep 17 00:00:00 2001 From: "Cliff L. Biffle" Date: Wed, 3 Apr 2024 11:14:32 -0700 Subject: [PATCH] userlib: fail if no-panic and panic-messages are both set --- sys/userlib/src/lib.rs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/sys/userlib/src/lib.rs b/sys/userlib/src/lib.rs index 3abd3abff..c537e3001 100644 --- a/sys/userlib/src/lib.rs +++ b/sys/userlib/src/lib.rs @@ -1288,6 +1288,15 @@ pub unsafe extern "C" fn _start() -> ! { } } +// Make the no-panic and panic-messages features mutually exclusive. +#[cfg(all(feature = "no-panic", feature = "panic-messages"))] +compile_error!( + "Both the userlib/panic-messages and userlib/no-panic feature flags \ + are set! This doesn't make a lot of sense and is probably not what \ + you wanted. (If you have a use case for this combination, update \ + this check in userlib.)" +); + /// Panic handler for user tasks with the `panic-messages` feature enabled. This /// handler will try its best to generate a panic message, up to a maximum /// buffer size (configured below).