fix-up PRINTF to use PUTS when no variable args are given

This commit is contained in:
2018-01-13 20:54:57 +01:00
parent 7280338f8b
commit 8a28395102
2 changed files with 10 additions and 2 deletions
+1 -1
View File
@@ -8,7 +8,7 @@
#if USE_DEBUG_UART
// debug printf
int PRINTF(const char *format, ...)
int _DO_PRINTF(const char *format, ...)
{
va_list args;
int len;
+9 -1
View File
@@ -11,12 +11,20 @@
#if USE_DEBUG_UART
int PRINTF(const char *format, ...) __attribute__((format(printf,1,2))) ;
int _DO_PRINTF(const char *format, ...) __attribute__((format(printf,1,2))) ;
void PUTSN(const char *string, size_t len);
int PUTS(const char *string);
void PUTNL(void);
int PUTCHAR(int ch);
#define PRINTF(format, ...) do { \
if (VA_ARG_COUNT(__VA_ARGS__) == 0) { \
PUTS(format); \
} else { \
_DO_PRINTF(format, ##__VA_ARGS__); \
} \
} while (0)
#define dbg(format, ...) do { \
if (VA_ARG_COUNT(__VA_ARGS__) == 0) { \
PUTS(format); \