From e3ce2f544d8a5ea3e23f6c7b43232bf2dfcee19c Mon Sep 17 00:00:00 2001 From: Miodrag Milanovic Date: Wed, 25 Jul 2018 11:58:23 +0200 Subject: noreturn have to be void, so there is no UB --- common/nextpnr.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/common/nextpnr.h b/common/nextpnr.h index e89512f2..2eb46bd3 100644 --- a/common/nextpnr.h +++ b/common/nextpnr.h @@ -79,19 +79,19 @@ class assertion_failure : public std::runtime_error }; NPNR_NORETURN -inline bool assert_fail_impl(const char *message, const char *expr_str, const char *filename, int line) +inline void assert_fail_impl(const char *message, const char *expr_str, const char *filename, int line) { throw assertion_failure(message, expr_str, filename, line); } NPNR_NORETURN -inline bool assert_fail_impl_str(std::string message, const char *expr_str, const char *filename, int line) +inline void assert_fail_impl_str(std::string message, const char *expr_str, const char *filename, int line) { throw assertion_failure(message, expr_str, filename, line); } -#define NPNR_ASSERT(cond) ((void)((cond) || (assert_fail_impl(#cond, #cond, __FILE__, __LINE__)))) -#define NPNR_ASSERT_MSG(cond, msg) ((void)((cond) || (assert_fail_impl(msg, #cond, __FILE__, __LINE__)))) +#define NPNR_ASSERT(cond) (!(cond) ? assert_fail_impl(#cond, #cond, __FILE__, __LINE__) : (void)true) +#define NPNR_ASSERT_MSG(cond, msg) (!(cond) ? assert_fail_impl(msg, #cond, __FILE__, __LINE__) : (void)true) #define NPNR_ASSERT_FALSE(msg) (assert_fail_impl(msg, "false", __FILE__, __LINE__)) #define NPNR_ASSERT_FALSE_STR(msg) (assert_fail_impl_str(msg, "false", __FILE__, __LINE__)) -- cgit v1.2.3