Commit 700593f1 authored by Tobias Koppers's avatar Tobias Koppers

check notes, but do not link them

parent be6b69e5
...@@ -211,28 +211,51 @@ pub fn no_note() -> String { ...@@ -211,28 +211,51 @@ pub fn no_note() -> String {
String::new() String::new()
} }
pub fn ignore_note(_note: impl Fn() -> String + Sync + Send + 'static) {
// This function must be removed by DCE.
// This code triggers a build error when it's not removed.
unsafe {
unsafe extern "C" {
fn trigger_link_error() -> !;
}
trigger_link_error();
}
}
#[cfg(not(feature = "hanging_detection"))] #[cfg(not(feature = "hanging_detection"))]
#[macro_export] #[macro_export]
macro_rules! listen_event { macro_rules! listen_event {
($self:expr, $note:expr) => { ($self:expr, $note:expr) => {{
// This makes sure the code is checked, but not included in the final result.
if false {
$crate::event::ignore_note($note);
}
$self.listen() $self.listen()
}; }};
} }
#[cfg(not(feature = "hanging_detection"))] #[cfg(not(feature = "hanging_detection"))]
#[macro_export] #[macro_export]
macro_rules! new_event { macro_rules! new_event {
($description:expr) => { ($description:expr) => {{
// This makes sure the code is checked, but not included in the final result.
if false {
$crate::event::ignore_note($description);
}
$crate::event::Event::new() $crate::event::Event::new()
}; }};
} }
#[cfg(not(feature = "hanging_detection"))] #[cfg(not(feature = "hanging_detection"))]
#[macro_export] #[macro_export]
macro_rules! event_note { macro_rules! event_note {
($note:expr) => { ($note:expr) => {{
// This makes sure the code is checked, but not included in the final result.
if false {
$crate::event::ignore_note($note);
}
$crate::event::no_note $crate::event::no_note
}; }};
} }
#[cfg(feature = "hanging_detection")] #[cfg(feature = "hanging_detection")]
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment