Reduced define for 'unreachable!' to a single macro rule

This commit is contained in:
Tarun Singh 2024-07-17 17:05:52 -04:00
parent e1e99879a6
commit a716a3f006
23 changed files with 138 additions and 230 deletions

View File

@ -90,19 +90,15 @@ macro_rules! todo {
}; };
} }
#[collapse_debuginfo(yes)]
macro_rules! unreachable {
($($x:tt)*) => {
{
#[cfg(not(feature = "defmt"))] #[cfg(not(feature = "defmt"))]
#[collapse_debuginfo(yes)] ::core::unreachable!($($x)*);
macro_rules! unreachable {
($($x:tt)*) => {
::core::unreachable!($($x)*)
};
}
#[cfg(feature = "defmt")] #[cfg(feature = "defmt")]
#[collapse_debuginfo(yes)] ::defmt::unreachable!($($x)*);
macro_rules! unreachable { }
($($x:tt)*) => {
::defmt::unreachable!($($x)*)
}; };
} }

View File

@ -90,19 +90,15 @@ macro_rules! todo {
}; };
} }
#[collapse_debuginfo(yes)]
macro_rules! unreachable {
($($x:tt)*) => {
{
#[cfg(not(feature = "defmt"))] #[cfg(not(feature = "defmt"))]
#[collapse_debuginfo(yes)] ::core::unreachable!($($x)*);
macro_rules! unreachable {
($($x:tt)*) => {
::core::unreachable!($($x)*)
};
}
#[cfg(feature = "defmt")] #[cfg(feature = "defmt")]
#[collapse_debuginfo(yes)] ::defmt::unreachable!($($x)*);
macro_rules! unreachable { }
($($x:tt)*) => {
::defmt::unreachable!($($x)*)
}; };
} }

View File

@ -90,19 +90,15 @@ macro_rules! todo {
}; };
} }
#[collapse_debuginfo(yes)]
macro_rules! unreachable {
($($x:tt)*) => {
{
#[cfg(not(feature = "defmt"))] #[cfg(not(feature = "defmt"))]
#[collapse_debuginfo(yes)] ::core::unreachable!($($x)*);
macro_rules! unreachable {
($($x:tt)*) => {
::core::unreachable!($($x)*)
};
}
#[cfg(feature = "defmt")] #[cfg(feature = "defmt")]
#[collapse_debuginfo(yes)] ::defmt::unreachable!($($x)*);
macro_rules! unreachable { }
($($x:tt)*) => {
::defmt::unreachable!($($x)*)
}; };
} }

View File

@ -90,19 +90,15 @@ macro_rules! todo {
}; };
} }
#[collapse_debuginfo(yes)]
macro_rules! unreachable {
($($x:tt)*) => {
{
#[cfg(not(feature = "defmt"))] #[cfg(not(feature = "defmt"))]
#[collapse_debuginfo(yes)] ::core::unreachable!($($x)*);
macro_rules! unreachable {
($($x:tt)*) => {
::core::unreachable!($($x)*)
};
}
#[cfg(feature = "defmt")] #[cfg(feature = "defmt")]
#[collapse_debuginfo(yes)] ::defmt::unreachable!($($x)*);
macro_rules! unreachable { }
($($x:tt)*) => {
::defmt::unreachable!($($x)*)
}; };
} }

View File

@ -90,19 +90,15 @@ macro_rules! todo {
}; };
} }
#[collapse_debuginfo(yes)]
macro_rules! unreachable {
($($x:tt)*) => {
{
#[cfg(not(feature = "defmt"))] #[cfg(not(feature = "defmt"))]
#[collapse_debuginfo(yes)] ::core::unreachable!($($x)*);
macro_rules! unreachable {
($($x:tt)*) => {
::core::unreachable!($($x)*)
};
}
#[cfg(feature = "defmt")] #[cfg(feature = "defmt")]
#[collapse_debuginfo(yes)] ::defmt::unreachable!($($x)*);
macro_rules! unreachable { }
($($x:tt)*) => {
::defmt::unreachable!($($x)*)
}; };
} }

View File

@ -90,19 +90,15 @@ macro_rules! todo {
}; };
} }
#[collapse_debuginfo(yes)]
macro_rules! unreachable {
($($x:tt)*) => {
{
#[cfg(not(feature = "defmt"))] #[cfg(not(feature = "defmt"))]
#[collapse_debuginfo(yes)] ::core::unreachable!($($x)*);
macro_rules! unreachable {
($($x:tt)*) => {
::core::unreachable!($($x)*)
};
}
#[cfg(feature = "defmt")] #[cfg(feature = "defmt")]
#[collapse_debuginfo(yes)] ::defmt::unreachable!($($x)*);
macro_rules! unreachable { }
($($x:tt)*) => {
::defmt::unreachable!($($x)*)
}; };
} }

