aboutsummaryrefslogtreecommitdiff
path: root/src/common/util.h
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2008-12-11 20:23:46 +0000
committerNick Mathewson <nickm@torproject.org>2008-12-11 20:23:46 +0000
commit4277b0e9265ca24d324e210ded904f1588b24df1 (patch)
treea022c52e7a9311407e62cabd8b91d27703b62d9d /src/common/util.h
parentd9aa57253d7baebda2409c4f10b2989bacab3572 (diff)
downloadtor-4277b0e9265ca24d324e210ded904f1588b24df1.tar.gz
tor-4277b0e9265ca24d324e210ded904f1588b24df1.zip
Remove some cargo-cult gcc hacks around tor_assert and predict_unlikely; instead, use the standard convert-to-boolean hack of "svn st"
svn:r17597
Diffstat (limited to 'src/common/util.h')
-rw-r--r--src/common/util.h10
1 files changed, 1 insertions, 9 deletions
diff --git a/src/common/util.h b/src/common/util.h
index 4f8182949c..e8d78c9847 100644
--- a/src/common/util.h
+++ b/src/common/util.h
@@ -41,18 +41,10 @@
#error "Sorry; we don't support building with NDEBUG."
#endif
-#if defined(__GNUC__)
-/* Give an int-valued version of !x that won't confuse PREDICT_UNLIKELY,
- * which does poorly with pointer types on some versions of glibc. */
-#define IS_FALSE_AS_INT(x) ((x) == ((typeof(x)) 0))
-#else
-#define IS_FALSE_AS_INT(x) !(x)
-#endif
-
/** Like assert(3), but send assertion failures to the log as well as to
* stderr. */
#define tor_assert(expr) STMT_BEGIN \
- if (PREDICT_UNLIKELY(IS_FALSE_AS_INT(expr))) { \
+ if (PREDICT_UNLIKELY(!(expr))) { \
log(LOG_ERR, LD_BUG, "%s:%d: %s: Assertion %s failed; aborting.", \
_SHORT_FILE_, __LINE__, __func__, #expr); \
fprintf(stderr,"%s:%d %s: Assertion %s failed; aborting.\n", \