From b8567ad2ef94465a1aedf09c4e623478f72a1461 Mon Sep 17 00:00:00 2001 From: Benjamin Runnels Date: Tue, 1 Dec 2015 15:20:20 -0600 Subject: [PATCH] Updated DBG macros as suggested by susisstrolch --- cmd/cmd.c | 2 +- cmd/handlers.c | 2 +- esp-link/cgioptiboot.c | 4 +--- esp-link/cgiwifi.c | 2 +- esp-link/mdns.c | 2 +- httpd/httpd.c | 2 +- include/user_config.h | 1 + mqtt/mqtt_cmd.c | 2 +- serial/slip.c | 2 +- 9 files changed, 9 insertions(+), 10 deletions(-) diff --git a/cmd/cmd.c b/cmd/cmd.c index 291939a..f1a7da9 100644 --- a/cmd/cmd.c +++ b/cmd/cmd.c @@ -8,7 +8,7 @@ #include "uart.h" #ifdef CMD_DBG -#define DBG(format, ...) os_printf(format, ## __VA_ARGS__) +#define DBG(format, ...) do { os_printf(format, ## __VA_ARGS__) } while(0) #else #define DBG(format, ...) do { } while(0) #endif diff --git a/cmd/handlers.c b/cmd/handlers.c index 5baf821..35d19ee 100644 --- a/cmd/handlers.c +++ b/cmd/handlers.c @@ -13,7 +13,7 @@ #endif #ifdef CMD_DBG -#define DBG(format, ...) os_printf(format, ## __VA_ARGS__) +#define DBG(format, ...) do { os_printf(format, ## __VA_ARGS__) } while(0) #else #define DBG(format, ...) do { } while(0) #endif diff --git a/esp-link/cgioptiboot.c b/esp-link/cgioptiboot.c index 47cdea2..c266014 100644 --- a/esp-link/cgioptiboot.c +++ b/esp-link/cgioptiboot.c @@ -16,10 +16,8 @@ #define PGM_TIMEOUT 20000 // timeout when sync is achieved, in milliseconds #define PGM_INTERVAL 200 // send sync at this interval in ms when in programming mode -#define OPTIBOOT_DBG -#undef DBG #ifdef OPTIBOOT_DBG -#define DBG(format, ...) os_printf(format, ## __VA_ARGS__) +#define DBG(format, ...) do { os_printf(format, ## __VA_ARGS__) } while(0) #else #define DBG(format, ...) do { } while(0) #endif diff --git a/esp-link/cgiwifi.c b/esp-link/cgiwifi.c index 5297e54..1b7f71c 100644 --- a/esp-link/cgiwifi.c +++ b/esp-link/cgiwifi.c @@ -23,7 +23,7 @@ Cgi/template routines for the /wifi url. #include "mdns.h" #ifdef CGIWIFI_DBG -#define DBG(format, ...) os_printf(format, ## __VA_ARGS__) +#define DBG(format, ...) do { os_printf(format, ## __VA_ARGS__) } while(0) #else #define DBG(format, ...) do { } while(0) #endif diff --git a/esp-link/mdns.c b/esp-link/mdns.c index 9455ce8..a6039bb 100644 --- a/esp-link/mdns.c +++ b/esp-link/mdns.c @@ -13,7 +13,7 @@ #include "mdns.h" #ifdef MDNS_DBG -#define DBG(format, ...) os_printf(format, ## __VA_ARGS__) +#define DBG(format, ...) do { os_printf(format, ## __VA_ARGS__) } while(0) #else #define DBG(format, ...) do { } while(0) #endif diff --git a/httpd/httpd.c b/httpd/httpd.c index f56e579..e9fa6c5 100644 --- a/httpd/httpd.c +++ b/httpd/httpd.c @@ -18,7 +18,7 @@ Esp8266 http server - core routines #include "httpd.h" #ifdef HTTPD_DBG -#define DBG(format, ...) os_printf(format, ## __VA_ARGS__) +#define DBG(format, ...) do { os_printf(format, ## __VA_ARGS__) } while(0) #else #define DBG(format, ...) do { } while(0) #endif diff --git a/include/user_config.h b/include/user_config.h index 02c0a0c..853dc8a 100644 --- a/include/user_config.h +++ b/include/user_config.h @@ -30,6 +30,7 @@ #undef SLIP_DBG #define UART_DBG #define MDNS_DBG +#define OPTIBOOT_DBG // If defined, the default hostname for DHCP will include the chip ID to make it unique #undef CHIP_IN_HOSTNAME diff --git a/mqtt/mqtt_cmd.c b/mqtt/mqtt_cmd.c index 3cca79b..0d7e65a 100644 --- a/mqtt/mqtt_cmd.c +++ b/mqtt/mqtt_cmd.c @@ -8,7 +8,7 @@ #include "mqtt_cmd.h" #ifdef MQTTCMD_DBG -#define DBG(format, ...) os_printf(format, ## __VA_ARGS__) +#define DBG(format, ...) do { os_printf(format, ## __VA_ARGS__) } while(0) #else #define DBG(format, ...) do { } while(0) #endif diff --git a/serial/slip.c b/serial/slip.c index b9446e3..866c811 100644 --- a/serial/slip.c +++ b/serial/slip.c @@ -8,7 +8,7 @@ #include "cmd.h" #ifdef SLIP_DBG -#define DBG(format, ...) os_printf(format, ## __VA_ARGS__) +#define DBG(format, ...) do { os_printf(format, ## __VA_ARGS__) } while(0) #else #define DBG(format, ...) do { } while(0) #endif