View File

@ -90,19 +90,15 @@ macro_rules! todo {
}; };
} }
#[collapse_debuginfo(yes)]
macro_rules! unreachable {
($($x:tt)*) => {
{
#[cfg(not(feature = "defmt"))] #[cfg(not(feature = "defmt"))]
#[collapse_debuginfo(yes)] ::core::unreachable!($($x)*);
macro_rules! unreachable {
($($x:tt)*) => {
::core::unreachable!($($x)*)
};
}
#[cfg(feature = "defmt")] #[cfg(feature = "defmt")]
#[collapse_debuginfo(yes)] ::defmt::unreachable!($($x)*);
macro_rules! unreachable { }
($($x:tt)*) => {
::defmt::unreachable!($($x)*)
}; };
} }

View File

@ -90,19 +90,15 @@ macro_rules! todo {
}; };
} }
#[collapse_debuginfo(yes)]
macro_rules! unreachable {
($($x:tt)*) => {
{
#[cfg(not(feature = "defmt"))] #[cfg(not(feature = "defmt"))]
#[collapse_debuginfo(yes)] ::core::unreachable!($($x)*);
macro_rules! unreachable {
($($x:tt)*) => {
::core::unreachable!($($x)*)
};
}
#[cfg(feature = "defmt")] #[cfg(feature = "defmt")]
#[collapse_debuginfo(yes)] ::defmt::unreachable!($($x)*);
macro_rules! unreachable { }
($($x:tt)*) => {
::defmt::unreachable!($($x)*)
}; };
} }

View File

@ -90,19 +90,15 @@ macro_rules! todo {
}; };
} }
#[collapse_debuginfo(yes)]
macro_rules! unreachable {
($($x:tt)*) => {
{
#[cfg(not(feature = "defmt"))] #[cfg(not(feature = "defmt"))]
#[collapse_debuginfo(yes)] ::core::unreachable!($($x)*);
macro_rules! unreachable {
($($x:tt)*) => {
::core::unreachable!($($x)*)
};
}
#[cfg(feature = "defmt")] #[cfg(feature = "defmt")]
#[collapse_debuginfo(yes)] ::defmt::unreachable!($($x)*);
macro_rules! unreachable { }
($($x:tt)*) => {
::defmt::unreachable!($($x)*)
}; };
} }

View File

@ -90,19 +90,15 @@ macro_rules! todo {
}; };
} }
#[collapse_debuginfo(yes)]
macro_rules! unreachable {
($($x:tt)*) => {
{
#[cfg(not(feature = "defmt"))] #[cfg(not(feature = "defmt"))]
#[collapse_debuginfo(yes)] ::core::unreachable!($($x)*);
macro_rules! unreachable {
($($x:tt)*) => {
::core::unreachable!($($x)*)
};
}
#[cfg(feature = "defmt")] #[cfg(feature = "defmt")]
#[collapse_debuginfo(yes)] ::defmt::unreachable!($($x)*);
macro_rules! unreachable { }
($($x:tt)*) => {
::defmt::unreachable!($($x)*)
}; };
} }

View File

@ -90,19 +90,15 @@ macro_rules! todo {
}; };
} }
#[collapse_debuginfo(yes)]
macro_rules! unreachable {
($($x:tt)*) => {
{
#[cfg(not(feature = "defmt"))] #[cfg(not(feature = "defmt"))]
#[collapse_debuginfo(yes)] ::core::unreachable!($($x)*);
macro_rules! unreachable {
($($x:tt)*) => {
::core::unreachable!($($x)*)
};
}
#[cfg(feature = "defmt")] #[cfg(feature = "defmt")]
#[collapse_debuginfo(yes)] ::defmt::unreachable!($($x)*);
macro_rules! unreachable { }
($($x:tt)*) => {
::defmt::unreachable!($($x)*)
}; };
} }

View File

