diff options
author | whitequark <whitequark@whitequark.org> | 2020-06-17 19:30:53 +0000 |
---|---|---|
committer | whitequark <whitequark@whitequark.org> | 2020-06-19 15:48:58 +0000 |
commit | 2ffdb74fb1b12e9f3730d0f152b795838934547d (patch) | |
tree | 5b8c8b443fcee553e620a236235cd151a84ed883 /kernel/log.h | |
parent | d5d0cc88d272b85c3be3677993596dcfa82d579f (diff) | |
download | yosys-2ffdb74fb1b12e9f3730d0f152b795838934547d.tar.gz yosys-2ffdb74fb1b12e9f3730d0f152b795838934547d.tar.bz2 yosys-2ffdb74fb1b12e9f3730d0f152b795838934547d.zip |
Use (and ignore) the expression provided to log_assert in NDEBUG builds.
This avoids warnings in NDEBUG builds emitted when a variable is only
used in log_assert, but is always defined.
Diffstat (limited to 'kernel/log.h')
-rw-r--r-- | kernel/log.h | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/kernel/log.h b/kernel/log.h index 501d20c09..ef4b6b456 100644 --- a/kernel/log.h +++ b/kernel/log.h @@ -236,7 +236,7 @@ static inline void log_assert_worker(bool cond, const char *expr, const char *fi } # define log_assert(_assert_expr_) YOSYS_NAMESPACE_PREFIX log_assert_worker(_assert_expr_, #_assert_expr_, __FILE__, __LINE__) #else -# define log_assert(_assert_expr_) +# define log_assert(_assert_expr_) do { if (0) { (void)(_assert_expr_); } } while(0) #endif #define log_abort() YOSYS_NAMESPACE_PREFIX log_error("Abort in %s:%d.\n", __FILE__, __LINE__) |