From 653c05034b7300eba07e37cec7fa224db34d4551 Mon Sep 17 00:00:00 2001 From: Eyck Jentzsch Date: Fri, 29 Nov 2024 18:58:04 +0100 Subject: [PATCH] changes frontend macros to avoid dangling else issues --- report/include/scp/report.h | 43 +++++++++++++++++++++---------------- 1 file changed, 24 insertions(+), 19 deletions(-) diff --git a/report/include/scp/report.h b/report/include/scp/report.h index 56f3303..d174ec1 100644 --- a/report/include/scp/report.h +++ b/report/include/scp/report.h @@ -382,29 +382,34 @@ class call_sc_name_fn /*** End HELPER Macros *******/ //! macro for debug trace level output -#define SCP_TRACEALL(...) \ - if (SCP_VBSTY_CHECK(sc_core::SC_DEBUG, ##__VA_ARGS__)) \ - SCP_LOG(sc_core::SC_DEBUG, __VA_ARGS__) +#define SCP_TRACEALL(...) \ + if (!(SCP_VBSTY_CHECK(sc_core::SC_DEBUG, ##__VA_ARGS__))) { \ + } else \ + SCP_LOG(sc_core::SC_DEBUG, __VA_ARGS__) //! macro for trace level output -#define SCP_TRACE(...) \ - if (SCP_VBSTY_CHECK(sc_core::SC_FULL, ##__VA_ARGS__)) \ - SCP_LOG(sc_core::SC_FULL, __VA_ARGS__) +#define SCP_TRACE(...) \ + if (!(SCP_VBSTY_CHECK(sc_core::SC_FULL, ##__VA_ARGS__))) { \ + } else \ + SCP_LOG(sc_core::SC_FULL, __VA_ARGS__) //! macro for debug level output -#define SCP_DEBUG(...) \ - if (SCP_VBSTY_CHECK(sc_core::SC_HIGH, ##__VA_ARGS__)) \ - SCP_LOG(sc_core::SC_HIGH, __VA_ARGS__) +#define SCP_DEBUG(...) \ + if (!(SCP_VBSTY_CHECK(sc_core::SC_HIGH, ##__VA_ARGS__))) { \ + } else \ + SCP_LOG(sc_core::SC_HIGH, __VA_ARGS__) //! macro for info level output -#define SCP_INFO(...) \ - if (SCP_VBSTY_CHECK(sc_core::SC_MEDIUM, ##__VA_ARGS__)) \ - SCP_LOG(sc_core::SC_MEDIUM, __VA_ARGS__) +#define SCP_INFO(...) \ + if (!(SCP_VBSTY_CHECK(sc_core::SC_MEDIUM, ##__VA_ARGS__))) { \ + } else \ + SCP_LOG(sc_core::SC_MEDIUM, __VA_ARGS__) //! macro for warning level output -#define SCP_WARN(...) \ - if (SCP_VBSTY_CHECK(sc_core::SC_LOW, ##__VA_ARGS__)) \ - ::scp::ScLogger<::sc_core::SC_WARNING>(__FILE__, __LINE__, \ - sc_core::SC_MEDIUM) \ - .type(SCP_GET_FEATURES(__VA_ARGS__)) \ - .get() \ - << _SCP_FMT_EMPTY_STR +#define SCP_WARN(...) \ + if (!(SCP_VBSTY_CHECK(sc_core::SC_LOW, ##__VA_ARGS__))) { \ + } else \ + ::scp::ScLogger<::sc_core::SC_WARNING>(__FILE__, __LINE__, \ + sc_core::SC_MEDIUM) \ + .type(SCP_GET_FEATURES(__VA_ARGS__)) \ + .get() \ + << _SCP_FMT_EMPTY_STR //! macro for error level output #define SCP_ERR(...) \ ::scp::ScLogger<::sc_core::SC_ERROR>(__FILE__, __LINE__, \