summaryrefslogtreecommitdiff
path: root/util-internal.h
diff options
context:
space:
mode:
authorEvan Jones <evanj@mit.edu>2010-12-06 14:17:44 -0500
committerNick Mathewson <nickm@torproject.org>2010-12-14 00:14:07 -0500
commitb63ab1776b3bbf3fe47406d0ca9639b299c4348d (patch)
treedc127eaffc1c7c185cceb3595719b60894c36bde /util-internal.h
parent18adc3f0159949a628b4e77dfeed857cc4b924a4 (diff)
downloadlibevent-b63ab1776b3bbf3fe47406d0ca9639b299c4348d.tar.gz
EVUTIL_ASSERT: Use sizeof() to avoid "unused variable" warnings.
Diffstat (limited to 'util-internal.h')
-rw-r--r--util-internal.h6
1 files changed, 5 insertions, 1 deletions
diff --git a/util-internal.h b/util-internal.h
index 73cd8f8c..cb76ee4f 100644
--- a/util-internal.h
+++ b/util-internal.h
@@ -52,6 +52,10 @@ extern "C" {
/* A good no-op to use in macro definitions. */
#define _EVUTIL_NIL_STMT ((void)0)
+/* Suppresses the compiler's "unused variable" warnings for unused assert. */
+#define _EVUTIL_NIL_CONDITION(condition) do { \
+ (void)sizeof(condition); \
+} while(0)
/* Internal use only: macros to match patterns of error codes in a
cross-platform way. We need these macros because of two historical
@@ -177,7 +181,7 @@ long _evutil_weakrand(void);
/* Replacement for assert() that calls event_errx on failure. */
#ifdef NDEBUG
-#define EVUTIL_ASSERT(cond) _EVUTIL_NIL_STMT
+#define EVUTIL_ASSERT(cond) _EVUTIL_NIL_CONDITION(cond)
#define EVUTIL_FAILURE_CHECK(cond) 0
#else
#define EVUTIL_ASSERT(cond) \