From 1a134e93d85a1782505c1dcc4656cb73ab64fb82 Mon Sep 17 00:00:00 2001 From: Sergej Schumilo Date: Fri, 30 Dec 2022 09:28:12 +0100 Subject: [PATCH] add nyx_warn_once() macro --- nyx/debug.h | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/nyx/debug.h b/nyx/debug.h index 3827b64a12..d7722a4e2f 100644 --- a/nyx/debug.h +++ b/nyx/debug.h @@ -41,6 +41,14 @@ #define nyx_warn(format, ...) qemu_log(NYX_LOG_PREFIX "Warning: " format, ##__VA_ARGS__) #define nyx_trace(format, ...) nyx_debug("=> %s\n", __func__) +#define nyx_warn_once(format, ...) \ + ({ \ + static bool _printed = false; \ + if (_printed == false){ \ + _printed = true; \ + nyx_warn(format, ##__VA_ARGS__); \ + } \ + }) #ifdef ENABLE_BACKTRACES void qemu_backtrace(void);