@ -90,19 +90,15 @@ macro_rules! todo {
}; };
} }
#[collapse_debuginfo(yes)]
macro_rules! unreachable {
($($x:tt)*) => {
{
#[cfg(not(feature = "defmt"))] #[cfg(not(feature = "defmt"))]
#[collapse_debuginfo(yes)] ::core::unreachable!($($x)*);
macro_rules! unreachable {
($($x:tt)*) => {
::core::unreachable!($($x)*)
};
}
#[cfg(feature = "defmt")] #[cfg(feature = "defmt")]
#[collapse_debuginfo(yes)] ::defmt::unreachable!($($x)*);
macro_rules! unreachable { }
($($x:tt)*) => {
::defmt::unreachable!($($x)*)
}; };
} }

View File

@ -90,19 +90,15 @@ macro_rules! todo {
}; };
} }
#[collapse_debuginfo(yes)]
macro_rules! unreachable {
($($x:tt)*) => {
{
#[cfg(not(feature = "defmt"))] #[cfg(not(feature = "defmt"))]
#[collapse_debuginfo(yes)] ::core::unreachable!($($x)*);
macro_rules! unreachable {
($($x:tt)*) => {
::core::unreachable!($($x)*)
};
}
#[cfg(feature = "defmt")] #[cfg(feature = "defmt")]
#[collapse_debuginfo(yes)] ::defmt::unreachable!($($x)*);
macro_rules! unreachable { }
($($x:tt)*) => {
::defmt::unreachable!($($x)*)
}; };
} }

View File

@ -90,19 +90,15 @@ macro_rules! todo {
}; };
} }
#[collapse_debuginfo(yes)]
macro_rules! unreachable {
($($x:tt)*) => {
{
#[cfg(not(feature = "defmt"))] #[cfg(not(feature = "defmt"))]
#[collapse_debuginfo(yes)] ::core::unreachable!($($x)*);
macro_rules! unreachable {
($($x:tt)*) => {
::core::unreachable!($($x)*)
};
}
#[cfg(feature = "defmt")] #[cfg(feature = "defmt")]
#[collapse_debuginfo(yes)] ::defmt::unreachable!($($x)*);
macro_rules! unreachable { }
($($x:tt)*) => {
::defmt::unreachable!($($x)*)
}; };
} }

View File

@ -90,19 +90,15 @@ macro_rules! todo {
}; };
} }
#[collapse_debuginfo(yes)]
macro_rules! unreachable {
($($x:tt)*) => {
{
#[cfg(not(feature = "defmt"))] #[cfg(not(feature = "defmt"))]
#[collapse_debuginfo(yes)] ::core::unreachable!($($x)*);
macro_rules! unreachable {
($($x:tt)*) => {
::core::unreachable!($($x)*)
};
}
#[cfg(feature = "defmt")] #[cfg(feature = "defmt")]
#[collapse_debuginfo(yes)] ::defmt::unreachable!($($x)*);
macro_rules! unreachable { }
($($x:tt)*) => {
::defmt::unreachable!($($x)*)
}; };
} }

View File

@ -90,19 +90,15 @@ macro_rules! todo {
}; };
} }
#[collapse_debuginfo(yes)]
macro_rules! unreachable {
($($x:tt)*) => {
{
#[cfg(not(feature = "defmt"))] #[cfg(not(feature = "defmt"))]
#[collapse_debuginfo(yes)] ::core::unreachable!($($x)*);
macro_rules! unreachable {
($($x:tt)*) => {
::core::unreachable!($($x)*)
};
}
#[cfg(feature = "defmt")] #[cfg(feature = "defmt")]
#[collapse_debuginfo(yes)] ::defmt::unreachable!($($x)*);
macro_rules! unreachable { }
($($x:tt)*) => {
::defmt::unreachable!($($x)*)
}; };
} }

View File

@ -90,19 +90,15 @@ macro_rules! todo {
}; };
} }
#[collapse_debuginfo(yes)]
macro_rules! unreachable {
($($x:tt)*) => {
{
#[cfg(not(feature = "defmt"))] #[cfg(not(feature = "defmt"))]
#[collapse_debuginfo(yes)] ::core::unreachable!($($x)*);
macro_rules! unreachable {
($($x:tt)*) => {
::core::unreachable!($($x)*)
};
}
#[cfg(feature = "defmt")] #[cfg(feature = "defmt")]
#[collapse_debuginfo(yes)] ::defmt::unreachable!($($x)*);
macro_rules! unreachable { }
($($x:tt)*) => {
::defmt::unreachable!($($x)*)
}; };
} }

View File

