Skip to content

Commit ff40d55

Browse files
committed
fix: make semihosting macros compatible with one-argument format strings
1 parent 118b9a7 commit ff40d55

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

cortex-m-semihosting/src/macros.rs

+7-7
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ macro_rules! syscall1 {
3636
#[macro_export]
3737
macro_rules! hprint {
3838
($s:expr) => {
39-
$crate::export::hstdout_str($s)
39+
$crate::export::hstdout_fmt(format_args!($s))
4040
};
4141
($($tt:tt)*) => {
4242
$crate::export::hstdout_fmt(format_args!($($tt)*))
@@ -53,10 +53,10 @@ macro_rules! hprintln {
5353
$crate::export::hstdout_str("\n")
5454
};
5555
($s:expr) => {
56-
$crate::export::hstdout_str(concat!($s, "\n"))
56+
$crate::export::hstdout_fmt(format_args!("{}\n", format_args!($s)))
5757
};
58-
($s:expr, $($tt:tt)*) => {
59-
$crate::export::hstdout_fmt(format_args!(concat!($s, "\n"), $($tt)*))
58+
(($tt:tt)*) => {
59+
$crate::export::hstdout_fmt(format_args!("{}\n", format_args!($($tt)*)))
6060
};
6161
}
6262

@@ -67,7 +67,7 @@ macro_rules! hprintln {
6767
#[macro_export]
6868
macro_rules! heprint {
6969
($s:expr) => {
70-
$crate::export::hstderr_str($s)
70+
$crate::export::hstderr_fmt(format_args!($s))
7171
};
7272
($($tt:tt)*) => {
7373
$crate::export::hstderr_fmt(format_args!($($tt)*))
@@ -84,10 +84,10 @@ macro_rules! heprintln {
8484
$crate::export::hstderr_str("\n")
8585
};
8686
($s:expr) => {
87-
$crate::export::hstderr_str(concat!($s, "\n"))
87+
$crate::export::hstderr_fmt(format_args!("{}\n", format_args!($s)))
8888
};
8989
($s:expr, $($tt:tt)*) => {
90-
$crate::export::hstderr_fmt(format_args!(concat!($s, "\n"), $($tt)*))
90+
$crate::export::hstderr_fmt(format_args!("{}\n", format_args!($($tt)*)))
9191
};
9292
}
9393

0 commit comments

Comments
 (0)