From 1818da2ef3decbbed57b513480131853a3f2dadc Mon Sep 17 00:00:00 2001
From: Paul Sokolovsky <pfalcon@users.sourceforge.net>
Date: Sun, 22 Nov 2015 02:46:32 +0200
Subject: [PATCH] lib/utils/printf: Fix issue with putchar define for some
 ports.

---
 lib/utils/printf.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/utils/printf.c b/lib/utils/printf.c
index 6822564f3..f09047d09 100644
--- a/lib/utils/printf.c
+++ b/lib/utils/printf.c
@@ -35,6 +35,7 @@
 #include "py/formatfloat.h"
 #endif
 
+#undef putchar  // Some stdlibs have a #define for putchar
 int printf(const char *fmt, ...);
 int vprintf(const char *fmt, va_list ap);
 int putchar(int c);
@@ -72,7 +73,6 @@ int DEBUG_printf(const char *fmt, ...) {
 #endif
 
 // need this because gcc optimises printf("%c", c) -> putchar(c), and printf("a") -> putchar('a')
-#undef putchar  // Some stdlibs have a #define for putchar
 int putchar(int c) {
     char chr = c;
     mp_hal_stdout_tx_strn_cooked(&chr, 1);
-- 
GitLab