@ -90,19 +90,15 @@ macro_rules! todo {
}; };
} }
#[collapse_debuginfo(yes)]
macro_rules! unreachable {
($($x:tt)*) => {
{
#[cfg(not(feature = "defmt"))] #[cfg(not(feature = "defmt"))]
#[collapse_debuginfo(yes)] ::core::unreachable!($($x)*);
macro_rules! unreachable {
($($x:tt)*) => {
::core::unreachable!($($x)*)
};
}
#[cfg(feature = "defmt")] #[cfg(feature = "defmt")]
#[collapse_debuginfo(yes)] ::defmt::unreachable!($($x)*);
macro_rules! unreachable { }
($($x:tt)*) => {
::defmt::unreachable!($($x)*)
}; };
} }

View File

@ -90,19 +90,15 @@ macro_rules! todo {
}; };
} }
#[collapse_debuginfo(yes)]
macro_rules! unreachable {
($($x:tt)*) => {
{
#[cfg(not(feature = "defmt"))] #[cfg(not(feature = "defmt"))]
#[collapse_debuginfo(yes)] ::core::unreachable!($($x)*);
macro_rules! unreachable {
($($x:tt)*) => {
::core::unreachable!($($x)*)
};
}
#[cfg(feature = "defmt")] #[cfg(feature = "defmt")]
#[collapse_debuginfo(yes)] ::defmt::unreachable!($($x)*);
macro_rules! unreachable { }
($($x:tt)*) => {
::defmt::unreachable!($($x)*)
}; };
} }

View File

@ -90,19 +90,15 @@ macro_rules! todo {
}; };
} }
#[collapse_debuginfo(yes)]
macro_rules! unreachable {
($($x:tt)*) => {
{
#[cfg(not(feature = "defmt"))] #[cfg(not(feature = "defmt"))]
#[collapse_debuginfo(yes)] ::core::unreachable!($($x)*);
macro_rules! unreachable {
($($x:tt)*) => {
::core::unreachable!($($x)*)
};
}
#[cfg(feature = "defmt")] #[cfg(feature = "defmt")]
#[collapse_debuginfo(yes)] ::defmt::unreachable!($($x)*);
macro_rules! unreachable { }
($($x:tt)*) => {
::defmt::unreachable!($($x)*)
}; };
} }

View File

@ -90,19 +90,15 @@ macro_rules! todo {
}; };
} }
#[collapse_debuginfo(yes)]
macro_rules! unreachable {
($($x:tt)*) => {
{
#[cfg(not(feature = "defmt"))] #[cfg(not(feature = "defmt"))]
#[collapse_debuginfo(yes)] ::core::unreachable!($($x)*);
macro_rules! unreachable {
($($x:tt)*) => {
::core::unreachable!($($x)*)
};
}
#[cfg(feature = "defmt")] #[cfg(feature = "defmt")]
#[collapse_debuginfo(yes)] ::defmt::unreachable!($($x)*);
macro_rules! unreachable { }
($($x:tt)*) => {
::defmt::unreachable!($($x)*)
}; };
} }

View File

@ -90,19 +90,15 @@ macro_rules! todo {
}; };
} }
#[collapse_debuginfo(yes)]
macro_rules! unreachable {
($($x:tt)*) => {
{
#[cfg(not(feature = "defmt"))] #[cfg(not(feature = "defmt"))]
#[collapse_debuginfo(yes)] ::core::unreachable!($($x)*);
macro_rules! unreachable {
($($x:tt)*) => {
::core::unreachable!($($x)*)
};
}
#[cfg(feature = "defmt")] #[cfg(feature = "defmt")]
#[collapse_debuginfo(yes)] ::defmt::unreachable!($($x)*);
macro_rules! unreachable { }
($($x:tt)*) => {
::defmt::unreachable!($($x)*)
}; };
} }

View File

@ -90,19 +90,15 @@ macro_rules! todo {
}; };
} }
#[collapse_debuginfo(yes)]
macro_rules! unreachable {
($($x:tt)*) => {
{
#[cfg(not(feature = "defmt"))] #[cfg(not(feature = "defmt"))]
#[collapse_debuginfo(yes)] ::core::unreachable!($($x)*);
macro_rules! unreachable {
($($x:tt)*) => {
::core::unreachable!($($x)*)
};
}
#[cfg(feature = "defmt")] #[cfg(feature = "defmt")]
#[collapse_debuginfo(yes)] ::defmt::unreachable!($($x)*);
macro_rules! unreachable { }
($($x:tt)*) => {
::defmt::unreachable!($($x)*)
}; };
} }