From ba82d226929434eef20908a0a4bde5e5a2ba140f Mon Sep 17 00:00:00 2001 From: Tom Hacohen Date: Mon, 22 Jun 2015 15:37:13 +0100 Subject: [PATCH] Logging: Fix broken logging macros. This is macro 101, you don't EVER put multiple statements in a macro like that. See Chris's commits, these broken macros already introduced (subtle) bugs. Always surround macros in "do {} while()" unless you absolutely can't (like when you declare a new variable to be used in the scope). Why is it even there? I think we can safely assume eina log is available for usage in E... @fix --- src/bin/e_log.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/bin/e_log.h b/src/bin/e_log.h index 410078097..325539f42 100644 --- a/src/bin/e_log.h +++ b/src/bin/e_log.h @@ -27,11 +27,11 @@ EINTERN int e_log_shutdown(void); #undef WRN #undef ERR #undef CRI -#define DBG(...) printf(__VA_ARGS__); putc('\n', stdout) -#define INF(...) printf(__VA_ARGS__); putc('\n', stdout) -#define WRN(...) printf(__VA_ARGS__); putc('\n', stdout) -#define ERR(...) printf(__VA_ARGS__); putc('\n', stdout) -#define CRI(...) printf(__VA_ARGS__); putc('\n', stdout) +#define DBG(...) do { printf(__VA_ARGS__); putc('\n', stdout); } while(0) +#define INF(...) do { printf(__VA_ARGS__); putc('\n', stdout); } while(0) +#define WRN(...) do { printf(__VA_ARGS__); putc('\n', stdout); } while(0) +#define ERR(...) do { printf(__VA_ARGS__); putc('\n', stdout); } while(0) +#define CRI(...) do { printf(__VA_ARGS__); putc('\n', stdout); } while(0) #endif #endif