mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2025-12-19 03:23:49 +01:00
This makes sure that newlib's printf is correctly overridden by: 1. Adding wrappers for some more obscure printf() variants 2. Forcing a compilation failure when newlib's stdio is still linked in while mpaland-printf is used 3. Not adding `-u _printf_float` to the linker flags when mpaland-printf is used.
29 lines
1.3 KiB
Diff
29 lines
1.3 KiB
Diff
From d864493f611c1435133b7b9c7cdce49d969b16b7 Mon Sep 17 00:00:00 2001
|
|
From: Marian Buschsieweke <marian.buschsieweke@posteo.net>
|
|
Date: Sat, 11 May 2024 22:42:21 +0200
|
|
Subject: [PATCH 1/4] Fix parsing of `int8_t`
|
|
|
|
The code assumes that `char` is signed, but the C standard allows
|
|
`char` to be either signed or unsigned. Instead, `singed char` and
|
|
`unsigned char` need to be used for portable code.
|
|
---
|
|
printf.c | 2 +-
|
|
1 file changed, 1 insertion(+), 1 deletion(-)
|
|
|
|
diff --git a/printf.c b/printf.c
|
|
index 8a700ad..e6e18fa 100644
|
|
--- a/printf.c
|
|
+++ b/printf.c
|
|
@@ -732,7 +732,7 @@ static int _vsnprintf(out_fct_type out, char* buffer, const size_t maxlen, const
|
|
idx = _ntoa_long(out, buffer, idx, maxlen, (unsigned long)(value > 0 ? value : 0 - value), value < 0, base, precision, width, flags);
|
|
}
|
|
else {
|
|
- const int value = (flags & FLAGS_CHAR) ? (char)va_arg(va, int) : (flags & FLAGS_SHORT) ? (short int)va_arg(va, int) : va_arg(va, int);
|
|
+ const int value = (flags & FLAGS_CHAR) ? (signed char)va_arg(va, int) : (flags & FLAGS_SHORT) ? (short int)va_arg(va, int) : va_arg(va, int);
|
|
idx = _ntoa_long(out, buffer, idx, maxlen, (unsigned int)(value > 0 ? value : 0 - value), value < 0, base, precision, width, flags);
|
|
}
|
|
}
|
|
--
|
|
2.43.0
|
|
|