summaryrefslogtreecommitdiffstats
path: root/src/utils
diff options
context:
space:
mode:
authorJan Doskočil <jan.doskocil@nic.cz>2024-07-12 15:22:19 +0200
committerJan Doskočil <jan.doskocil@nic.cz>2024-07-12 15:22:19 +0200
commit1910ab0eb54fe167494e458ee25684b86635bfcc (patch)
treea982e819516427c50dd7d57e9c8894f3f971bbe3 /src/utils
parentMerge branch 'libknot_xdp_UB' into 'master' (diff)
downloadknot-1910ab0eb54fe167494e458ee25684b86635bfcc.tar.xz
knot-1910ab0eb54fe167494e458ee25684b86635bfcc.zip
diagnostic macros: force semicolon after statement
Diffstat (limited to 'src/utils')
-rw-r--r--src/utils/common/msg.h14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/utils/common/msg.h b/src/utils/common/msg.h
index d2ed57e23..3ef550f7b 100644
--- a/src/utils/common/msg.h
+++ b/src/utils/common/msg.h
@@ -23,10 +23,10 @@
#define WARNING_ ";; WARNING: "
#define DEBUG_ ";; DEBUG: "
-#define ERR(msg, ...) { fprintf(stderr, ERROR_ msg "\n", ##__VA_ARGS__); fflush(stderr); }
-#define INFO(msg, ...) { fprintf(stdout, INFO_ msg "\n", ##__VA_ARGS__); fflush(stdout); }
-#define WARN(msg, ...) { fprintf(stderr, WARNING_ msg "\n", ##__VA_ARGS__); fflush(stderr); }
-#define DBG(msg, ...) { msg_debug(DEBUG_ msg "\n", ##__VA_ARGS__); fflush(stdout); }
+#define ERR(msg, ...) do { fprintf(stderr, ERROR_ msg "\n", ##__VA_ARGS__); fflush(stderr); } while (0)
+#define INFO(msg, ...) do { fprintf(stdout, INFO_ msg "\n", ##__VA_ARGS__); fflush(stdout); } while (0)
+#define WARN(msg, ...) do { fprintf(stderr, WARNING_ msg "\n", ##__VA_ARGS__); fflush(stderr); } while (0)
+#define DBG(msg, ...) do { msg_debug(DEBUG_ msg "\n", ##__VA_ARGS__); fflush(stdout); } while (0)
/*! \brief Enable/disable debugging. */
int msg_enable_debug(int val);
@@ -37,6 +37,6 @@ int msg_debug(const char *fmt, ...);
/*! \brief Debug message for null input. */
#define DBG_NULL DBG("%s: null parameter", __func__)
-#define ERR2(msg, ...) { fprintf(stderr, "error: " msg "\n", ##__VA_ARGS__); fflush(stderr); }
-#define WARN2(msg, ...) { fprintf(stderr, "warning: " msg "\n", ##__VA_ARGS__); fflush(stderr); }
-#define INFO2(msg, ...) { fprintf(stdout, msg "\n", ##__VA_ARGS__); fflush(stdout); }
+#define ERR2(msg, ...) do { fprintf(stderr, "error: " msg "\n", ##__VA_ARGS__); fflush(stderr); } while (0)
+#define WARN2(msg, ...) do { fprintf(stderr, "warning: " msg "\n", ##__VA_ARGS__); fflush(stderr); } while (0)
+#define INFO2(msg, ...) do { fprintf(stdout, msg "\n", ##__VA_ARGS__); fflush(stdout); } while (0)